author | Jan Vrany <jan.vrany@labware.com> |
Mon, 08 Mar 2021 11:25:35 +0000 | |
branch | jv |
changeset 2594 | e5f39c0a5bd6 |
parent 1974 | f2eaf05205d6 |
child 2605 | 06d49352dc54 |
permissions | -rw-r--r-- |
1974 | 1 |
" |
2 |
COPYRIGHT (c) Claus Gittinger / eXept Software AG |
|
3 |
COPYRIGHT (c) 2015-2018 Jan Vrany |
|
4 |
All Rights Reserved |
|
5 |
||
6 |
This software is furnished under a license and may be used |
|
7 |
only in accordance with the terms of that license and with the |
|
8 |
inclusion of the above copyright notice. This software may not |
|
9 |
be provided or otherwise made available to, or used by, any |
|
10 |
other person. No title to or ownership of the software is |
|
11 |
hereby transferred. |
|
12 |
" |
|
1447 | 13 |
"{ Package: 'stx:goodies/regression' }" |
1008 | 14 |
|
15 |
"{ NameSpace: RegressionTests }" |
|
16 |
||
17 |
TestCase subclass:#MakefileTests |
|
1960
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
18 |
instanceVariableNames:'package packageDir make' |
1008 | 19 |
classVariableNames:'' |
20 |
poolDictionaries:'' |
|
21 |
category:'tests-Regression' |
|
22 |
! |
|
23 |
||
1972
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
24 |
StandaloneStartup subclass:#TestApplication01StartUp |
1008 | 25 |
instanceVariableNames:'' |
26 |
classVariableNames:'' |
|
27 |
poolDictionaries:'' |
|
28 |
privateIn:MakefileTests |
|
29 |
! |
|
30 |
||
1973 | 31 |
StandaloneStartup subclass:#TestIssue214StartUp |
32 |
instanceVariableNames:'' |
|
33 |
classVariableNames:'' |
|
34 |
poolDictionaries:'' |
|
35 |
privateIn:MakefileTests |
|
36 |
! |
|
37 |
||
1008 | 38 |
!MakefileTests class methodsFor:'documentation'! |
39 |
||
1974 | 40 |
copyright |
41 |
" |
|
42 |
COPYRIGHT (c) Claus Gittinger / eXept Software AG |
|
43 |
COPYRIGHT (c) 2015-2018 Jan Vrany |
|
44 |
All Rights Reserved |
|
45 |
||
46 |
This software is furnished under a license and may be used |
|
47 |
only in accordance with the terms of that license and with the |
|
48 |
inclusion of the above copyright notice. This software may not |
|
49 |
be provided or otherwise made available to, or used by, any |
|
50 |
other person. No title to or ownership of the software is |
|
51 |
hereby transferred. |
|
52 |
" |
|
53 |
! |
|
54 |
||
1008 | 55 |
documentation |
56 |
" |
|
1447 | 57 |
This testcase tests St/X makefiles used to build |
1008 | 58 |
standalone applications. |
59 |
||
60 |
[author:] |
|
1447 | 61 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
1008 | 62 |
|
63 |
[instance variables:] |
|
64 |
||
65 |
[class variables:] |
|
66 |
||
67 |
[see also:] |
|
68 |
||
69 |
" |
|
70 |
! ! |
|
71 |
||
72 |
!MakefileTests methodsFor:'compilation'! |
|
73 |
||
74 |
make |
|
75 |
^ self make:''. |
|
76 |
||
77 |
"Created: / 14-08-2013 / 18:27:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
78 |
! |
|
79 |
||
80 |
make: target |
|
1612
972b34959a7b
Ensure Borland make is in PATH when running tests that compile code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1570
diff
changeset
|
81 |
| cmd output success | |
1008 | 82 |
|
1960
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
83 |
cmd := make , ' ' , target. |
1612
972b34959a7b
Ensure Borland make is in PATH when running tests that compile code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1570
diff
changeset
|
84 |
output := String streamContents:[ :s| |
972b34959a7b
Ensure Borland make is in PATH when running tests that compile code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1570
diff
changeset
|
85 |
success := OperatingSystem executeCommand: cmd outputTo: s inDirectory: packageDir |
972b34959a7b
Ensure Borland make is in PATH when running tests that compile code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1570
diff
changeset
|
86 |
]. |
972b34959a7b
Ensure Borland make is in PATH when running tests that compile code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1570
diff
changeset
|
87 |
"/ Following is just to ease debugging on Jenkins since stdout |
972b34959a7b
Ensure Borland make is in PATH when running tests that compile code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1570
diff
changeset
|
88 |
"/ is shown in the report. |
972b34959a7b
Ensure Borland make is in PATH when running tests that compile code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1570
diff
changeset
|
89 |
success ifFalse:[ |
972b34959a7b
Ensure Borland make is in PATH when running tests that compile code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1570
diff
changeset
|
90 |
Stdout nextPutLine: 'Failed to make target ''', target, ''' in test package'. |
972b34959a7b
Ensure Borland make is in PATH when running tests that compile code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1570
diff
changeset
|
91 |
Stdout nextPutLine: output. |
972b34959a7b
Ensure Borland make is in PATH when running tests that compile code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1570
diff
changeset
|
92 |
]. |
1447 | 93 |
self |
1612
972b34959a7b
Ensure Borland make is in PATH when running tests that compile code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1570
diff
changeset
|
94 |
assert: success |
1541
5c6a32e00528
Fixed `MakefileTests` and `SnapshotRestartTests` to not call obsolete method OperatingSystem>>getCCDefine
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
95 |
description: 'Failed to make target ''', target, ''' in test package'. |
1008 | 96 |
|
97 |
"Created: / 14-08-2013 / 18:26:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1543
6d2bdaf0c9ec
Fixed `MakefileTests` and `SnapshotRestartTests` to work on MSYS2-only systems
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1541
diff
changeset
|
98 |
"Modified: / 10-11-2016 / 00:22:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1960
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
99 |
"Modified: / 23-11-2017 / 20:35:31 / jv" |
1008 | 100 |
! ! |
101 |
||
102 |
!MakefileTests methodsFor:'running'! |
|
103 |
||
104 |
setUp |
|
1960
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
105 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
106 |
"/ Hack: generally we don't require Borland tools to be installed anymore. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
107 |
"/ However, package build on Windows is driwen by Borland make so we distribute |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
108 |
"/ it with rakefiles. It's likely not in the PATH, so add it. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
109 |
"/ This code assumes the test is run from build environment. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
110 |
| path separator binDir mingwBinDir | |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
111 |
|
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
112 |
separator := OperatingSystem isMSWINDOWSlike ifTrue:[$;] ifFalse:[$:]. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
113 |
path := ((OperatingSystem getEnvironment: 'PATH') ? '') tokensBasedOn: separator. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
114 |
binDir := (OperatingSystem pathOfSTXExecutable asFilename directory / '..' / '..' / '..' / '..' / 'bin') pathName. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
115 |
|
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
116 |
STCCompilerInterface getCCDefine = '__BORLANDC__' ifTrue:[ |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
117 |
make := 'bmake.bat' |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
118 |
]. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
119 |
STCCompilerInterface getCCDefine = '__MINGW32__' ifTrue:[ |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
120 |
(OperatingSystem getEnvironment: 'MINGW_DIR') isNil ifTrue:[ |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
121 |
| mingwDir | |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
122 |
|
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
123 |
mingwDir := #('C:\MSYS64\MINGW32' 'C:\MINGW') detect:[:path | path asFilename isDirectory ] ifNone: [ nil ]. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
124 |
self assert: mingwDir notNil description: 'MINGW_DIR environment variable not set and MINGW32 not found at standard places'. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
125 |
OperatingSystem setEnvironment: 'MINGW_DIR' to: mingwDir. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
126 |
]. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
127 |
OperatingSystem setEnvironment: 'MINGW' to: '__MINGW32__'. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
128 |
OperatingSystem setEnvironment: 'USEMINGW_ARG' to: '-DUSEMINGW32'. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
129 |
make := 'mingwmake.bat'. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
130 |
]. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
131 |
STCCompilerInterface getCCDefine = '__MINGW64__' ifTrue:[ |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
132 |
(OperatingSystem getEnvironment: 'MINGW_DIR') isNil ifTrue:[ |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
133 |
| mingwDir | |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
134 |
|
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
135 |
mingwDir := #('C:\MSYS64\MINGW64' 'C:\MINGW64') detect:[:path | path asFilename isDirectory ] ifNone: [ nil ]. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
136 |
self assert: mingwDir notNil description: 'MINGW_DIR environment variable not set and MINGW64 not found at standard places'. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
137 |
OperatingSystem setEnvironment: 'MINGW_DIR' to: mingwDir. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
138 |
]. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
139 |
OperatingSystem setEnvironment: 'MINGW' to: '__MINGW64__'. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
140 |
OperatingSystem setEnvironment: 'USEMINGW_ARG' to: '-DUSEMINGW64'. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
141 |
make := 'mingwmake.bat'. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
142 |
|
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
143 |
]. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
144 |
mingwBinDir := (OperatingSystem getEnvironment: 'MINGW_DIR') , '\bin'. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
145 |
(path includes: mingwBinDir) ifFalse:[path addLast: mingwBinDir]. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
146 |
(path includes: binDir) ifFalse:[path addFirst: binDir]. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
147 |
OperatingSystem setEnvironment: 'PATH' to: (path asStringWith:$;) |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
148 |
] ifFalse:[ |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
149 |
make := 'make -f Makefile.init' |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
150 |
]. |
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
151 |
|
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
152 |
|
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
153 |
|
1972
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
154 |
self setUpForPackage:('tmp:', testSelector) asSymbol. |
1021
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
155 |
|
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
156 |
"Created: / 19-11-2013 / 12:57:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1960
66ad86b6ada2
Fixed `MakefileTests` and `SnapshotRestartTests` to keep PATH environment as short
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1612
diff
changeset
|
157 |
"Modified: / 23-11-2017 / 20:34:37 / jv" |
1972
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
158 |
"Modified: / 30-05-2018 / 14:25:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1021
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
159 |
! |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
160 |
|
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
161 |
setUpForPackage: pkg |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
162 |
| components | |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
163 |
package := pkg. |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
164 |
packageDir := (Smalltalk getPackageDirectoryForPackage: Object package) directory directory. |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
165 |
components := (package copyReplaceAll: $: with:$/) tokensBasedOn: $/. |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
166 |
components do:[:each | |
1447 | 167 |
packageDir := packageDir / each. |
1021
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
168 |
]. |
1008 | 169 |
packageDir exists ifTrue:[ |
1447 | 170 |
packageDir recursiveRemove. |
1008 | 171 |
]. |
172 |
packageDir recursiveMakeDirectory |
|
173 |
||
1021
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
174 |
"Created: / 24-11-2013 / 22:23:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1008 | 175 |
! ! |
176 |
||
177 |
!MakefileTests methodsFor:'tests'! |
|
178 |
||
1972
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
179 |
test_application_01a |
1570
afeaedfc562e
Added 10min timeout for MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1564
diff
changeset
|
180 |
<timeout: 600> "600sec = 10min" |
afeaedfc562e
Added 10min timeout for MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1564
diff
changeset
|
181 |
|
1972
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
182 |
self compile:(Array with:TestApplication01StartUp) type:ProjectDefinition nonGuiApplicationType. |
1008 | 183 |
|
1972
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
184 |
"Created: / 30-05-2018 / 14:22:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1973 | 185 |
"Modified (format): / 31-05-2018 / 21:39:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1021
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
186 |
! |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
187 |
|
1972
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
188 |
test_application_01b |
1973 | 189 |
<timeout: 600> "600sec = 10min" |
1570
afeaedfc562e
Added 10min timeout for MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1564
diff
changeset
|
190 |
|
1972
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
191 |
self setUpForPackage:('tmp:' , testSelector , '/' , testSelector) asSymbol. |
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
192 |
self compile:(Array with:TestApplication01StartUp) type:ProjectDefinition nonGuiApplicationType. |
1021
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
193 |
|
1972
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
194 |
"Created: / 30-05-2018 / 14:23:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1973 | 195 |
"Modified (format): / 31-05-2018 / 21:39:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
196 |
! ! |
|
197 |
||
198 |
!MakefileTests methodsFor:'tests - regression'! |
|
199 |
||
200 |
test_issue_214a |
|
201 |
" |
|
202 |
https://swing.fit.cvut.cz/projects/stx-jv/ticket/214 |
|
203 |
" |
|
204 |
<timeout: 600> "600sec = 10min" |
|
205 |
||
206 |
| exe | |
|
207 |
||
208 |
Screen current isNil ifTrue:[ |
|
209 |
Smalltalk openDisplay. |
|
210 |
]. |
|
211 |
self skipIf:Screen current isNil description:'No display connection'. |
|
212 |
||
213 |
exe := self compile:(Array with:TestIssue214StartUp) type:ProjectDefinition guiApplicationType. |
|
214 |
self assert: (OperatingSystem executeCommand: exe) |
|
215 |
||
216 |
"Created: / 30-05-2018 / 14:52:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
217 |
"Modified (comment): / 31-05-2018 / 21:39:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1008 | 218 |
! ! |
219 |
||
220 |
!MakefileTests methodsFor:'tests-helpers'! |
|
221 |
||
1972
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
222 |
compile: classes type:packageType |
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
223 |
" |
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
224 |
Create a new application package with copy of given classes |
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
225 |
and compile it. Return the path to compiled executable. |
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
226 |
" |
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
227 |
| packageDef startup executable | |
1008 | 228 |
|
229 |
"/ Compile all classes... |
|
230 |
Class packageQuerySignal answer:package do:[ |
|
1972
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
231 |
classes do:[:cls | |
1554 | 232 |
| copy | |
1008 | 233 |
|
1554 | 234 |
copy := cls superclass |
235 |
subclass: cls nameWithoutPrefix |
|
236 |
instanceVariableNames:(cls instVarNames asStringWith:' ') |
|
237 |
classVariableNames:(cls classVarNames asStringWith:' ') |
|
238 |
poolDictionaries:cls poolDictionaries |
|
239 |
category:'** tmp **'. |
|
240 |
cls methodDictionary do:[:each | |
|
241 |
copy compile:each source classified:each category. |
|
242 |
]. |
|
243 |
cls class methodDictionary do:[:each | |
|
244 |
copy class compile:each source classified:each category. |
|
245 |
]. |
|
246 |
(copy inheritsFrom:StandaloneStartup) ifTrue:[ |
|
247 |
startup := copy. |
|
248 |
]. |
|
249 |
]. |
|
250 |
]. |
|
1447 | 251 |
|
1008 | 252 |
"/ Create project definition class. |
1447 | 253 |
Class packageQuerySignal answer:package do:[ |
1554 | 254 |
packageDef := ProjectDefinition |
255 |
definitionClassForPackage:package |
|
256 |
projectType:packageType |
|
257 |
createIfAbsent:true. |
|
258 |
||
259 |
packageDef class compile:'applicationIconFileName ^ nil'. |
|
260 |
packageDef theNonMetaclass |
|
261 |
forEachContentsMethodsCodeToCompileDo:[:code :category | packageDef theMetaclass compile:code classified:category ] |
|
262 |
"/ignoreOldEntries: false |
|
263 |
ignoreOldDefinition: false. |
|
264 |
packageDef isApplicationDefinition ifTrue:[ |
|
265 |
packageDef class compile:'startupClassName ^ ' , startup fullName storeString. |
|
266 |
]. |
|
1447 | 267 |
]. |
1008 | 268 |
"/ Fileout to package directory... |
1447 | 269 |
|
270 |
packageDef classes do:[:class | |
|
1554 | 271 |
| container | |
1008 | 272 |
|
1554 | 273 |
container := (class fullName copyReplaceAll:$: with:$_) , '.st'. |
274 |
(packageDir / container) |
|
275 |
writingFileDo:[:f | |
|
276 |
AbstractSourceCodeManager |
|
277 |
fileOutSourceCodeOf:class |
|
278 |
on:f |
|
279 |
withTimeStamp:false |
|
280 |
withInitialize:true |
|
281 |
withDefinition:true |
|
282 |
methodFilter:[:mth | mth package = package ] |
|
283 |
] |
|
1008 | 284 |
]. |
1447 | 285 |
|
1008 | 286 |
"/ Generate build support files... |
1447 | 287 |
|
288 |
packageDef fileNamesToGenerate keys do:[:filename | |
|
1479
974a26a06296
MakefileTests: Fixed build support file generation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1474
diff
changeset
|
289 |
| contents file | |
1008 | 290 |
|
1479
974a26a06296
MakefileTests: Fixed build support file generation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1474
diff
changeset
|
291 |
contents := packageDef generateFile:filename. |
974a26a06296
MakefileTests: Fixed build support file generation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1474
diff
changeset
|
292 |
contents notNil ifTrue:[ |
1554 | 293 |
file := (packageDir / filename). |
294 |
file directory recursiveMakeDirectory. |
|
1479
974a26a06296
MakefileTests: Fixed build support file generation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1474
diff
changeset
|
295 |
file writingFileDo:[:f | f nextPutAll: contents]. |
974a26a06296
MakefileTests: Fixed build support file generation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1474
diff
changeset
|
296 |
] |
1008 | 297 |
]. |
298 |
||
299 |
self make. |
|
1972
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
300 |
executable := (Smalltalk getPackageDirectoryForPackage: package) / (OperatingSystem isMSWINDOWSlike ifTrue:[packageDef applicationNameConsole] ifFalse:[ packageDef applicationName ]). |
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
301 |
self assert: executable exists. |
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
302 |
self assert:(OperatingSystem canExecuteCommand: executable pathName). |
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
303 |
^ executable pathName |
1008 | 304 |
|
1972
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
305 |
"Created: / 30-05-2018 / 14:22:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1008 | 306 |
! ! |
307 |
||
1972
0d55f748fc8b
Refactored `MakefileTests`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1960
diff
changeset
|
308 |
!MakefileTests::TestApplication01StartUp class methodsFor:'startup-to be redefined'! |
1008 | 309 |
|
310 |
main:args |
|
311 |
args isEmpty ifTrue:[ |
|
1447 | 312 |
Smalltalk exit: 0. |
1008 | 313 |
]. |
314 |
args size ~~ 1 ifTrue:[ |
|
1447 | 315 |
Smalltalk exit: 127. |
1008 | 316 |
]. |
317 |
||
318 |
[ |
|
1447 | 319 |
Smalltalk exit: args first asInteger. |
1008 | 320 |
] on: Error do:[:ex| |
1447 | 321 |
Smalltalk exit: 126. |
1008 | 322 |
]. |
323 |
||
324 |
"Created: / 19-11-2013 / 13:12:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
325 |
! ! |
|
326 |
||
1973 | 327 |
!MakefileTests::TestIssue214StartUp class methodsFor:'startup-to be redefined'! |
328 |
||
329 |
main:args |
|
330 |
[ |
|
331 |
Smalltalk ignoreAssertions: false. |
|
332 |
Display isNil ifTrue:[ Smalltalk openDisplay ]. |
|
333 |
SimpleView setDefaultStyle. |
|
334 |
||
335 |
Stdout nextPutAll: 'Smalltalk packagePath "/ -> '; nextPutLine: Smalltalk packagePath storeString. |
|
336 |
Stdout nextPutAll: 'Smalltalk realSystemPath"/ -> '; nextPutLine: Smalltalk realSystemPath storeString. |
|
337 |
Stdout nextPutAll: 'SimpleView defaultStyle "/ -> '; nextPutLine: SimpleView defaultStyle storeString. |
|
338 |
Stdout nextPutAll: 'SimpleView styleSheet name"/ -> '; nextPutLine: SimpleView styleSheet name storeString. |
|
339 |
||
340 |
self assert: SimpleView defaultStyle notNil description: 'SimpleView defaultStyle == nil'. |
|
341 |
self assert: (SimpleView styleSheet fileReadFailed not) description: 'SimpleView styleSheet fileReadFailed not'. |
|
342 |
] on: Error do:[:ex | |
|
343 |
Stderr nextPutAll: 'ERROR '; nextPutLine: ex description. |
|
344 |
ex suspendedContext fullPrintAllOn: Stderr. |
|
345 |
Smalltalk exitIfStandalone: 1. |
|
346 |
]. |
|
347 |
Smalltalk exitIfStandalone |
|
348 |
" |
|
349 |
TestIssue214StartUp main: #() |
|
350 |
" |
|
351 |
||
352 |
"Created: / 30-05-2018 / 14:50:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
353 |
"Modified: / 04-06-2018 / 09:39:11 / jv" |
|
354 |
! ! |
|
355 |
||
1008 | 356 |
!MakefileTests class methodsFor:'documentation'! |
357 |
||
358 |
version |
|
359 |
^ '$Header$' |
|
360 |
! |
|
361 |
||
362 |
version_CVS |
|
363 |
^ '$Header$' |
|
1474
54b7f76f0e68
Fixed MakefileTests under Windows/MINGW toolchain
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1148
diff
changeset
|
364 |
! |
54b7f76f0e68
Fixed MakefileTests under Windows/MINGW toolchain
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1148
diff
changeset
|
365 |
|
54b7f76f0e68
Fixed MakefileTests under Windows/MINGW toolchain
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1148
diff
changeset
|
366 |
version_HG |
54b7f76f0e68
Fixed MakefileTests under Windows/MINGW toolchain
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1148
diff
changeset
|
367 |
|
54b7f76f0e68
Fixed MakefileTests under Windows/MINGW toolchain
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1148
diff
changeset
|
368 |
^ '$Changeset: <not expanded> $' |
1008 | 369 |
! ! |
370 |