Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
...as possible. On Windows, there's a limit on PATH length
so we need to keep it short. If we don't, tests may fail due
to messed up PATH (commands not found and alike). Fir details
see https://software.intel.com/en-us/articles/limitation-to-the-length-of-the-system-path-variable
--- a/RegressionTests__MakefileTests.st Tue Nov 14 21:13:53 2017 -0300
+++ b/RegressionTests__MakefileTests.st Thu Nov 23 21:04:19 2017 +0000
@@ -3,7 +3,7 @@
"{ NameSpace: RegressionTests }"
TestCase subclass:#MakefileTests
- instanceVariableNames:'package packageDir'
+ instanceVariableNames:'package packageDir make'
classVariableNames:''
poolDictionaries:''
category:'tests-Regression'
@@ -46,47 +46,7 @@
make: target
| cmd output success |
- OperatingSystem isMSWINDOWSlike ifTrue:[
- "/ Hack: generally we don't require Borland tools to be installed anymore.
- "/ However, package build is driwen by Borland make so we distribute
- "/ it with rakefiles. It's likely not in the PATH, so add it.
- "/ This code assumes the test is run from build environment.
- OperatingSystem setEnvironment: 'PATH' to:
- (OperatingSystem pathOfSTXExecutable asFilename directory / '..' / '..' / '..' / '..' / 'bin') pathName , ';',
- (OperatingSystem getEnvironment: 'PATH').
-
- STCCompilerInterface getCCDefine = '__BORLANDC__' ifTrue:[
- cmd := 'bmake.bat ' , target.
- ].
- STCCompilerInterface getCCDefine = '__MINGW32__' ifTrue:[
- (OperatingSystem getEnvironment: 'MINGW_DIR') isNil ifTrue:[
- | mingwDir |
-
- mingwDir := #('C:\MSYS64\MINGW32' 'C:\MINGW') detect:[:path | path asFilename isDirectory ] ifNone: [ nil ].
- self assert: mingwDir notNil description: 'MINGW_DIR environment variable not set and MINGW32 not found at standard places'.
- OperatingSystem setEnvironment: 'MINGW_DIR' to: mingwDir.
- ].
- OperatingSystem setEnvironment: 'MINGW' to: '__MINGW32__'.
- OperatingSystem setEnvironment: 'USEMINGW_ARG' to: '-DUSEMINGW32'.
- OperatingSystem setEnvironment: 'PATH' to: (OperatingSystem getEnvironment: 'PATH') , ';' , (OperatingSystem getEnvironment: 'MINGW_DIR') , '\bin'.
- cmd := 'mingwmake.bat ' , target.
- ].
- STCCompilerInterface getCCDefine = '__MINGW64__' ifTrue:[
- (OperatingSystem getEnvironment: 'MINGW_DIR') isNil ifTrue:[
- | mingwDir |
-
- mingwDir := #('C:\MSYS64\MINGW64' 'C:\MINGW64') detect:[:path | path asFilename isDirectory ] ifNone: [ nil ].
- self assert: mingwDir notNil description: 'MINGW_DIR environment variable not set and MINGW64 not found at standard places'.
- OperatingSystem setEnvironment: 'MINGW_DIR' to: mingwDir.
- ].
- OperatingSystem setEnvironment: 'MINGW' to: '__MINGW64__'.
- OperatingSystem setEnvironment: 'USEMINGW_ARG' to: '-DUSEMINGW64'.
- OperatingSystem setEnvironment: 'PATH' to: (OperatingSystem getEnvironment: 'PATH') , ';' , (OperatingSystem getEnvironment: 'MINGW_DIR') , '\bin'.
- cmd := 'mingwmake.bat ' , target.
- ].
- ] ifFalse:[
- cmd := 'make -f Makefile.init ', target
- ].
+ cmd := make , ' ' , target.
output := String streamContents:[ :s|
success := OperatingSystem executeCommand: cmd outputTo: s inDirectory: packageDir
].
@@ -102,16 +62,66 @@
"Created: / 14-08-2013 / 18:26:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 10-11-2016 / 00:22:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 10-06-2017 / 21:52:13 / jv"
+ "Modified: / 23-11-2017 / 20:35:31 / jv"
! !
!MakefileTests methodsFor:'running'!
setUp
+ OperatingSystem isMSWINDOWSlike ifTrue:[
+ "/ Hack: generally we don't require Borland tools to be installed anymore.
+ "/ However, package build on Windows is driwen by Borland make so we distribute
+ "/ it with rakefiles. It's likely not in the PATH, so add it.
+ "/ This code assumes the test is run from build environment.
+ | path separator binDir mingwBinDir |
+
+ separator := OperatingSystem isMSWINDOWSlike ifTrue:[$;] ifFalse:[$:].
+ path := ((OperatingSystem getEnvironment: 'PATH') ? '') tokensBasedOn: separator.
+ binDir := (OperatingSystem pathOfSTXExecutable asFilename directory / '..' / '..' / '..' / '..' / 'bin') pathName.
+
+ STCCompilerInterface getCCDefine = '__BORLANDC__' ifTrue:[
+ make := 'bmake.bat'
+ ].
+ STCCompilerInterface getCCDefine = '__MINGW32__' ifTrue:[
+ (OperatingSystem getEnvironment: 'MINGW_DIR') isNil ifTrue:[
+ | mingwDir |
+
+ mingwDir := #('C:\MSYS64\MINGW32' 'C:\MINGW') detect:[:path | path asFilename isDirectory ] ifNone: [ nil ].
+ self assert: mingwDir notNil description: 'MINGW_DIR environment variable not set and MINGW32 not found at standard places'.
+ OperatingSystem setEnvironment: 'MINGW_DIR' to: mingwDir.
+ ].
+ OperatingSystem setEnvironment: 'MINGW' to: '__MINGW32__'.
+ OperatingSystem setEnvironment: 'USEMINGW_ARG' to: '-DUSEMINGW32'.
+ make := 'mingwmake.bat'.
+ ].
+ STCCompilerInterface getCCDefine = '__MINGW64__' ifTrue:[
+ (OperatingSystem getEnvironment: 'MINGW_DIR') isNil ifTrue:[
+ | mingwDir |
+
+ mingwDir := #('C:\MSYS64\MINGW64' 'C:\MINGW64') detect:[:path | path asFilename isDirectory ] ifNone: [ nil ].
+ self assert: mingwDir notNil description: 'MINGW_DIR environment variable not set and MINGW64 not found at standard places'.
+ OperatingSystem setEnvironment: 'MINGW_DIR' to: mingwDir.
+ ].
+ OperatingSystem setEnvironment: 'MINGW' to: '__MINGW64__'.
+ OperatingSystem setEnvironment: 'USEMINGW_ARG' to: '-DUSEMINGW64'.
+ make := 'mingwmake.bat'.
+
+ ].
+ mingwBinDir := (OperatingSystem getEnvironment: 'MINGW_DIR') , '\bin'.
+ (path includes: mingwBinDir) ifFalse:[path addLast: mingwBinDir].
+ (path includes: binDir) ifFalse:[path addFirst: binDir].
+ OperatingSystem setEnvironment: 'PATH' to: (path asStringWith:$;)
+ ] ifFalse:[
+ make := 'make -f Makefile.init'
+ ].
+
+
+
self setUpForPackage:'tmp:makefiletests'.
"Created: / 19-11-2013 / 12:57:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 24-11-2013 / 22:23:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 23-11-2017 / 20:34:37 / jv"
!
setUpForPackage: pkg
--- a/RegressionTests__SnapshotRestartTests.st Tue Nov 14 21:13:53 2017 -0300
+++ b/RegressionTests__SnapshotRestartTests.st Thu Nov 23 21:04:19 2017 +0000
@@ -3,7 +3,7 @@
"{ NameSpace: RegressionTests }"
VMSpawningTestCase subclass:#SnapshotRestartTests
- instanceVariableNames:'pkgdir exe tmpdir'
+ instanceVariableNames:'packageDir exe tmpdir make'
classVariableNames:''
poolDictionaries:''
category:'tests-Regression'
@@ -27,53 +27,10 @@
make: target
| cmd output success |
- pkgdir := Smalltalk getPackageDirectoryForPackage: #'stx:goodies/regression/testData/packages/snapshot_restart'.
- self assert: pkgdir notNil.
- self assert: pkgdir isDirectory.
- OperatingSystem isMSWINDOWSlike ifTrue:[
- "/ Hack: generally we don't require Borland tools to be installed anymore.
- "/ However, package build is driwen by Borland make so we distribute
- "/ it with rakefiles. It's likely not in the PATH, so add it.
- "/ This code assumes the test is run from build environment.
- OperatingSystem setEnvironment: 'PATH' to:
- (OperatingSystem pathOfSTXExecutable asFilename directory / '..' / '..' / '..' / '..' / 'bin') pathName , ';',
- (OperatingSystem getEnvironment: 'PATH').
-
- STCCompilerInterface getCCDefine = '__BORLANDC__' ifTrue:[
- cmd := 'bmake.bat ' , target.
- ].
- STCCompilerInterface getCCDefine = '__MINGW32__' ifTrue:[
- (OperatingSystem getEnvironment: 'MINGW_DIR') isNil ifTrue:[
- | mingwDir |
-
- mingwDir := #('C:\MSYS64\MINGW32' 'C:\MINGW') detect:[:path | path asFilename isDirectory ] ifNone: [ nil ].
- self assert: mingwDir notNil description: 'MINGW_DIR environment variable not set and MINGW32 not found at standard places'.
- OperatingSystem setEnvironment: 'MINGW_DIR' to: mingwDir.
- ].
- OperatingSystem setEnvironment: 'MINGW' to: '__MINGW32__'.
- OperatingSystem setEnvironment: 'USEMINGW_ARG' to: '-DUSEMINGW32'.
- OperatingSystem setEnvironment: 'PATH' to: (OperatingSystem getEnvironment: 'PATH') , ';' , (OperatingSystem getEnvironment: 'MINGW_DIR') , '\bin'.
- cmd := 'mingwmake.bat ' , target.
- ].
- STCCompilerInterface getCCDefine = '__MINGW64__' ifTrue:[
- (OperatingSystem getEnvironment: 'MINGW_DIR') isNil ifTrue:[
- | mingwDir |
-
- mingwDir := #('C:\MSYS64\MINGW64' 'C:\MINGW64') detect:[:path | path asFilename isDirectory ] ifNone: [ nil ].
- self assert: mingwDir notNil description: 'MINGW_DIR environment variable not set and MINGW64 not found at standard places'.
- OperatingSystem setEnvironment: 'MINGW_DIR' to: mingwDir.
- ].
- OperatingSystem setEnvironment: 'MINGW' to: '__MINGW64__'.
- OperatingSystem setEnvironment: 'USEMINGW_ARG' to: '-DUSEMINGW64'.
- OperatingSystem setEnvironment: 'PATH' to: (OperatingSystem getEnvironment: 'PATH') , ';' , (OperatingSystem getEnvironment: 'MINGW_DIR') , '\bin'.
- cmd := 'mingwmake.bat ' , target.
- ].
- ] ifFalse:[
- cmd := 'make -f Makefile.init ', target
- ].
+ cmd := make , ' ' , target.
output := String streamContents:[ :s|
- success := OperatingSystem executeCommand: cmd outputTo: s inDirectory: pkgdir
+ success := OperatingSystem executeCommand: cmd outputTo: s inDirectory: packageDir
].
"/ Following is just to ease debugging on Jenkins since stdout
"/ is shown in the report.
@@ -86,8 +43,8 @@
description: 'Failed to make target ''', target, ''' in test package'.
"Created: / 14-08-2013 / 18:26:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 06-01-2017 / 23:20:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 10-06-2017 / 21:47:51 / jv"
+ "Modified: / 10-11-2016 / 00:22:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 23-11-2017 / 23:16:28 / jv"
! !
!SnapshotRestartTests methodsFor:'private'!
@@ -96,6 +53,7 @@
self assert: setupBlock byteCode notNil description: 'setupBlock must have bytecode - stc-compiled blocks not supported'.
self assert: restartBlock byteCode notNil description: 'restartBlock must have bytecode - stc-compiled blocks not supported'.
+ self setUp.
setupBlock value.
Smalltalk addImageStartBlock:[
[
@@ -110,6 +68,7 @@
"Created: / 06-01-2017 / 22:14:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 06-01-2017 / 23:36:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 24-11-2017 / 00:10:11 / jv"
!
performTest
@@ -155,14 +114,62 @@
setUp
super setUp.
+ packageDir := Smalltalk getPackageDirectoryForPackage: #'stx:goodies/regression/testData/packages/snapshot_restart'.
+ self assert: packageDir notNil.
+ self assert: packageDir isDirectory.
+ OperatingSystem isMSWINDOWSlike ifTrue:[
+ "/ Hack: generally we don't require Borland tools to be installed anymore.
+ "/ However, package build on Windows is driwen by Borland make so we distribute
+ "/ it with rakefiles. It's likely not in the PATH, so add it.
+ "/ This code assumes the test is run from build environment.
+ | path separator binDir mingwBinDir |
+ separator := OperatingSystem isMSWINDOWSlike ifTrue:[$;] ifFalse:[$:].
+ path := ((OperatingSystem getEnvironment: 'PATH') ? '') tokensBasedOn: separator.
+ binDir := (OperatingSystem pathOfSTXExecutable asFilename directory / '..' / '..' / '..' / '..' / 'bin') pathName.
+
+ STCCompilerInterface getCCDefine = '__BORLANDC__' ifTrue:[
+ make := 'bmake.bat'
+ ].
+ STCCompilerInterface getCCDefine = '__MINGW32__' ifTrue:[
+ (OperatingSystem getEnvironment: 'MINGW_DIR') isNil ifTrue:[
+ | mingwDir |
+
+ mingwDir := #('C:\MSYS64\MINGW32' 'C:\MINGW') detect:[:path | path asFilename isDirectory ] ifNone: [ nil ].
+ self assert: mingwDir notNil description: 'MINGW_DIR environment variable not set and MINGW32 not found at standard places'.
+ OperatingSystem setEnvironment: 'MINGW_DIR' to: mingwDir.
+ ].
+ OperatingSystem setEnvironment: 'MINGW' to: '__MINGW32__'.
+ OperatingSystem setEnvironment: 'USEMINGW_ARG' to: '-DUSEMINGW32'.
+ make := 'mingwmake.bat'.
+ ].
+ STCCompilerInterface getCCDefine = '__MINGW64__' ifTrue:[
+ (OperatingSystem getEnvironment: 'MINGW_DIR') isNil ifTrue:[
+ | mingwDir |
+
+ mingwDir := #('C:\MSYS64\MINGW64' 'C:\MINGW64') detect:[:path | path asFilename isDirectory ] ifNone: [ nil ].
+ self assert: mingwDir notNil description: 'MINGW_DIR environment variable not set and MINGW64 not found at standard places'.
+ OperatingSystem setEnvironment: 'MINGW_DIR' to: mingwDir.
+ ].
+ OperatingSystem setEnvironment: 'MINGW' to: '__MINGW64__'.
+ OperatingSystem setEnvironment: 'USEMINGW_ARG' to: '-DUSEMINGW64'.
+ make := 'mingwmake.bat'.
+
+ ].
+ mingwBinDir := (OperatingSystem getEnvironment: 'MINGW_DIR') , '\bin'.
+ (path includes: mingwBinDir) ifFalse:[path addLast: mingwBinDir].
+ (path includes: binDir) ifFalse:[path addFirst: binDir].
+ OperatingSystem setEnvironment: 'PATH' to: (path asStringWith:$;)
+ ] ifFalse:[
+ make := 'make -f Makefile.init'
+ ].
tmpdir := Filename newTemporaryDirectory.
exe := OperatingSystem pathOfSTXExecutable.
self make:'clobber'.
"Created: / 14-08-2013 / 18:21:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified (format): / 06-01-2017 / 23:21:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (format): / 27-02-2017 / 09:32:41 / jv"
+ "Modified: / 23-11-2017 / 23:16:35 / jv"
!
tearDown
@@ -253,6 +260,7 @@
"Created: / 14-08-2013 / 20:26:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 04-03-2017 / 12:25:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 24-11-2017 / 00:10:40 / jv"
! !
!SnapshotRestartTests::ToRunOnFreshAndRestartedSnapshotTests methodsFor:'running'!