RegressionTests__SnapshotRestartTests.st
branchjv
changeset 1500 d406a10b2965
parent 1499 26a16a04219b
parent 1447 2351db93aa5b
child 1541 5c6a32e00528
equal deleted inserted replaced
1499:26a16a04219b 1500:d406a10b2965
    23     | innerSuite expected logfileContents |
    23     | innerSuite expected logfileContents |
    24 
    24 
    25     innerSuite := ToRunOnFreshAndRestartedSnapshotTests buildSuite.
    25     innerSuite := ToRunOnFreshAndRestartedSnapshotTests buildSuite.
    26     expected := '%1 run, %1 passed, 0 skipped, 0 failed, 0 errors ### HERE ### ' bindWith: innerSuite tests size.
    26     expected := '%1 run, %1 passed, 0 skipped, 0 failed, 0 errors ### HERE ### ' bindWith: innerSuite tests size.
    27     logfile readingFileDo:[:s |
    27     logfile readingFileDo:[:s |
    28         [ s atEnd ] whileFalse:[
    28 	[ s atEnd ] whileFalse:[
    29             | line |
    29 	    | line |
    30 
    30 
    31             line := s nextLine.
    31 	    line := s nextLine.
    32             "/ Uss starts with because on Windows you get 0xD chars at the end, sigh
    32 	    "/ Uss starts with because on Windows you get 0xD chars at the end, sigh
    33             (line startsWith: expected) ifTrue:[ ^ self ].
    33 	    (line startsWith: expected) ifTrue:[ ^ self ].
    34         ]
    34 	]
    35     ].
    35     ].
    36     "
    36     "
    37     logfile contents asString
    37     logfile contents asString
    38     "
    38     "
    39     logfile readingFileDo: [ :f |
    39     logfile readingFileDo: [ :f |
    84             cmd := 'mingwmake.bat ' , target.
    84             cmd := 'mingwmake.bat ' , target.
    85         ].
    85         ].
    86     ] ifFalse:[
    86     ] ifFalse:[
    87         cmd := 'make -f Makefile.init ', target
    87         cmd := 'make -f Makefile.init ', target
    88     ].
    88     ].
    89     self 
    89     self
    90         assert: (OperatingSystem executeCommand: cmd inDirectory: pkgdir)
    90 	assert: (OperatingSystem executeCommand: cmd inDirectory: pkgdir)
    91         description: 'Failed to make target ''', target, ''' in test package'.
    91 	description: 'Failed to make target ''', target, ''' in test package'.
    92 
    92 
    93     "Created: / 14-08-2013 / 18:26:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    93     "Created: / 14-08-2013 / 18:26:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    94     "Modified: / 27-04-2016 / 09:32:26 / jv"
    94     "Modified: / 27-04-2016 / 09:32:26 / jv"
    95 ! !
    95 ! !
    96 
    96 
   102     script := pkgdir / 'run-ToRunOnFreshAndRestartedSnapshotTests-tests.st'.
   102     script := pkgdir / 'run-ToRunOnFreshAndRestartedSnapshotTests-tests.st'.
   103     self assert: script exists.
   103     self assert: script exists.
   104     log := FileStream newTemporaryIn: Filename currentDirectory nameTemplate: ('RegressionTests__SnapshotRestartTests-' , testSelector , '%1-%2.log').
   104     log := FileStream newTemporaryIn: Filename currentDirectory nameTemplate: ('RegressionTests__SnapshotRestartTests-' , testSelector , '%1-%2.log').
   105     logfile := log fileName.
   105     logfile := log fileName.
   106     [
   106     [
   107         OperatingSystem executeCommand: ('%1 --execute %2' bindWith: exe with: script asAbsoluteFilename pathName) outputTo: log errorTo: log inDirectory: tmpdir pathName.
   107 	OperatingSystem executeCommand: ('%1 --execute %2' bindWith: exe with: script asAbsoluteFilename pathName) outputTo: log errorTo: log inDirectory: tmpdir pathName.
   108     ] ensure:[
   108     ] ensure:[
   109         log close.
   109 	log close.
   110     ].
   110     ].
   111 
   111 
   112     self assertAllTestsPassed: logfile.
   112     self assertAllTestsPassed: logfile.
   113 
   113 
   114     "Created: / 14-08-2013 / 20:06:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   114     "Created: / 14-08-2013 / 20:06:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   119     |  log logfile |
   119     |  log logfile |
   120 
   120 
   121     log := FileStream newTemporaryIn: Filename currentDirectory nameTemplate: ('RegressionTests__SnapshotRestartTests-' , testSelector , '%1-%2.log').
   121     log := FileStream newTemporaryIn: Filename currentDirectory nameTemplate: ('RegressionTests__SnapshotRestartTests-' , testSelector , '%1-%2.log').
   122     logfile := log fileName.
   122     logfile := log fileName.
   123     [
   123     [
   124         OperatingSystem executeCommand: ('%1 -i %2' bindWith: exe with: (tmpdir / 'restart.img') pathName ) outputTo: log errorTo: log inDirectory: tmpdir pathName
   124 	OperatingSystem executeCommand: ('%1 -i %2' bindWith: exe with: (tmpdir / 'restart.img') pathName ) outputTo: log errorTo: log inDirectory: tmpdir pathName
   125     ] ensure:[
   125     ] ensure:[
   126         log close.
   126 	log close.
   127     ].
   127     ].
   128     self assertAllTestsPassed: logfile.
   128     self assertAllTestsPassed: logfile.
   129 
   129 
   130     "Created: / 14-08-2013 / 20:10:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   130     "Created: / 14-08-2013 / 20:10:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   131     "Modified: / 13-09-2013 / 12:54:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   131     "Modified: / 13-09-2013 / 12:54:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   187 !SnapshotRestartTests::ToRunOnFreshAndRestartedSnapshotTests methodsFor:'tests'!
   187 !SnapshotRestartTests::ToRunOnFreshAndRestartedSnapshotTests methodsFor:'tests'!
   188 
   188 
   189 test_01
   189 test_01
   190 
   190 
   191     "/ Use Smalltalk at: to workaround compiler bug...
   191     "/ Use Smalltalk at: to workaround compiler bug...
   192     self assert: (Smalltalk at: #'RegressionTests::SnapshotRestartTestsObject') notNil. 
   192     self assert: (Smalltalk at: #'RegressionTests::SnapshotRestartTestsObject') notNil.
   193     self assert: ((Smalltalk at: #'RegressionTests::SnapshotRestartTestsObject') new addSimple: 12 to: 12) == 24
   193     self assert: ((Smalltalk at: #'RegressionTests::SnapshotRestartTestsObject') new addSimple: 12 to: 12) == 24
   194 
   194 
   195     "Created: / 14-08-2013 / 19:46:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   195     "Created: / 14-08-2013 / 19:46:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   196     "Modified: / 15-08-2013 / 08:20:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   196     "Modified: / 15-08-2013 / 08:20:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   197 !
   197 !
   198 
   198 
   199 test_02
   199 test_02
   200 
   200 
   201     "/ Use Smalltalk at: to workaround compiler bug...         
   201     "/ Use Smalltalk at: to workaround compiler bug...
   202     self assert: (Smalltalk at: #'RegressionTests::SnapshotRestartTestsObject') notNil.
   202     self assert: (Smalltalk at: #'RegressionTests::SnapshotRestartTestsObject') notNil.
   203     self assert: ((Smalltalk at: #'RegressionTests::SnapshotRestartTestsObject') new addUsingBlock: 10 to: 10) == 20
   203     self assert: ((Smalltalk at: #'RegressionTests::SnapshotRestartTestsObject') new addUsingBlock: 10 to: 10) == 20
   204 
   204 
   205     "Created: / 14-08-2013 / 19:46:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   205     "Created: / 14-08-2013 / 19:46:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   206     "Modified: / 15-08-2013 / 08:20:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   206     "Modified: / 15-08-2013 / 08:20:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"