author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sat, 29 Jun 2013 23:34:55 +0200 | |
changeset 188 | 6eeac31d0432 |
parent 184 | 5f75ffc9642b |
child 189 | bd2bed33aba7 |
permissions | -rw-r--r-- |
72 | 1 |
"{ Package: 'stx:goodies/builder/reports' }" |
2 |
||
3 |
"{ NameSpace: Builder }" |
|
4 |
||
5 |
StandaloneStartup subclass:#ReportRunner |
|
6 |
instanceVariableNames:'' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
9 |
category:'Builder-Reports' |
|
10 |
! |
|
11 |
||
147
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
12 |
ReportRunner class instanceVariableNames:'parser report debugging setup teardown' |
72 | 13 |
|
14 |
" |
|
15 |
The following class instance variables are inherited by this class: |
|
16 |
||
17 |
StandaloneStartup - MutexHandle |
|
188 | 18 |
Object - |
72 | 19 |
" |
20 |
! |
|
21 |
||
22 |
||
23 |
!ReportRunner class methodsFor:'initialization'! |
|
24 |
||
25 |
initialize |
|
26 |
||
27 |
super initialize. |
|
28 |
debugging := Transcript notNil and:[Transcript isView]. |
|
184
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
29 |
self setupSignalHandlers. |
72 | 30 |
|
31 |
"Created: / 06-11-2011 / 22:07:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
184
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
32 |
"Modified: / 28-06-2013 / 01:13:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
72 | 33 |
! ! |
34 |
||
35 |
!ReportRunner class methodsFor:'command line options'! |
|
36 |
||
37 |
cmdlineOptionOutputDirectory |
|
38 |
||
39 |
^CmdLineOption new |
|
40 |
short: $D; |
|
41 |
long: 'output-directory'; |
|
42 |
description: 'Default report output directory'; |
|
188 | 43 |
action:[:outputdir | |
72 | 44 |
Report outputDir: outputdir. |
45 |
self verboseInfo:'Report dir: ' , Report outputDir asString. |
|
46 |
] |
|
47 |
||
48 |
"Created: / 06-11-2011 / 09:33:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
49 |
! |
|
50 |
||
51 |
cmdlineOptionReport |
|
52 |
||
53 |
^CmdLineOption new |
|
54 |
short: $r; |
|
97
c6a5d1c4df41
changed: #cmdlineOptionReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
92
diff
changeset
|
55 |
long: 'report'; |
72 | 56 |
description: 'Report to run'; |
57 |
action:[:option | |
|
58 |
report := Smalltalk at: option asSymbol. |
|
59 |
report isNil ifTrue:[ |
|
188 | 60 |
Stderr nextPutLine:('ERROR: Report class %1 does not exist (forgot to load package?)' bindWith: option). |
61 |
"/Smalltalk exit: 1. |
|
72 | 62 |
]. |
63 |
report := report new. |
|
64 |
parser options addAll: (CmdLineOption optionsFor: report) |
|
65 |
] |
|
66 |
||
67 |
"Created: / 06-11-2011 / 09:45:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
97
c6a5d1c4df41
changed: #cmdlineOptionReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
92
diff
changeset
|
68 |
"Modified: / 31-10-2012 / 12:40:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
147
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
69 |
! |
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
70 |
|
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
71 |
cmdlineOptionSetup |
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
72 |
|
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
73 |
^CmdLineOption new |
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
74 |
short: $s; |
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
75 |
long: 'setup'; |
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
76 |
description: 'Code executed before tests are loaded and executed'; |
188 | 77 |
action:[:option | |
147
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
78 |
setup := option |
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
79 |
] |
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
80 |
|
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
81 |
"Created: / 15-05-2013 / 16:50:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
82 |
! |
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
83 |
|
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
84 |
cmdlineOptionTeardown |
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
85 |
|
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
86 |
^CmdLineOption new |
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
87 |
short: $t; |
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
88 |
long: 'setup'; |
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
89 |
description: 'Code executed after all tests are executed'; |
188 | 90 |
action:[:option | |
147
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
91 |
teardown := option |
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
92 |
] |
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
93 |
|
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
94 |
"Created: / 15-05-2013 / 16:50:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
72 | 95 |
! ! |
96 |
||
184
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
97 |
!ReportRunner class methodsFor:'debugging'! |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
98 |
|
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
99 |
dumpProcess: aProcess |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
100 |
Stderr cr; cr |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
101 |
|
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
102 |
"Created: / 27-06-2013 / 23:41:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
103 |
! |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
104 |
|
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
105 |
dumpProcess: aProcess on: aStream |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
106 |
| ctx | |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
107 |
aStream cr; cr. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
108 |
aStream nextPutAll: '== ['; nextPutAll: aProcess id printString; nextPutAll:'] '; nextPutAll: aProcess name; nextPutAll: ' =='; cr. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
109 |
aStream cr. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
110 |
|
188 | 111 |
aProcess == Processor activeProcess ifTrue:[ctx := thisContext] ifFalse:[ctx := aProcess suspendedContext]. |
184
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
112 |
[ ctx notNil ] whileTrue:[ |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
113 |
aStream nextPutAll: ' '. |
188 | 114 |
ctx fullPrintOn: aStream. |
184
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
115 |
aStream cr. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
116 |
ctx := ctx sender. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
117 |
]. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
118 |
aStream cr. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
119 |
|
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
120 |
" |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
121 |
self dumpProcess: Processor activeProcess on: Transcript. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
122 |
" |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
123 |
|
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
124 |
"Created: / 28-06-2013 / 01:00:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
125 |
! |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
126 |
|
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
127 |
dumpProcesses |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
128 |
self dumpProcessesOn: Stderr |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
129 |
|
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
130 |
" |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
131 |
self dumpProcessesOn: Transcript. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
132 |
" |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
133 |
|
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
134 |
"Created: / 27-06-2013 / 23:41:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
135 |
"Modified (comment): / 28-06-2013 / 01:06:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
136 |
! |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
137 |
|
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
138 |
dumpProcessesOn: aStream |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
139 |
Process allInstancesDo:[:process| |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
140 |
process isDead ifFalse:[ |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
141 |
self dumpProcess: process on: aStream |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
142 |
] |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
143 |
] |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
144 |
|
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
145 |
"Created: / 27-06-2013 / 23:42:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
146 |
! ! |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
147 |
|
72 | 148 |
!ReportRunner class methodsFor:'defaults'! |
149 |
||
77 | 150 |
allowCoverageMeasurementOption |
151 |
||
152 |
^false "CoverageReport will do that" |
|
153 |
||
154 |
"Created: / 13-01-2012 / 11:48:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
155 |
! |
|
156 |
||
72 | 157 |
allowDebugOption |
158 |
||
159 |
^true |
|
160 |
||
161 |
"Created: / 21-07-2011 / 09:48:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
162 |
! ! |
|
163 |
||
164 |
!ReportRunner class methodsFor:'multiple applications support'! |
|
165 |
||
166 |
applicationRegistryPath |
|
167 |
"the key under which this application stores its process ID in the registry |
|
168 |
as a collection of path-components. |
|
169 |
i.e. if #('foo' 'bar' 'baz') is returned here, the current applications ID will be stored |
|
170 |
in HKEY_CURRENT_USER\Software\foo\bar\baz\CurrentID. |
|
171 |
(would also be used as a relative path for a temporary lock file under unix). |
|
172 |
Used to detect if another instance of this application is already running." |
|
173 |
||
174 |
^ #('exept' 'smalltallx' 'hdreportrunner') |
|
175 |
||
176 |
"Modified: / 21-07-2011 / 09:43:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
177 |
! |
|
178 |
||
179 |
applicationUUID |
|
180 |
"answer an application-specific unique uuid. |
|
181 |
This is used as the name of some exclusive OS-resource, which is used to find out, |
|
182 |
if another instance of this application is already running. |
|
183 |
Under win32, a mutex is used; under unix, an exclusive file in the tempDir could be used." |
|
184 |
||
185 |
^ '99f65c80-b375-11e0-86ad-0013e89c0459' asUUID |
|
186 |
||
187 |
"Modified: / 21-07-2011 / 09:44:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
188 |
! ! |
|
189 |
||
190 |
!ReportRunner class methodsFor:'startup'! |
|
191 |
||
184
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
192 |
handleSIGTERM |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
193 |
self dumpProcesses. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
194 |
debugging ifFalse:[ |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
195 |
Smalltalk exit:127. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
196 |
]. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
197 |
|
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
198 |
"Created: / 27-06-2013 / 23:10:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
199 |
"Modified: / 28-06-2013 / 01:08:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
200 |
! |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
201 |
|
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
202 |
handleSIGUSR2 |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
203 |
self dumpProcesses |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
204 |
|
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
205 |
"Created: / 27-06-2013 / 23:10:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
206 |
! |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
207 |
|
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
208 |
setupSignalHandlers |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
209 |
"On UNIX, this sets up a custom signal handler on SIGUSR2 and SIGTERM that |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
210 |
dumps stacks on all threads" |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
211 |
|
188 | 212 |
| sigusr2 sigterm | |
213 |
||
184
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
214 |
OperatingSystem isUNIXlike ifTrue:[ |
188 | 215 |
|
184
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
216 |
|
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
217 |
sigterm := Signal new. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
218 |
sigterm handlerBlock: [:ex | self handleSIGTERM]. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
219 |
OperatingSystem operatingSystemSignal:OperatingSystem sigTERM install: sigterm. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
220 |
OperatingSystem enableSignal: OperatingSystem sigTERM. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
221 |
|
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
222 |
sigusr2 := Signal new. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
223 |
sigusr2 handlerBlock: [:ex | self handleSIGUSR2]. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
224 |
OperatingSystem operatingSystemSignal:OperatingSystem sigUSR2 install: sigusr2. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
225 |
OperatingSystem enableSignal: OperatingSystem sigUSR2. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
226 |
]. |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
227 |
|
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
228 |
" |
188 | 229 |
OperatingSystem sendSignal: OperatingSystem sigUSR2 to: OperatingSystem getProcessId |
184
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
230 |
" |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
231 |
|
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
232 |
"Created: / 27-06-2013 / 20:57:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
233 |
"Modified: / 28-06-2013 / 01:11:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
234 |
! |
5f75ffc9642b
Install signal handlers for SIGUSR2 and SIGTERM that dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
147
diff
changeset
|
235 |
|
72 | 236 |
setupToolsForDebug |
237 |
||
238 |
super setupToolsForDebug. |
|
239 |
debugging := true. |
|
240 |
||
241 |
"Created: / 06-11-2011 / 22:06:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
77 | 242 |
! |
243 |
||
244 |
usage |
|
245 |
||
246 |
Stderr nextPutAll:'usage: report-runner.'; |
|
247 |
nextPutAll: (OperatingSystem isMSWINDOWSlike ifTrue:['bat'] ifFalse:['sh']); |
|
248 |
nextPutAll: ' [-D <dir>] -r <report> [-p <package1> [-p <package2> [...]]]'; cr. |
|
249 |
||
250 |
Stderr nextPutLine:' --help .................. output this message'. |
|
251 |
Stderr nextPutLine:' --verbose ............... verbose startup'. |
|
252 |
Stderr nextPutLine:' --noBanner .............. no splash screen'. |
|
253 |
Stderr nextPutLine:' --newAppInstance ........ start as its own application process (do not reuse a running instance)'. |
|
254 |
self allowScriptingOption ifTrue:[ |
|
255 |
Stderr nextPutLine:' --scripting portNr ...... enable scripting via port (or stdin/stdOut, if 0)'. |
|
256 |
]. |
|
257 |
self allowDebugOption ifTrue:[ |
|
258 |
Stderr nextPutLine:' --debug ................. enable Debugger'. |
|
259 |
]. |
|
260 |
||
261 |
"/ ' ......................... ' |
|
262 |
Stderr nextPutLine:' -D <dir>'. |
|
263 |
Stderr nextPutLine:' --output-directory=<dir> directory where report files will go'. |
|
264 |
Stderr nextPutLine:' -r <report class>'. |
|
265 |
Stderr nextPutLine:' --report=<report class> . report to run. available reports:'. |
|
266 |
Report available do:[:report| |
|
267 |
Stderr nextPutAll:' '; nextPutLine: report name |
|
268 |
]. |
|
269 |
Stderr nextPutLine:' -p <package>'. |
|
270 |
Stderr nextPutLine:' --package=<package> ..... package to run report on'. |
|
271 |
Stderr nextPutLine:' May be specified multiple times.'. |
|
272 |
||
273 |
" |
|
274 |
self usage |
|
275 |
" |
|
276 |
||
277 |
"Created: / 13-01-2012 / 11:48:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
72 | 278 |
! ! |
279 |
||
280 |
!ReportRunner class methodsFor:'startup-to be redefined'! |
|
281 |
||
102
a63aa44303e3
changed: #main: - support for not-officially-supported VM options
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
97
diff
changeset
|
282 |
main:argv |
143 | 283 |
"Process command line arguments" |
102
a63aa44303e3
changed: #main: - support for not-officially-supported VM options
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
97
diff
changeset
|
284 |
|
72 | 285 |
parser := CmdLineParser new. |
144 | 286 |
CmdLineOptionError autoload. |
287 |
||
188 | 288 |
[ |
289 |
parser parse: argv for: self. |
|
143 | 290 |
] on:CmdLineOptionError do:[:ex| |
72 | 291 |
Stderr nextPutLine:'Error when processing options: ', ex description. |
188 | 292 |
debugging ifFalse:[ |
92 | 293 |
ex suspendedContext fullPrintAllOn: Stderr. |
72 | 294 |
Stderr nextPutLine:'Exiting'. |
295 |
Smalltalk exit:1. |
|
296 |
] ifTrue:[ |
|
297 |
ex pass |
|
188 | 298 |
] |
72 | 299 |
]. |
300 |
||
301 |
[ |
|
147
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
302 |
setup notNil ifTrue:[Compiler evaluate: setup]. |
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
303 |
[ |
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
304 |
report run. |
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
305 |
] ensure:[ |
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
306 |
teardown notNil ifTrue:[Compiler evaluate: teardown]. |
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
307 |
]. |
72 | 308 |
debugging ifFalse:[ |
309 |
Smalltalk exit:0. |
|
310 |
]. |
|
311 |
] on: Error do:[:ex| |
|
312 |
Stderr nextPutAll:'Error when running tests: '. |
|
313 |
Stderr nextPutAll:ex description; cr. |
|
314 |
ex suspendedContext printAllOn:Stderr. |
|
147
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
315 |
|
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
316 |
|
72 | 317 |
debugging ifFalse:[ |
318 |
Smalltalk exit:1. |
|
319 |
] ifTrue:[ |
|
320 |
ex pass |
|
321 |
] |
|
322 |
] |
|
323 |
||
147
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
324 |
"Modified: / 15-05-2013 / 16:52:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
72 | 325 |
! ! |
326 |
||
327 |
!ReportRunner class methodsFor:'documentation'! |
|
328 |
||
329 |
version |
|
330 |
^ '$Header$' |
|
331 |
! |
|
332 |
||
333 |
version_CVS |
|
334 |
^ '$Header$' |
|
335 |
! |
|
336 |
||
337 |
version_SVN |
|
147
9f2935d68582
class: Builder::ReportRunner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
338 |
^ '$Id$' |
72 | 339 |
! ! |
340 |
||
143 | 341 |
|
72 | 342 |
ReportRunner initialize! |