1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
|
# -*- perl -*-
# $Id$
#
# This script checkouts ACE from CVS, updates the "clone" directory,
# compiles $ACE_ROOT/ace and $ACE_ROOT/tests and finally runs
# $ACE_ROOT/tests/run_tests.sh.
#
# If it detects any problem it send email.
#
# DO NOT invoke this script from your crontab, use
# auto_compile_wrapper for that.
#
# This script requires Perl5.
#
# TODO: Modify the script or split it in such a way that the main copy
# can be obtained either using cvs or downloading the lastest beta
# from the WWW.
#
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
# The first three lines above let this script run without specifying the
# full path to perl, as long as it is in the user's PATH.
# Taken from perlrun man page.
use File::Basename;
use FileHandle;
require POSIX;
# This is the module we will checkout, someday someone could define a
# smaller module.
$MODULE='ACE_wrappers';
# This are the sub-directories (in the module) we really compile.
@BUILD_LIST=
('ace',
'netsvcs',
'tests',
'apps/gperf',
'websvcs',
# 'TAO/tao',
# 'TAO/TAO_IDL',
# 'TAO/orbsvcs',
# 'TAO/tests',
# 'TAO/examples/POA',
# 'TAO/performance-tests');
'TAO');
# This are the pairs "sub-directory , script" we run; the separator
# *must* be a space followed by a comma and then another space.
@RUN_LIST =
( 'tests , run_tests.sh',
'TAO/tests/Param_Test , run_test.pl',
'TAO/tests/Param_Test , run_test.pl -i dii',
'TAO/performance-tests/Cubit/TAO/IDL_Cubit , run_test.pl',
'TAO/tests/OctetSeq , run_test.pl',
'TAO/tests/Multiple_Inheritance , run_test.pl',
'TAO/tests/MT_Client , run_test.pl',
'TAO/tests/MT_Server , run_test.pl',
'TAO/tests/Faults , run_test.pl',
'TAO/tests/NestedUpcall/Simple , run_test.pl',
'TAO/tests/NestedUpcall/MT_Client_Test , run_test.pl',
'TAO/tests/NestedUpcall/Triangle_Test , run_test.pl',
'TAO/tests/POA/Identity , run_test.pl',
'TAO/tests/POA/Deactivation , run_test.pl',
'TAO/tests/POA/Destruction , run_test.pl',
'TAO/tests/IORManipulation , run_test.pl',
'TAO/tests/Timeout , run_test.pl',
'TAO/examples/POA/Adapter_Activator , run_test.pl',
'TAO/examples/POA/DSI , run_test.pl',
'TAO/examples/POA/Default_Servant , run_test.pl',
'TAO/examples/POA/Explicit_Activation , run_test.pl',
'TAO/examples/POA/FindPOA , run_test.pl',
'TAO/examples/POA/Forwarding , run_test.pl',
'TAO/examples/POA/NewPOA , run_test.pl',
'TAO/examples/POA/On_Demand_Activation , run_test.pl',
'TAO/examples/POA/On_Demand_Loading , run_test.pl',
'TAO/examples/POA/Reference_Counted_Servant , run_test.pl',
'TAO/examples/POA/Loader , run_test.pl',
'TAO/examples/POA/RootPOA , run_test.pl',
'TAO/examples/POA/Adapter_Activator , run_test.pl',
'TAO/examples/Simple/bank , run_test.pl',
'TAO/examples/Simple/grid , run_test.pl',
'TAO/examples/Simple/time-date , run_test.pl',
'TAO/examples/Simple/time , run_test.pl',
'TAO/orbsvcs/tests/Simple_Naming , run_test.pl',
'TAO/orbsvcs/tests/Trading , run_test.pl',
'TAO/orbsvcs/tests/Event/Basic , run_test.pl',
'TAO/orbsvcs/tests/Event/Performance , run_test.pl',
'TAO/orbsvcs/tests/EC_Basic , run_test.pl',
'TAO/orbsvcs/tests/EC_Custom_Marshal , run_test.pl',
'TAO/orbsvcs/tests/EC_Throughput , run_test.pl',
# 'TAO/orbsvcs/tests/EC_Mcast , run_test.pl',
# 'TAO/orbsvcs/tests/EC_Multiple , run_test.pl',
'TAO/orbsvcs/tests/Event_Latency , run_test.pl',
'TAO/examples/Simple/echo , run_test.pl < Echo.idl',
# 'TAO/examples/Simple/chat , run_test.pl',
'TAO/orbsvcs/tests/Property , run_test.pl',
'TAO/performance-tests/POA/Object_Creation_And_Registration , run_test.pl',
'TAO/performance-tests/Cubit/TAO/MT_Cubit , run_test.pl -n 100'
# 'TAO/orbsvcs/tests/ImplRepo , run_test.pl airplane',
# 'TAO/orbsvcs/tests/ImplRepo , run_test.pl airplane_ir',
);
# We obtain our revision to report errors.
$REVISION='$Revision$ ';
# Find out the command name.
$CMD = basename($0);
# Extract configuration information from command line.
# TODO: Some validation and checking should be done here.
$CHECKOUT = $ARGV[0];
$BUILD = $ARGV[1];
$LOGDIR = $ARGV[2];
$ADMIN = $ARGV[3];
$MAKEFLAGS = $ARGV[4];
# When an error is found we try to die gracefully and send some email
# to ADMIN.
$disable_file = $LOGDIR . '/.disable';
sub mywarn {
local @msg = @_;
open(MAIL, "|mail $ADMIN")
|| die "cannot open email pipe on error: $msg\n";
print MAIL 'The following message is brought to you by: ', "\n";
print MAIL $CMD, ' [', $REVISION, "] for $BUILD on $CHECKOUT\n";
print MAIL "\n";
local $m;
foreach $m (@msg) {
print MAIL $m, "\n";
}
print MAIL "\nPlease check log files for more info\n";
close(MAIL)
|| die "cannot close email pipe on error: $msg\n";
}
sub mydie {
mywarn @_;
print HIST 'FAILED', "\n";
unlink $disable_file
|| die "cannot unlink disable file";
exit 0;
}
### MAIN FUNCTION
$histfile = $LOGDIR . '/history';
open(HIST, '>>' . $histfile)
# Do not use 'mydie' to report the problem, it tries to use HIST....
|| die "cannot open history file \"$histfile\"\n";
$date = localtime;
print HIST $CMD, ': running at ', $date, ' ';
if (-f $disable_file) {
print HIST "DISABLED\n";
exit 0;
}
open (DISABLE, '>' . $disable_file)
|| mydie "cannot open disable file";
print DISABLE "auto_compile <$date> is running\n";
close (DISABLE)
|| mydie "cannot close disable file";
$LOGFILE = $LOGDIR . '/' . POSIX::strftime("%b%d_%Y.log", localtime);
open(LOG, '>' . $LOGFILE)
|| mydie "cannot open log file";
LOG->autoflush ();
# The following lines are useful when debugging the script or wrapper.
# print LOG $CHECKOUT, " ", $BUILD, " ", $LOGDIR, " ", $ADMIN, "\n";
#while (($key,$value) = each %ENV) {
# print LOG $key, " = ", $value, "\n";
#}
chdir($CHECKOUT)
|| mydie "Cannot chdir to $CHECKOUT";
$date = localtime;
print LOG "$CMD: starting checkout at ", $date, "\n";
open(CVS, "cvs checkout -P $MODULE 2>&1 |")
|| mydie "cannot start checkout of $MODULE";
$conflicts = 0;
while (<CVS>) {
if (m/^C /) {
$conflicts = 1;
}
print LOG $_;
}
close(CVS)
|| mydie "error while checking out $MODULE";
$date = localtime;
print LOG "$CMD: checkout finished at ", $date, "\n";
if ($conflicts != 0) {
mydie "conflicts on checkout";
}
chdir($MODULE)
|| mydie "cannot chdir to $MODULE";
$date = localtime;
print LOG "$CMD: starting clone at ", $date, "\n";
open(MAKE, "bin/create_ace_build -a -v $BUILD 2>&1 |")
|| mydie "cannot clone directory";
while(<MAKE>) {
print LOG $_;
}
close(MAKE)
|| mydie "error while cloning ACE_ROOT";
$date = localtime;
print LOG "$CMD: clone finished at ", $date, "\n";
chdir('build/' . $BUILD)
|| mydie "cannot chdir to $BUILD";
# This is needed for real make run....
$ENV{'ACE_ROOT'} = $CHECKOUT . '/' . $MODULE . '/build/' . $BUILD;
$ENV{'TAO_ROOT'} = $CHECKOUT . '/' . $MODULE . '/build/' . $BUILD . '/TAO';
@failures = ();
$MAKEFLAGS .= "";
foreach $i (@BUILD_LIST) {
$date = localtime;
print LOG "$CMD: =============================================\n";
print LOG "$CMD: make for $i started at ", $date, "\n";
open(MAKE, "make -k $MAKEFLAGS -C $i 2>&1 |")
|| mydie "cannot start make for $i";
local $current_dir = $i;
local $last_error = "";
while (<MAKE>) {
print LOG $_;
chop;
if (m/^make(\[[0-9]+\])?: Entering directory /) {
s/^make(\[[0-9]+\])?: Entering directory //;
s%^$ENV{'ACE_ROOT'}/%%;
$current_dir = $_;
}
if (m/^make(\[[0-9]+\])?: \*\*\*/) {
if ($last_error ne $current_dir) {
push @failures, "Error while compiling in $current_dir \n";
$last_error = $current_dir;
}
}
if (m/Warning:/ || m/warning:/) {
if ($last_error ne $current_dir) {
push @failures, "Warning while compiling in $current_dir\n";
$last_error = $current_dir;
}
}
}
if (close(MAKE) == 0) {
push @failures, "errors while running make in $i";
}
$date = localtime;
print LOG "$CMD: make for $i finished at ", $date, "\n";
print LOG "$CMD: =============================================\n\n";
}
foreach $i (@RUN_LIST) {
local @test_info = split (/\ \,\ /, $i);
local $directory = $test_info[0];
local $program = $test_info[1];
$date = localtime;
print LOG "$CMD: =============================================\n";
print LOG "$CMD: running $program in $directory at ", $date, "\n";
local $subdir =
$CHECKOUT .'/'. $MODULE .'/build/'. $BUILD .'/'. $directory;
chdir ($subdir)
|| mydie "cannot chdir to $subdir";
$run_error = 0;
if (open(RUN, "$program 2>&1 |") == 0) {
push @failures, "cannot run $program in $directory";
next;
}
while (<RUN>) {
print LOG $_;
if (m/Error/ || m/FAILED/ || m/EXCEPTION/) {
$run_error = 1;
}
}
if (close(RUN) == 0) {
push @failures, "Error when closing pipe for $program in $directory";
next;
}
$date = localtime;
print LOG "$CMD: $program finished ", $date, "\n";
if ($run_error != 0) {
push @failures,
"errors detected while running $program in $directory";
}
}
if ($#failures >= 0) {
mydie @failures;
}
close(LOG)
|| mydie "cannot close LOGFILE";
print HIST "OK\n";
close(HIST)
|| mydie "cannot close history file";
unlink $disable_file
|| mydie "cannot unlink disable file";
exit 0;
|