summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Hornsey <fred@hornsey.us>2019-08-20 16:53:34 -0500
committerFred Hornsey <fred@hornsey.us>2019-08-20 16:53:34 -0500
commit5ba5d502c8aa6528c6769c9896926c43020d7a6e (patch)
tree5ff5b78af78be681171a772e03cb6fa0c78649ef
parent95f7d48b61fdc441730b92b0938a6e8fb467fcd0 (diff)
downloadATCD-5ba5d502c8aa6528c6769c9896926c43020d7a6e.tar.gz
Use system() properly in auto_run_tests.pl
-rwxr-xr-xACE/bin/auto_run_tests.pl40
1 files changed, 29 insertions, 11 deletions
diff --git a/ACE/bin/auto_run_tests.pl b/ACE/bin/auto_run_tests.pl
index 4f637f9b95d..3e9b5887677 100755
--- a/ACE/bin/auto_run_tests.pl
+++ b/ACE/bin/auto_run_tests.pl
@@ -31,6 +31,28 @@ if (!defined $DDS_ROOT && -d "$ACE_ROOT/TAO/DDS") {
$DDS_ROOT = "$ACE_ROOT/TAO/DDS";
}
+sub run_command ($$) {
+ my $command = shift;
+ my $print_error = shift;
+ my $result = 0;
+ if (system($command) and $print_error) {
+ my $error_message;
+ $result = $? >> 8;
+ if ($? == -1) {
+ $error_message = "failed to run: $!";
+ }
+ elsif ($? & 127) {
+ $error_message = sprintf("exited on signal %d", ($? & 127));
+ $error_message .= " and created coredump" if ($? & 128);
+ }
+ else {
+ $error_message = sprintf ("returned with status %d", $result);
+ }
+ print "Error: $test $error_message\n";
+ }
+ return $result;
+}
+
################################################################################
if (!getopts ('adl:os:r:tCd') || $opt_h) {
@@ -228,14 +250,14 @@ foreach my $test_lst (@file_list) {
if (! -e $1) {
print STDERR "ERROR: $directory.$1 does not exist\n";
next;
- }
- }
+ }
+ }
else {
if (! -e $program) {
print STDERR "ERROR: $directory.$program does not exist\n";
next;
- }
- }
+ }
+ }
### Generate the -ExeSubDir and -Config options
my $inherited_options = " -ExeSubDir $PerlACE::Process::ExeSubDir ";
@@ -262,16 +284,12 @@ foreach my $test_lst (@file_list) {
}
else {
$start_time = time();
- $result = system ($cmd);
+ $result = run_command($cmd, !$is_ace_test);
$time = time() - $start_time;
# see note about tests/run_test.pl printing reports for ace tests individually
- if (! $is_ace_test) {
- if ($result != 0) {
- print "Error: $test returned with status $result\n";
- }
-
- print "\nauto_run_tests_finished: $test Time:$time"."s Result:$result\n";
+ if (!$is_ace_test) {
+ print "\nauto_run_tests_finished: $test Time: $time"."s Result: $result\n";
print "==============================================================================\n";
}
}