author | Claus Gittinger <cg@exept.de> |
Thu, 14 Apr 2016 19:08:20 +0200 | |
changeset 1393 | 50384f233a0f |
parent 1148 | 341a95374920 |
child 1447 | 2351db93aa5b |
child 1474 | 54b7f76f0e68 |
permissions | -rw-r--r-- |
1008 | 1 |
"{ Package: 'exept:regression' }" |
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 |
" |
|
23 |
This testcase tests St/X makefiles used to build |
|
24 |
standalone applications. |
|
25 |
||
26 |
[author:] |
|
27 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
|
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 |
||
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'. |
|
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 |
||
60 |
!MakefileTests methodsFor:'running'! |
|
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>" |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
67 |
! |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
68 |
|
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
69 |
setUpForPackage: pkg |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
70 |
| components | |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
71 |
package := pkg. |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
72 |
packageDir := (Smalltalk getPackageDirectoryForPackage: Object package) directory directory. |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
73 |
components := (package copyReplaceAll: $: with:$/) tokensBasedOn: $/. |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
74 |
components do:[:each | |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
75 |
packageDir := packageDir / each. |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
76 |
]. |
1008 | 77 |
packageDir exists ifTrue:[ |
78 |
packageDir recursiveRemove. |
|
79 |
]. |
|
80 |
packageDir recursiveMakeDirectory |
|
81 |
||
1021
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
82 |
"Created: / 24-11-2013 / 22:23:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1008 | 83 |
! ! |
84 |
||
85 |
!MakefileTests methodsFor:'tests'! |
|
86 |
||
87 |
test_application_01 |
|
88 |
||
89 |
self run:#'test_application_01' type:ProjectDefinition nonGuiApplicationType toolchain:nil |
|
90 |
||
91 |
"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
|
92 |
! |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
93 |
|
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
94 |
test_application_02 |
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 |
self setUpForPackage: 'tmp:makefiletests2/test_application_02'. |
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
97 |
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
|
98 |
|
19269c8a3ba6
class: RegressionTests::MakefileTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1008
diff
changeset
|
99 |
"Created: / 24-11-2013 / 22:23:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1008 | 100 |
! ! |
101 |
||
102 |
!MakefileTests methodsFor:'tests-helpers'! |
|
103 |
||
104 |
run:packageIdent type:packageType toolchain:toolchain |
|
105 |
| packageDef startup | |
|
106 |
||
107 |
"/ Compile all classes... |
|
108 |
Class packageQuerySignal answer:package do:[ |
|
109 |
(self class privateClasses select:[:cls | cls packageIdent = packageIdent ]) do:[:cls | |
|
110 |
| copy | |
|
111 |
||
112 |
copy := cls superclass |
|
113 |
subclass: cls nameWithoutPrefix |
|
114 |
instanceVariableNames:(cls instVarNames asStringWith:' ') |
|
115 |
classVariableNames:(cls classVarNames asStringWith:' ') |
|
116 |
poolDictionaries:cls poolDictionaries |
|
117 |
category:'** tmp **'. |
|
118 |
cls methodDictionary do:[:each | |
|
119 |
copy compile:each source classified:each category. |
|
120 |
]. |
|
121 |
cls class methodDictionary do:[:each | |
|
122 |
copy class compile:each source classified:each category. |
|
123 |
]. |
|
124 |
(copy inheritsFrom:StandaloneStartup) ifTrue:[ |
|
125 |
startup := copy. |
|
126 |
]. |
|
127 |
]. |
|
128 |
]. |
|
129 |
||
130 |
"/ Create project definition class. |
|
131 |
Class packageQuerySignal answer:package do:[ |
|
132 |
packageDef := ProjectDefinition |
|
133 |
definitionClassForPackage:package |
|
134 |
projectType:packageType |
|
135 |
createIfAbsent:true. |
|
136 |
packageDef theNonMetaclass |
|
137 |
forEachContentsMethodsCodeToCompileDo:[:code :category | packageDef theMetaclass compile:code classified:category ] |
|
138 |
"/ignoreOldEntries: false |
|
139 |
ignoreOldDefinition: false. |
|
140 |
packageDef isApplicationDefinition ifTrue:[ |
|
141 |
packageDef class compile:'startupClassName ^ ' , startup fullName storeString. |
|
142 |
]. |
|
143 |
]. |
|
144 |
"/ Fileout to package directory... |
|
145 |
||
146 |
packageDef classes do:[:class | |
|
147 |
| container | |
|
148 |
||
1148
341a95374920
Fix in copyReplaceAll:wiith:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1021
diff
changeset
|
149 |
container := (class fullName copyReplaceAll:$: with:$_) , '.st'. |
1008 | 150 |
(packageDir / container) |
151 |
writingFileDo:[:f | |
|
152 |
AbstractSourceCodeManager |
|
153 |
fileOutSourceCodeOf:class |
|
154 |
on:f |
|
155 |
withTimeStamp:false |
|
156 |
withInitialize:true |
|
157 |
withDefinition:true |
|
158 |
methodFilter:[:mth | mth package = package ] |
|
159 |
] |
|
160 |
]. |
|
161 |
||
162 |
"/ Generate build support files... |
|
163 |
||
164 |
packageDef fileNamesToGenerate keys do:[:filename | |
|
165 |
| file | |
|
166 |
||
167 |
file := (packageDir / filename). |
|
168 |
file directory recursiveMakeDirectory. |
|
169 |
file writingFileDo:[:f | f nextPutAll:(packageDef generateFile:filename) ]. |
|
170 |
]. |
|
171 |
||
172 |
self make. |
|
173 |
||
174 |
"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
|
175 |
"Modified: / 24-06-2014 / 17:47:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1008 | 176 |
! ! |
177 |
||
178 |
!MakefileTests::TestApplication01 class methodsFor:'accessing'! |
|
179 |
||
180 |
packageIdent |
|
181 |
^ #test_application_01 |
|
182 |
||
183 |
"Created: / 19-11-2013 / 14:04:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
184 |
! ! |
|
185 |
||
186 |
!MakefileTests::TestApplication01 class methodsFor:'startup-to be redefined'! |
|
187 |
||
188 |
main:args |
|
189 |
args isEmpty ifTrue:[ |
|
190 |
Smalltalk exit: 0. |
|
191 |
]. |
|
192 |
args size ~~ 1 ifTrue:[ |
|
193 |
Smalltalk exit: 127. |
|
194 |
]. |
|
195 |
||
196 |
[ |
|
197 |
Smalltalk exit: args first asInteger. |
|
198 |
] on: Error do:[:ex| |
|
199 |
Smalltalk exit: 126. |
|
200 |
]. |
|
201 |
||
202 |
"Created: / 19-11-2013 / 13:12:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
203 |
! ! |
|
204 |
||
205 |
!MakefileTests class methodsFor:'documentation'! |
|
206 |
||
207 |
version |
|
208 |
^ '$Header$' |
|
209 |
! |
|
210 |
||
211 |
version_CVS |
|
212 |
^ '$Header$' |
|
213 |
! ! |
|
214 |