author | vranyj1 |
Wed, 23 Nov 2011 15:26:06 +0000 | |
branch | jk_new_structure |
changeset 1152 | 040cba55a7d2 |
parent 1091 | 215f8fe6687b |
child 1155 | d6f6d5fc0343 |
permissions | -rw-r--r-- |
877 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
1152 | 3 |
|
4 |
New code and modification done at SWING Research Group [1]: |
|
5 |
||
877 | 6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
7 |
SWING Research Group, Czech Technical University in Prague |
|
8 |
||
9 |
Parts of the code written by Claus Gittinger are under following |
|
10 |
license: |
|
11 |
||
12 |
This software is furnished under a license and may be used |
|
13 |
only in accordance with the terms of that license and with the |
|
14 |
inclusion of the above copyright notice. This software may not |
|
15 |
be provided or otherwise made available to, or used by, any |
|
16 |
other person. No title to or ownership of the software is |
|
17 |
hereby transferred. |
|
18 |
||
19 |
[1] Code written at SWING Research Group contain a signature |
|
1152 | 20 |
of one of the above copright owners. For exact set of such code |
21 |
see the differences between this version and version stx:lib |
|
22 |
as of 1.9.2010 |
|
877 | 23 |
" |
761 | 24 |
"{ Package: 'stx:libjava' }" |
25 |
||
859
56bc5e063b7d
Common code from JUnitTestCaseProxy and TestletTestCaseProxy moved to a common superclass
vranyj1
parents:
855
diff
changeset
|
26 |
JavaTestCaseProxy subclass:#TestletTestCaseProxy |
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
27 |
instanceVariableNames:'harness' |
761 | 28 |
classVariableNames:'TestCases' |
29 |
poolDictionaries:'' |
|
859
56bc5e063b7d
Common code from JUnitTestCaseProxy and TestletTestCaseProxy moved to a common superclass
vranyj1
parents:
855
diff
changeset
|
30 |
category:'Languages-Java-Tests-Proxies' |
761 | 31 |
! |
32 |
||
877 | 33 |
!TestletTestCaseProxy class methodsFor:'documentation'! |
34 |
||
35 |
copyright |
|
36 |
" |
|
37 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
1152 | 38 |
|
39 |
New code and modification done at SWING Research Group [1]: |
|
40 |
||
877 | 41 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
42 |
SWING Research Group, Czech Technical University in Prague |
|
43 |
||
44 |
Parts of the code written by Claus Gittinger are under following |
|
45 |
license: |
|
46 |
||
47 |
This software is furnished under a license and may be used |
|
48 |
only in accordance with the terms of that license and with the |
|
49 |
inclusion of the above copyright notice. This software may not |
|
50 |
be provided or otherwise made available to, or used by, any |
|
51 |
other person. No title to or ownership of the software is |
|
52 |
hereby transferred. |
|
53 |
||
54 |
[1] Code written at SWING Research Group contain a signature |
|
1152 | 55 |
of one of the above copright owners. For exact set of such code |
56 |
see the differences between this version and version stx:lib |
|
57 |
as of 1.9.2010 |
|
877 | 58 |
|
59 |
" |
|
60 |
! ! |
|
761 | 61 |
|
62 |
!TestletTestCaseProxy class methodsFor:'accessing'! |
|
63 |
||
64 |
lookupHierarchyRoot |
|
65 |
^ TestletTestCaseProxy |
|
66 |
||
67 |
"Created: / 01-03-2011 / 11:41:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
68 |
"Modified: / 01-03-2011 / 14:54:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
69 |
"Modified: / 29-04-2011 / 10:25:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
70 |
! |
|
71 |
||
72 |
selector: aSymbol |
|
73 |
||
74 |
^super selector: aSymbol |
|
75 |
||
76 |
"Created: / 01-03-2011 / 11:55:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
77 |
! ! |
|
78 |
||
79 |
!TestletTestCaseProxy class methodsFor:'private'! |
|
80 |
||
81 |
testSelectors |
|
82 |
"testlet always has only one test method, but maybe for the future.." |
|
83 |
||
899 | 84 |
^ #( #'test(Lgnu/testlet/TestHarness;)V' ). |
761 | 85 |
|
86 |
"Created: / 01-03-2011 / 10:49:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
87 |
"Modified: / 03-03-2011 / 00:34:39 / Marcel Hlopko <hlopik@gmail.com>" |
|
820
beb45cce2856
Mauve test integration works.. and that's the bad news, there are sooo many failures.. so back to the beginning, let's fix natives..
hlopkmar
parents:
761
diff
changeset
|
88 |
"Modified: / 29-05-2011 / 22:54:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
899 | 89 |
"Modified: / 09-08-2011 / 16:31:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
761 | 90 |
! ! |
91 |
||
92 |
!TestletTestCaseProxy class methodsFor:'queries'! |
|
93 |
||
854
e165b3da9adb
Fixes for running tests in separate processes (required since VM often crash)
vranyj1
parents:
853
diff
changeset
|
94 |
isTestlet |
e165b3da9adb
Fixes for running tests in separate processes (required since VM often crash)
vranyj1
parents:
853
diff
changeset
|
95 |
^ true |
e165b3da9adb
Fixes for running tests in separate processes (required since VM often crash)
vranyj1
parents:
853
diff
changeset
|
96 |
|
761 | 97 |
! ! |
98 |
||
99 |
!TestletTestCaseProxy class methodsFor:'subclass creation'! |
|
100 |
||
101 |
for: javaClass |
|
102 |
"Answers a new (anonymous) testcase proxy for |
|
103 |
given javaClass" |
|
104 |
||
105 |
self assert: javaClass isJavaClass description: 'Not a java class'. |
|
106 |
self assert: javaClass isTestletLike |
|
107 |
description: 'Not a testcase-like class'. |
|
859
56bc5e063b7d
Common code from JUnitTestCaseProxy and TestletTestCaseProxy moved to a common superclass
vranyj1
parents:
855
diff
changeset
|
108 |
^self forClassNamed: javaClass name |
761 | 109 |
|
110 |
"Created: / 01-03-2011 / 10:30:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
111 |
"Modified: / 03-03-2011 / 00:20:49 / Marcel Hlopko <hlopik@gmail.com>" |
|
112 |
"Modified: / 29-04-2011 / 10:21:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
859
56bc5e063b7d
Common code from JUnitTestCaseProxy and TestletTestCaseProxy moved to a common superclass
vranyj1
parents:
855
diff
changeset
|
113 |
"Modified: / 21-06-2011 / 17:08:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
761 | 114 |
! ! |
115 |
||
116 |
!TestletTestCaseProxy methodsFor:'accessing'! |
|
117 |
||
855
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
118 |
nameForHDTestReport |
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
119 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
120 |
^(self class javaClassName copyReplaceAll:$/ with: $.) copyTo: (self class javaClassName lastIndexOf: $/) - 1. |
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
121 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
122 |
"Created: / 01-04-2011 / 16:10:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
123 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
124 |
! |
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
125 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
126 |
selectorForHDTestReport |
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
127 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
128 |
^self class javaClassName copyFrom: |
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
129 |
(self class javaClassName lastIndexOf: $/) + 1 |
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
130 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
131 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
132 |
|
761 | 133 |
! ! |
134 |
||
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
135 |
!TestletTestCaseProxy methodsFor:'error handling'! |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
136 |
|
903 | 137 |
doesNotUnderstand: msg |
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
138 |
|
903 | 139 |
"Here, we have to emulate stx.libjava.tests.TestHarness.Proxy interface..." |
140 |
| sel | |
|
141 |
||
142 |
sel := msg selector. |
|
895 | 143 |
(sel includes:$() ifTrue:[ |
144 |
sel == #'check(Z)V' ifTrue:[ |
|
903 | 145 |
^self assert: msg arg1 == 1 description: ('Assertion failed (checkpoint: %1)' bindWith: self checkPointName). |
895 | 146 |
]. |
903 | 147 |
sel == #'message(Ljava/lang/String;I)V' ifTrue:[ |
148 |
| text type | |
|
149 |
text := Java as_ST_String: msg arg1. |
|
150 |
type := msg arguments at: 2. |
|
151 |
^self message: text type: type. |
|
895 | 152 |
]. |
903 | 153 |
sel == #'directory(I)Ljava/lang/String;' ifTrue:[ |
154 |
^Java as_String: (self directory: msg arg1) asString. |
|
901 | 155 |
]. |
892 | 156 |
]. |
903 | 157 |
^super doesNotUnderstand: msg |
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
158 |
|
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
159 |
"Created: / 31-05-2011 / 16:30:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
160 |
! ! |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
161 |
|
761 | 162 |
!TestletTestCaseProxy methodsFor:'private'! |
163 |
||
895 | 164 |
checkPointName |
165 |
||
166 |
| jstring | |
|
167 |
jstring := harness instVarNamed: #checkPoint. |
|
168 |
^jstring notNil ifTrue:[ |
|
169 |
Java as_ST_String: jstring |
|
170 |
] ifFalse:[ |
|
171 |
'<no checkpoint set>' |
|
172 |
] |
|
761 | 173 |
|
174 |
"Modified: / 29-04-2011 / 10:52:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
895 | 175 |
"Created: / 09-08-2011 / 12:16:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
176 |
! |
|
177 |
||
178 |
createHarness |
|
179 |
||
180 |
harness := (Java classForName: 'stx.libjava.tests.TestHarness') new. |
|
181 |
harness instVarNamed: #proxy put: self. |
|
182 |
||
183 |
"Modified: / 29-04-2011 / 10:52:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
184 |
"Created: / 09-08-2011 / 11:29:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
761 | 185 |
! |
186 |
||
187 |
performTest |
|
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
188 |
| handlerBlock | |
824 | 189 |
|
190 |
handlerBlock := [:ex | TestResult failure sunitSignalWith: ex description]. |
|
761 | 191 |
|
895 | 192 |
self createHarness. |
1091
215f8fe6687b
- few more primitives for java.net.* (working on Tomcat :-)
vranyj1
parents:
1090
diff
changeset
|
193 |
|
215f8fe6687b
- few more primitives for java.net.* (working on Tomcat :-)
vranyj1
parents:
1090
diff
changeset
|
194 |
[ |
215f8fe6687b
- few more primitives for java.net.* (working on Tomcat :-)
vranyj1
parents:
1090
diff
changeset
|
195 |
[ JavaVM unimplementedNativeMethodSignal |
215f8fe6687b
- few more primitives for java.net.* (working on Tomcat :-)
vranyj1
parents:
1090
diff
changeset
|
196 |
handle: |
215f8fe6687b
- few more primitives for java.net.* (working on Tomcat :-)
vranyj1
parents:
1090
diff
changeset
|
197 |
handlerBlock |
215f8fe6687b
- few more primitives for java.net.* (working on Tomcat :-)
vranyj1
parents:
1090
diff
changeset
|
198 |
do: [ |
1090 | 199 |
self javaClass new |
200 |
perform: 'test(Lgnu/testlet/TestHarness;)V' sunitAsSymbol |
|
201 |
with: harness |
|
1091
215f8fe6687b
- few more primitives for java.net.* (working on Tomcat :-)
vranyj1
parents:
1090
diff
changeset
|
202 |
]. |
215f8fe6687b
- few more primitives for java.net.* (working on Tomcat :-)
vranyj1
parents:
1090
diff
changeset
|
203 |
] on: JavaError do: handlerBlock |
215f8fe6687b
- few more primitives for java.net.* (working on Tomcat :-)
vranyj1
parents:
1090
diff
changeset
|
204 |
] ensure:[ |
215f8fe6687b
- few more primitives for java.net.* (working on Tomcat :-)
vranyj1
parents:
1090
diff
changeset
|
205 |
JavaVM releaseMonitorsOfProcess |
215f8fe6687b
- few more primitives for java.net.* (working on Tomcat :-)
vranyj1
parents:
1090
diff
changeset
|
206 |
] |
824 | 207 |
|
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
208 |
"/((harness instVarNamed: 'passed') = 0 ) ifTrue: [ TestResult failure sunitSignalWith: 'Test failed' ]. |
761 | 209 |
|
210 |
"Created: / 01-03-2011 / 14:50:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
820
beb45cce2856
Mauve test integration works.. and that's the bad news, there are sooo many failures.. so back to the beginning, let's fix natives..
hlopkmar
parents:
761
diff
changeset
|
211 |
"Modified: / 29-05-2011 / 23:19:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1091
215f8fe6687b
- few more primitives for java.net.* (working on Tomcat :-)
vranyj1
parents:
1090
diff
changeset
|
212 |
"Modified: / 07-11-2011 / 20:45:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
761 | 213 |
! ! |
214 |
||
903 | 215 |
!TestletTestCaseProxy methodsFor:'private - Proxy interface'! |
216 |
||
217 |
directory: type |
|
218 |
" |
|
219 |
public static final int DIR_TMP = 1; |
|
220 |
public static final int DIR_SRC = 2; |
|
221 |
public static final int DIR_RES = 3; |
|
222 |
public static final int DIR_BLD = 4; |
|
223 |
" |
|
224 |
||
225 |
type == 1 ifTrue:[ |
|
226 |
^Filename newTemporaryDirectory. |
|
227 |
] ifFalse:[type == 2 ifTrue:[ |
|
1054 | 228 |
^JavaTestsResource classpathForMauve anyOne asFilename directory / 'bin' |
903 | 229 |
] ifFalse:[type == 3 ifTrue:[ |
948 | 230 |
^(JavaTestsResource classpathForMauve anyOne asFilename directory / 'src') asString , Filename separator |
903 | 231 |
] ifFalse:[type == 4 ifTrue:[ |
905 | 232 |
^JavaTestsResource classpathForMauve anyOne asFilename |
903 | 233 |
] ifFalse:[ |
234 |
^self error:'Unknown type code' |
|
235 |
]]]]. |
|
236 |
||
237 |
"Created: / 10-08-2011 / 15:03:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
238 |
! |
|
239 |
||
240 |
message:msg type: type |
|
241 |
" |
|
242 |
public static final int MSG_DBG = 1; |
|
243 |
public static final int MSG_INF = 2; |
|
244 |
public static final int MSG_ERR = 3; |
|
245 |
" |
|
246 |
type == 1 ifTrue:[Transcript showCR:' Testlet [DBG]: '] ifFalse:[ |
|
247 |
type == 2 ifTrue:[Transcript showCR:' Testlet [INF]: '] ifFalse:[ |
|
248 |
type == 3 ifTrue:[Transcript showCR:' Testlet [ERR]: '] ifFalse:[ |
|
249 |
Transcript showCR:' Testlet [???]: ']]]. |
|
250 |
Transcript showCR: msg. |
|
251 |
type == 3 ifTrue:[self error: msg]. |
|
252 |
||
253 |
"Created: / 10-08-2011 / 15:06:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
254 |
! ! |
|
255 |
||
761 | 256 |
!TestletTestCaseProxy class methodsFor:'documentation'! |
257 |
||
258 |
version_SVN |
|
259 |
^ '$Id$' |
|
260 |
! ! |