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
|
|
63 |
package := 'tmp/makefiletests'.
|
|
64 |
packageDir := (Smalltalk getPackageDirectoryForPackage: Object package) directory directory / 'tmp' / 'makefiletests'.
|
|
65 |
packageDir exists ifTrue:[
|
|
66 |
packageDir recursiveRemove.
|
|
67 |
].
|
|
68 |
packageDir recursiveMakeDirectory
|
|
69 |
|
|
70 |
"Created: / 19-11-2013 / 12:57:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
71 |
"Modified: / 19-11-2013 / 18:38:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
72 |
! !
|
|
73 |
|
|
74 |
!MakefileTests methodsFor:'tests'!
|
|
75 |
|
|
76 |
test_application_01
|
|
77 |
|
|
78 |
self run:#'test_application_01' type:ProjectDefinition nonGuiApplicationType toolchain:nil
|
|
79 |
|
|
80 |
"Created: / 19-11-2013 / 14:05:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
81 |
! !
|
|
82 |
|
|
83 |
!MakefileTests methodsFor:'tests-helpers'!
|
|
84 |
|
|
85 |
run:packageIdent type:packageType toolchain:toolchain
|
|
86 |
| packageDef startup |
|
|
87 |
|
|
88 |
"/ Compile all classes...
|
|
89 |
Class packageQuerySignal answer:package do:[
|
|
90 |
(self class privateClasses select:[:cls | cls packageIdent = packageIdent ]) do:[:cls |
|
|
91 |
| copy |
|
|
92 |
|
|
93 |
copy := cls superclass
|
|
94 |
subclass: cls nameWithoutPrefix
|
|
95 |
instanceVariableNames:(cls instVarNames asStringWith:' ')
|
|
96 |
classVariableNames:(cls classVarNames asStringWith:' ')
|
|
97 |
poolDictionaries:cls poolDictionaries
|
|
98 |
category:'** tmp **'.
|
|
99 |
cls methodDictionary do:[:each |
|
|
100 |
copy compile:each source classified:each category.
|
|
101 |
].
|
|
102 |
cls class methodDictionary do:[:each |
|
|
103 |
copy class compile:each source classified:each category.
|
|
104 |
].
|
|
105 |
(copy inheritsFrom:StandaloneStartup) ifTrue:[
|
|
106 |
startup := copy.
|
|
107 |
].
|
|
108 |
].
|
|
109 |
].
|
|
110 |
|
|
111 |
"/ Create project definition class.
|
|
112 |
Class packageQuerySignal answer:package do:[
|
|
113 |
packageDef := ProjectDefinition
|
|
114 |
definitionClassForPackage:package
|
|
115 |
projectType:packageType
|
|
116 |
createIfAbsent:true.
|
|
117 |
packageDef theNonMetaclass
|
|
118 |
forEachContentsMethodsCodeToCompileDo:[:code :category | packageDef theMetaclass compile:code classified:category ]
|
|
119 |
"/ignoreOldEntries: false
|
|
120 |
ignoreOldDefinition: false.
|
|
121 |
packageDef isApplicationDefinition ifTrue:[
|
|
122 |
packageDef class compile:'startupClassName ^ ' , startup fullName storeString.
|
|
123 |
].
|
|
124 |
].
|
|
125 |
"/ Fileout to package directory...
|
|
126 |
|
|
127 |
packageDef classes do:[:class |
|
|
128 |
| container |
|
|
129 |
|
|
130 |
container := (class fullName copyReplaceAll:$: with:#'_') , '.st'.
|
|
131 |
(packageDir / container)
|
|
132 |
writingFileDo:[:f |
|
|
133 |
AbstractSourceCodeManager
|
|
134 |
fileOutSourceCodeOf:class
|
|
135 |
on:f
|
|
136 |
withTimeStamp:false
|
|
137 |
withInitialize:true
|
|
138 |
withDefinition:true
|
|
139 |
methodFilter:[:mth | mth package = package ]
|
|
140 |
]
|
|
141 |
].
|
|
142 |
|
|
143 |
"/ Generate build support files...
|
|
144 |
|
|
145 |
packageDef fileNamesToGenerate keys do:[:filename |
|
|
146 |
| file |
|
|
147 |
|
|
148 |
file := (packageDir / filename).
|
|
149 |
file directory recursiveMakeDirectory.
|
|
150 |
file writingFileDo:[:f | f nextPutAll:(packageDef generateFile:filename) ].
|
|
151 |
].
|
|
152 |
|
|
153 |
self make.
|
|
154 |
|
|
155 |
"Created: / 19-11-2013 / 14:07:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
156 |
"Modified: / 19-11-2013 / 18:49:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
157 |
! !
|
|
158 |
|
|
159 |
!MakefileTests::TestApplication01 class methodsFor:'accessing'!
|
|
160 |
|
|
161 |
packageIdent
|
|
162 |
^ #test_application_01
|
|
163 |
|
|
164 |
"Created: / 19-11-2013 / 14:04:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
165 |
! !
|
|
166 |
|
|
167 |
!MakefileTests::TestApplication01 class methodsFor:'startup-to be redefined'!
|
|
168 |
|
|
169 |
main:args
|
|
170 |
args isEmpty ifTrue:[
|
|
171 |
Smalltalk exit: 0.
|
|
172 |
].
|
|
173 |
args size ~~ 1 ifTrue:[
|
|
174 |
Smalltalk exit: 127.
|
|
175 |
].
|
|
176 |
|
|
177 |
[
|
|
178 |
Smalltalk exit: args first asInteger.
|
|
179 |
] on: Error do:[:ex|
|
|
180 |
Smalltalk exit: 126.
|
|
181 |
].
|
|
182 |
|
|
183 |
"Created: / 19-11-2013 / 13:12:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
184 |
! !
|
|
185 |
|
|
186 |
!MakefileTests class methodsFor:'documentation'!
|
|
187 |
|
|
188 |
version
|
|
189 |
^ '$Header$'
|
|
190 |
!
|
|
191 |
|
|
192 |
version_CVS
|
|
193 |
^ '$Header$'
|
|
194 |
! !
|
|
195 |
|