author | Claus Gittinger <cg@exept.de> |
Wed, 27 Mar 2019 18:34:04 +0100 | |
changeset 2189 | 5c1b6dc15541 |
parent 2167 | cb36a250a159 |
permissions | -rw-r--r-- |
1447 | 1 |
"{ Package: 'stx:goodies/regression' }" |
1008 | 2 |
|
3 |
"{ NameSpace: RegressionTests }" |
|
4 |
||
5 |
TestCase subclass:#MakefileTests |
|
6 |
instanceVariableNames:'package packageDir' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
9 |
category:'tests-Regression' |
|
10 |
! |
|
11 |
||
12 |
StandaloneStartup subclass:#TestApplication01 |
|
13 |
instanceVariableNames:'' |
|
14 |
classVariableNames:'' |
|
15 |
poolDictionaries:'' |
|
16 |
privateIn:MakefileTests |
|
17 |
! |
|
18 |
||
19 |
!MakefileTests class methodsFor:'documentation'! |
|
20 |
||
21 |
documentation |
|
22 |
" |
|
1447 | 23 |
This testcase tests St/X makefiles used to build |
1008 | 24 |
standalone applications. |
25 |
||
26 |
[author:] |
|
1447 | 27 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
1008 | 28 |
|
29 |
[instance variables:] |
|
30 |
||
31 |
[class variables:] |
|
32 |
||
33 |
[see also:] |
|
34 |
||
35 |
" |
|
36 |
! ! |
|
37 |
||
38 |
!MakefileTests methodsFor:'compilation'! |
|
39 |
||
40 |
make |
|
41 |
^ self make:''. |
|
42 |
||
43 |
"Created: / 14-08-2013 / 18:27:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
44 |
! |
|
45 |
||
46 |
make: target |
|
47 |
| cmd | |
|
48 |
||
1447 | 49 |
cmd := OperatingSystem isMSWINDOWSlike |
50 |
ifTrue:['bmake.bat ', target] |
|
51 |
ifFalse:['make -f Makefile.init ', target]. |
|
52 |
self |
|
53 |
assert: (OperatingSystem executeCommand: cmd inDirectory: packageDir) |
|
54 |
description: 'Failed to make target ''', target, ''' in test package'. |
|
1008 | 55 |
|
56 |
"Created: / 14-08-2013 / 18:26:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
57 |
"Modified: / 19-11-2013 / 18:49:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
58 |
! ! |
|
59 |
||
2167 | 60 |
!MakefileTests methodsFor:'initialize / release'! |
1008 | 61 |
|
62 |
setUp |
|
1021
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
63 |
self setUpForPackage:'tmp:makefiletests'. |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
64 |
|
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
65 |
"Created: / 19-11-2013 / 12:57:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
66 |
"Modified: / 24-11-2013 / 22:23:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2167 | 67 |
! ! |
68 |
||
69 |
!MakefileTests methodsFor:'running'! |
|
1021
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
70 |
|
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
71 |
setUpForPackage: pkg |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
72 |
| components | |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
73 |
package := pkg. |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
74 |
packageDir := (Smalltalk getPackageDirectoryForPackage: Object package) directory directory. |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
75 |
components := (package copyReplaceAll: $: with:$/) tokensBasedOn: $/. |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
76 |
components do:[:each | |
1447 | 77 |
packageDir := packageDir / each. |
1021
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
78 |
]. |
1008 | 79 |
packageDir exists ifTrue:[ |
1447 | 80 |
packageDir recursiveRemove. |
1008 | 81 |
]. |
82 |
packageDir recursiveMakeDirectory |
|
83 |
||
1021
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
84 |
"Created: / 24-11-2013 / 22:23:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1008 | 85 |
! ! |
86 |
||
87 |
!MakefileTests methodsFor:'tests'! |
|
88 |
||
89 |
test_application_01 |
|
90 |
||
91 |
self run:#'test_application_01' type:ProjectDefinition nonGuiApplicationType toolchain:nil |
|
92 |
||
93 |
"Created: / 19-11-2013 / 14:05:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1021
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
94 |
! |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
95 |
|
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
96 |
test_application_02 |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
97 |
|
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
98 |
self setUpForPackage: 'tmp:makefiletests2/test_application_02'. |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
99 |
self run:#'test_application_01' type:ProjectDefinition nonGuiApplicationType toolchain:nil |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
100 |
|
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
101 |
"Created: / 24-11-2013 / 22:23:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1008 | 102 |
! ! |
103 |
||
104 |
!MakefileTests methodsFor:'tests-helpers'! |
|
105 |
||
1447 | 106 |
run:packageIdent type:packageType toolchain:toolchain |
1008 | 107 |
| packageDef startup | |
108 |
||
109 |
"/ Compile all classes... |
|
110 |
Class packageQuerySignal answer:package do:[ |
|
1554 | 111 |
(self class privateClasses select:[:cls | cls packageIdent = packageIdent ]) do:[:cls | |
112 |
| copy | |
|
1008 | 113 |
|
1554 | 114 |
copy := cls superclass |
115 |
subclass: cls nameWithoutPrefix |
|
116 |
instanceVariableNames:(cls instVarNames asStringWith:' ') |
|
117 |
classVariableNames:(cls classVarNames asStringWith:' ') |
|
118 |
poolDictionaries:cls poolDictionaries |
|
119 |
category:'** tmp **'. |
|
120 |
cls methodDictionary do:[:each | |
|
121 |
copy compile:each source classified:each category. |
|
122 |
]. |
|
123 |
cls class methodDictionary do:[:each | |
|
124 |
copy class compile:each source classified:each category. |
|
125 |
]. |
|
126 |
(copy inheritsFrom:StandaloneStartup) ifTrue:[ |
|
127 |
startup := copy. |
|
128 |
]. |
|
129 |
]. |
|
130 |
]. |
|
1447 | 131 |
|
1008 | 132 |
"/ Create project definition class. |
1447 | 133 |
Class packageQuerySignal answer:package do:[ |
1554 | 134 |
packageDef := ProjectDefinition |
135 |
definitionClassForPackage:package |
|
136 |
projectType:packageType |
|
137 |
createIfAbsent:true. |
|
138 |
||
139 |
packageDef class compile:'applicationIconFileName ^ nil'. |
|
140 |
packageDef theNonMetaclass |
|
141 |
forEachContentsMethodsCodeToCompileDo:[:code :category | packageDef theMetaclass compile:code classified:category ] |
|
142 |
"/ignoreOldEntries: false |
|
143 |
ignoreOldDefinition: false. |
|
144 |
packageDef isApplicationDefinition ifTrue:[ |
|
145 |
packageDef class compile:'startupClassName ^ ' , startup fullName storeString. |
|
146 |
]. |
|
1447 | 147 |
]. |
1008 | 148 |
"/ Fileout to package directory... |
1447 | 149 |
|
150 |
packageDef classes do:[:class | |
|
1554 | 151 |
| container | |
1008 | 152 |
|
1554 | 153 |
container := (class fullName copyReplaceAll:$: with:$_) , '.st'. |
154 |
(packageDir / container) |
|
155 |
writingFileDo:[:f | |
|
156 |
AbstractSourceCodeManager |
|
157 |
fileOutSourceCodeOf:class |
|
158 |
on:f |
|
159 |
withTimeStamp:false |
|
160 |
withInitialize:true |
|
161 |
withDefinition:true |
|
162 |
methodFilter:[:mth | mth package = package ] |
|
163 |
] |
|
1008 | 164 |
]. |
1447 | 165 |
|
1008 | 166 |
"/ Generate build support files... |
1447 | 167 |
|
1554 | 168 |
packageDef fileNamesToGenerate keys |
169 |
reject:[:filename | |
|
170 |
"/ some exclusions javaBundle |
|
171 |
packageDef javaBundle isNil |
|
172 |
and:[ |
|
173 |
#( |
|
174 |
'java/build.xml' |
|
175 |
'java/build.auto.xml' |
|
176 |
) includes:filename |
|
177 |
] |
|
178 |
] |
|
179 |
thenDo:[:filename | |
|
180 |
| file | |
|
1008 | 181 |
|
1554 | 182 |
file := (packageDir / filename). |
183 |
file directory recursiveMakeDirectory. |
|
184 |
file writingFileDo:[:f | f nextPutAll:(packageDef generateFile:filename) ]. |
|
185 |
]. |
|
1008 | 186 |
|
187 |
self make. |
|
188 |
||
189 |
"Created: / 19-11-2013 / 14:07:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1148
341a95374920
Fix in copyReplaceAll:wiith:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1021
diff
changeset
|
190 |
"Modified: / 24-06-2014 / 17:47:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1008 | 191 |
! ! |
192 |
||
193 |
!MakefileTests::TestApplication01 class methodsFor:'accessing'! |
|
194 |
||
195 |
packageIdent |
|
196 |
^ #test_application_01 |
|
197 |
||
198 |
"Created: / 19-11-2013 / 14:04:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
199 |
! ! |
|
200 |
||
201 |
!MakefileTests::TestApplication01 class methodsFor:'startup-to be redefined'! |
|
202 |
||
203 |
main:args |
|
204 |
args isEmpty ifTrue:[ |
|
1447 | 205 |
Smalltalk exit: 0. |
1008 | 206 |
]. |
207 |
args size ~~ 1 ifTrue:[ |
|
1447 | 208 |
Smalltalk exit: 127. |
1008 | 209 |
]. |
210 |
||
211 |
[ |
|
1447 | 212 |
Smalltalk exit: args first asInteger. |
1008 | 213 |
] on: Error do:[:ex| |
1447 | 214 |
Smalltalk exit: 126. |
1008 | 215 |
]. |
216 |
||
217 |
"Created: / 19-11-2013 / 13:12:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
218 |
! ! |
|
219 |
||
220 |
!MakefileTests class methodsFor:'documentation'! |
|
221 |
||
222 |
version |
|
223 |
^ '$Header$' |
|
224 |
! |
|
225 |
||
226 |
version_CVS |
|
227 |
^ '$Header$' |
|
228 |
! ! |
|
229 |