1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
6 # Executes test list files (*.lst), which contain commands with conditions
7 # called configurations under which the commands are run.
11 use lib
"$ENV{ACE_ROOT}/bin";
12 if (defined $ENV{srcdir
}) {
13 use lib
"$ENV{srcdir}/bin";
15 use PerlACE
::Run_Test
;
20 use Env
qw(ACE_ROOT PATH TAO_ROOT);
22 if (!defined $TAO_ROOT && -d
"$ACE_ROOT/TAO") {
23 $TAO_ROOT = "$ACE_ROOT/TAO";
29 my $print_error = shift;
32 if (system($command)) {
35 my $signal = $?
& 127;
36 my $coredump = $?
& 128;
39 $error_message = "failed to run: $!";
42 $error_message = sprintf("exited on signal %d", ($signal));
43 $error_message .= " and created coredump" if ($coredump);
46 $error_message = sprintf("returned with status %d", $result);
48 print "Error: $test $error_message\n";
57 "auto_run_tests.pl [<options> ...] [<list_file> ...]\n" .
59 "Executes test list files (*.lst), which contain commands with conditions called\n" .
60 "configurations under which the commands are run.\n" .
62 "Test lists files can be specified using the -l option or as non-option\n" .
63 "arguments. The standard test list files for ACE/TAO and related software are\n" .
64 "built-in and can be included via the listed options before. If not test list\n" .
65 "files are specified, the script tries to use all the standard test list files\n" .
66 "that can be found.\n" .
69 " --help | -h Display this help\n" .
71 " --ace | -a Include the ACE tests\n" .
72 " --orb | -o Include the TAO ORB tests\n" .
73 " --tao | -t Include the TAO non-ORB tests\n" .
75 " -l <list_file> Include the tests from <list_file>\n" .
77 " --sandbox | -s <sandbox> Runs each program using a sandbox program\n" .
78 " --root | -r <dir> Root directory for running the tests\n" .
79 " --dry-run | -z Just print the commands that would be ran\n" .
80 " --show-configs Just print possible values for -Config\n" .
82 # These two are processed by PerlACE/ConfigList.pm
83 " -Config <cfg> Include tests with <cfg> configuration\n" .
84 " -Exclude <cfg> Exclude tests with <cfg> configuration\n" .
86 # This one is processed by PerlACE/Process.pm
87 " -ExeSubDir <dir> Subdirectory for finding the executables\n";
90 ################################################################################
95 my $tao_orb_tests = 0;
101 my $show_configs = 0;
102 Getopt
::Long
::Configure
('bundling', 'no_auto_abbrev');
103 my $invalid_arguments = !GetOptions
(
105 'ace|a' => \
$ace_tests,
106 'orb|o' => \
$tao_orb_tests,
107 'tao|t' => \
$tao_tests,
108 'l=s' => \
@l_options,
109 'sandbox|s=s' => \
$sandbox,
110 'dry-run|z' => \
$dry_run,
111 'root|r=s' => \
$startdir,
112 'show-configs' => \
$show_configs,
114 if ($invalid_arguments || $help) {
115 print_help
($invalid_arguments ?
*STDERR
: *STDOUT
);
116 exit($invalid_arguments ?
1 : 0);
119 # Determine what test list files to use
120 my @main_test_lists = (
121 [\
$ace_tests, $ACE_ROOT, "bin/ace_tests.lst", "ACE"],
122 [\
$tao_orb_tests, $TAO_ROOT, "bin/tao_orb_tests.lst", "TAO ORB"],
123 [\
$tao_tests, $TAO_ROOT, "bin/tao_other_tests.lst", "TAO non-ORB"],
127 foreach my $i (@main_test_lists) {
128 my $enabled_ref = $i->[0];
130 my $list_file = $i->[2];
132 my $list_file_path = "$root/$list_file";
133 if (defined $root && $$enabled_ref) {
134 push(@file_list, $list_file_path);
136 elsif ($$enabled_ref) {
137 $list_error = "option for $name tests passed, but the root enviroment variable isn't set";
140 push(@file_list, @l_options);
141 push(@file_list, @ARGV);
142 if (!scalar(@file_list)) {
143 foreach my $i (@main_test_lists) {
145 my $list_file = $i->[2];
146 my $list_file_path = "$root/$list_file";
147 if (defined $root && -f
$list_file_path) {
148 push (@file_list, $list_file_path);
151 if (!scalar(@file_list)) {
152 $list_error = "no default test lists could be found";
156 print STDERR
"ERROR: $list_error\n";
161 foreach my $test_list (@file_list) {
162 my $config_list = new PerlACE
::ConfigList
;
163 $config_list->load($test_list);
164 print "$test_list: " . $config_list->list_configs() . "\n";
169 my $explicit_startdir = 0;
171 $explicit_startdir = 1;
174 $startdir = "$ACE_ROOT";
177 foreach my $test_lst (@file_list) {
179 my $config_list = new PerlACE
::ConfigList
;
180 if (-r
$ACE_ROOT.$test_lst) {
181 $config_list->load($ACE_ROOT.$test_lst);
183 elsif (-r
"$startdir/$test_lst") {
184 $config_list->load("$startdir/$test_lst");
187 $config_list->load($test_lst);
190 # Insures that we search for stuff in the current directory.
191 $PATH .= $Config::Config
{path_sep
} . '.';
193 foreach my $test ($config_list->valid_entries()) {
197 ## Remove intermediate '.' directories to allow the
198 ## scoreboard matrix to read things correctly
201 if ($test =~ /(.*)\/([^\
/]*)$/) {
209 # this is to ensure that we dont print out the time for tests/run_test.pl
210 # that test prints out the times for each of the ace tests individually
211 my $is_ace_test = ($directory eq "tests");
213 if (! $is_ace_test) {
214 print "auto_run_tests: $test\n";
215 if ($config_list->check_config('Coverity')) {
216 $ENV{COVERITY_TEST_NAME
} = $test;
217 $ENV{COVERITY_SUITE_NAME
} = $test_lst;
218 $ENV{COVERITY_TEST_SOURCE
} = "$directory/$program";
222 my($orig_dir) = $directory;
223 if ($directory =~ m
:^TAO
/(.*):) {
227 my @dirlist = ($ACE_ROOT."/$directory",
228 $TAO_ROOT."/$directory");
229 # make sure to *first* check the explicitly specified directory and
230 # only when nothing found there check the default dirs
231 if ($explicit_startdir) {
232 unshift (@dirlist, $startdir."/$directory");
233 unshift (@dirlist, $startdir."/$orig_dir");
235 foreach my $path (@dirlist) {
236 if (-d
$path && ($status = chdir($path))) {
242 if ($explicit_startdir) {
243 print STDERR
"ERROR: Cannot chdir to $startdir/$directory\n";
245 print STDERR
"ERROR: Cannot chdir to $directory\n";
250 if ($program =~ /(.*?) (.*)/) {
252 print STDERR
"ERROR: $directory.$1 does not exist\n";
258 print STDERR
"ERROR: $directory.$program does not exist\n";
263 ### Generate the -ExeSubDir and -Config options
264 my $inherited_options = " -ExeSubDir $PerlACE::Process::ExeSubDir ";
266 foreach my $config ($config_list->my_config_list()) {
267 $inherited_options .= " -Config $config ";
272 #The Win32 sandbox takes the program and options in quotes, but the
273 #posix sandbox takes the program and options as separate args.
274 my($q) = ($^O
eq 'MSWin32') ?
'"' : '';
275 $cmd = "$sandbox ${q}perl $program $inherited_options${q}";
278 $cmd = "perl $program$inherited_options";
283 print "In \"$cwd\" would run:\n $cmd\n";
286 my $start_time = time();
287 my $result = run_command
($test, $cmd, !$is_ace_test);
288 my $time = time() - $start_time;
290 # see note about tests/run_test.pl printing reports for ace tests individually
292 print "\nauto_run_tests_finished: $test Time:$time"."s Result:$result\n";
293 print "==============================================================================\n";