summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Mitz <mitza@objectcomputing.com>2019-08-23 14:22:00 -0500
committerGitHub <noreply@github.com>2019-08-23 14:22:00 -0500
commitd1239f84141e33ac6eb308c5405215d373ffe52a (patch)
tree07c06334d8e511abffea44191b8d0d5f77a399c2
parentb34cbdc1fc9b3356e77fb0ef04623f869c79cf4f (diff)
parentba5f278c1a407202299edb2c0900b41c0d624855 (diff)
downloadATCD-d1239f84141e33ac6eb308c5405215d373ffe52a.tar.gz
Merge pull request #943 from iguessthislldo/igtd/misc
Get Correct Program Return Code in auto_run_tests.pl
-rwxr-xr-xACE/bin/auto_run_tests.pl42
1 files changed, 31 insertions, 11 deletions
diff --git a/ACE/bin/auto_run_tests.pl b/ACE/bin/auto_run_tests.pl
index 4f637f9b95d..176ff4c34bb 100755
--- a/ACE/bin/auto_run_tests.pl
+++ b/ACE/bin/auto_run_tests.pl
@@ -31,6 +31,30 @@ 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)) {
+ $result = $? >> 8;
+ if ($print_error) {
+ my $error_message;
+ 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 +252,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 +286,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";
}
}