author | Claus Gittinger <cg@exept.de> |
Thu, 14 Apr 2016 19:08:20 +0200 | |
changeset 1393 | 50384f233a0f |
parent 1191 | 1e331c8a74a6 |
child 1447 | 2351db93aa5b |
child 1489 | 2f9591a475f2 |
permissions | -rw-r--r-- |
980 | 1 |
"{ Package: 'exept:regression' }" |
2 |
||
3 |
"{ NameSpace: RegressionTests }" |
|
4 |
||
5 |
TestCase subclass:#SnapshotRestartTests |
|
6 |
instanceVariableNames:'pkgdir exe tmpdir' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
9 |
category:'tests-Regression' |
|
10 |
! |
|
11 |
||
12 |
TestCase subclass:#ToRunOnFreshAndRestartedSnapshotTests |
|
13 |
instanceVariableNames:'' |
|
14 |
classVariableNames:'' |
|
15 |
poolDictionaries:'' |
|
16 |
privateIn:SnapshotRestartTests |
|
17 |
! |
|
18 |
||
19 |
||
20 |
!SnapshotRestartTests methodsFor:'asserting'! |
|
21 |
||
999
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
22 |
assertAllTestsPassed: logfile |
980 | 23 |
| innerSuite expected | |
24 |
||
25 |
innerSuite := ToRunOnFreshAndRestartedSnapshotTests buildSuite. |
|
26 |
expected := '%1 run, %1 passed, 0 skipped, 0 failed, 0 errors ### HERE ### ' bindWith: innerSuite tests size. |
|
999
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
27 |
logfile readingFileDo:[:s | |
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
28 |
[ s atEnd ] whileFalse:[ |
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
29 |
| line | |
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
30 |
|
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
31 |
line := s nextLine. |
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
32 |
"/ Uss starts with because on Windows you get 0xD chars at the end, sigh |
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
33 |
(line startsWith: expected) ifTrue:[ ^ self ]. |
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
34 |
] |
980 | 35 |
]. |
1191
1e331c8a74a6
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1000
diff
changeset
|
36 |
" |
1e331c8a74a6
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1000
diff
changeset
|
37 |
logfile contents asString |
1e331c8a74a6
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1000
diff
changeset
|
38 |
" |
999
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
39 |
self assert: false description: ('Not all inner tests passed. Check log in ' , logfile asAbsoluteFilename pathName). |
980 | 40 |
|
41 |
"Created: / 14-08-2013 / 20:06:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
999
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
42 |
"Modified: / 13-09-2013 / 12:06:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1191
1e331c8a74a6
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1000
diff
changeset
|
43 |
"Modified (comment): / 08-09-2014 / 15:21:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
980 | 44 |
! ! |
45 |
||
46 |
!SnapshotRestartTests methodsFor:'compilation'! |
|
47 |
||
48 |
make |
|
49 |
^ self make:''. |
|
50 |
||
51 |
"Created: / 14-08-2013 / 18:27:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
52 |
! |
|
53 |
||
54 |
make: target |
|
55 |
| cmd | |
|
56 |
||
57 |
cmd := OperatingSystem isMSWINDOWSlike |
|
58 |
ifTrue:['bmake.bat ', target] |
|
990
4ee55eedd9aa
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
980
diff
changeset
|
59 |
ifFalse:['make -f Makefile.init ', target]. |
980 | 60 |
self |
61 |
assert: (OperatingSystem executeCommand: cmd inDirectory: pkgdir) |
|
62 |
description: 'Failed to make target ''', target, ''' in test package'. |
|
63 |
||
64 |
"Created: / 14-08-2013 / 18:26:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
65 |
! ! |
|
66 |
||
67 |
!SnapshotRestartTests methodsFor:'running'! |
|
68 |
||
69 |
runTestsOnFreshImage |
|
999
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
70 |
| script log logfile | |
980 | 71 |
|
72 |
script := pkgdir / 'run-ToRunOnFreshAndRestartedSnapshotTests-tests.st'. |
|
73 |
self assert: script exists. |
|
1000
0856cdcc7674
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
999
diff
changeset
|
74 |
log := FileStream newTemporaryIn: Filename currentDirectory nameTemplate: ('RegressionTests__SnapshotRestartTests-' , testSelector , '%1-%2.log'). |
999
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
75 |
logfile := log fileName. |
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
76 |
[ |
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
77 |
OperatingSystem executeCommand: ('%1 --execute %2' bindWith: exe with: script asAbsoluteFilename pathName) outputTo: log errorTo: log inDirectory: tmpdir pathName. |
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
78 |
] ensure:[ |
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
79 |
log close. |
980 | 80 |
]. |
999
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
81 |
|
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
82 |
self assertAllTestsPassed: logfile. |
980 | 83 |
|
84 |
"Created: / 14-08-2013 / 20:06:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1000
0856cdcc7674
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
999
diff
changeset
|
85 |
"Modified: / 13-09-2013 / 12:54:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
980 | 86 |
! |
87 |
||
88 |
runTestsOnRestartedImage |
|
999
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
89 |
| log logfile | |
980 | 90 |
|
1000
0856cdcc7674
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
999
diff
changeset
|
91 |
log := FileStream newTemporaryIn: Filename currentDirectory nameTemplate: ('RegressionTests__SnapshotRestartTests-' , testSelector , '%1-%2.log'). |
999
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
92 |
logfile := log fileName. |
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
93 |
[ |
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
94 |
OperatingSystem executeCommand: ('%1 -i %2' bindWith: exe with: (tmpdir / 'restart.img') pathName ) outputTo: log errorTo: log inDirectory: tmpdir pathName |
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
95 |
] ensure:[ |
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
96 |
log close. |
980 | 97 |
]. |
999
8626f0850709
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
98 |
self assertAllTestsPassed: logfile. |
980 | 99 |
|
100 |
"Created: / 14-08-2013 / 20:10:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1000
0856cdcc7674
class: RegressionTests::SnapshotRestartTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
999
diff
changeset
|
101 |
"Modified: / 13-09-2013 / 12:54:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
980 | 102 |
! |
103 |
||
104 |
setUp |
|
105 |
tmpdir := Filename newTemporaryDirectory. |
|
106 |
pkgdir := Smalltalk getPackageDirectoryForPackage: #'exept:regression/testData/packages/snapshot_restart'. |
|
107 |
self assert: pkgdir notNil. |
|
108 |
self assert: pkgdir isDirectory. |
|
109 |
||
110 |
exe := OperatingSystem pathOfSTXExecutable. |
|
111 |
||
112 |
self make:'clobber'. |
|
113 |
||
114 |
"Created: / 14-08-2013 / 18:21:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
115 |
"Modified: / 14-08-2013 / 20:17:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
116 |
! |
|
117 |
||
118 |
tearDown |
|
119 |
tmpdir recursiveRemove. |
|
120 |
||
121 |
"Created: / 14-08-2013 / 20:17:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
122 |
! ! |
|
123 |
||
124 |
!SnapshotRestartTests methodsFor:'tests'! |
|
125 |
||
126 |
test_bc |
|
127 |
||
128 |
"Test restsrt with bytecode-compiled package" |
|
129 |
||
130 |
self runTestsOnFreshImage. |
|
131 |
self runTestsOnRestartedImage. |
|
132 |
||
133 |
"Created: / 14-08-2013 / 19:58:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
134 |
! |
|
135 |
||
136 |
test_stc |
|
137 |
||
138 |
"Test restsrt with bytecode-compiled package" |
|
139 |
||
140 |
self make. |
|
141 |
self runTestsOnFreshImage. |
|
142 |
self runTestsOnRestartedImage. |
|
143 |
||
144 |
"Created: / 14-08-2013 / 20:26:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
145 |
! ! |
|
146 |
||
147 |
!SnapshotRestartTests::ToRunOnFreshAndRestartedSnapshotTests methodsFor:'running'! |
|
148 |
||
149 |
setUp |
|
150 |
(Smalltalk at: #'RegressionTests::SnapshotRestartTestsObject') isNil ifTrue:[ |
|
151 |
Smalltalk loadPackage: #'exept:regression/testData/packages/snapshot_restart'. |
|
152 |
]. |
|
153 |
||
154 |
"Created: / 14-08-2013 / 19:47:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
155 |
! ! |
|
156 |
||
157 |
!SnapshotRestartTests::ToRunOnFreshAndRestartedSnapshotTests methodsFor:'tests'! |
|
158 |
||
159 |
test_01 |
|
160 |
||
161 |
"/ Use Smalltalk at: to workaround compiler bug... |
|
162 |
self assert: (Smalltalk at: #'RegressionTests::SnapshotRestartTestsObject') notNil. |
|
163 |
self assert: ((Smalltalk at: #'RegressionTests::SnapshotRestartTestsObject') new addSimple: 12 to: 12) == 24 |
|
164 |
||
165 |
"Created: / 14-08-2013 / 19:46:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
166 |
"Modified: / 15-08-2013 / 08:20:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
167 |
! |
|
168 |
||
169 |
test_02 |
|
170 |
||
171 |
"/ Use Smalltalk at: to workaround compiler bug... |
|
172 |
self assert: (Smalltalk at: #'RegressionTests::SnapshotRestartTestsObject') notNil. |
|
173 |
self assert: ((Smalltalk at: #'RegressionTests::SnapshotRestartTestsObject') new addUsingBlock: 10 to: 10) == 20 |
|
174 |
||
175 |
"Created: / 14-08-2013 / 19:46:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
176 |
"Modified: / 15-08-2013 / 08:20:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
177 |
! ! |
|
178 |
||
179 |
!SnapshotRestartTests::ToRunOnFreshAndRestartedSnapshotTests methodsFor:'tests - disabled'! |
|
180 |
||
181 |
disabled_test_03 |
|
182 |
"/ Not yet supported, but JV has an idea how to fix it :-) |
|
183 |
||
184 |
self assert: (Smalltalk at: #'RegressionTests::SnapshotRestartTestsObject') notNil. |
|
185 |
self assert: ((Smalltalk at: #'RegressionTests::SnapshotRestartTestsObject') new addThirteenUsingRememberedBlockTo: 2) == 15 |
|
186 |
||
187 |
"Created: / 14-08-2013 / 19:53:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
188 |
"Modified: / 15-08-2013 / 08:20:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
189 |
! ! |
|
190 |
||
191 |
!SnapshotRestartTests class methodsFor:'documentation'! |
|
192 |
||
193 |
version |
|
194 |
^ '$Header$' |
|
195 |
! |
|
196 |
||
197 |
version_CVS |
|
198 |
^ '$Header$' |
|
199 |
! |
|
200 |
||
201 |
version_SVN |
|
202 |
^ '$Id$' |
|
203 |
! ! |
|
204 |