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