--- 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