From 5ba5d502c8aa6528c6769c9896926c43020d7a6e Mon Sep 17 00:00:00 2001 From: Fred Hornsey Date: Tue, 20 Aug 2019 16:53:34 -0500 Subject: Use system() properly in auto_run_tests.pl --- ACE/bin/auto_run_tests.pl | 40 +++++++++++++++++++++++++++++----------- 1 file 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"; } } -- cgit v1.2.1 From ba5f278c1a407202299edb2c0900b41c0d624855 Mon Sep 17 00:00:00 2001 From: Fred Hornsey Date: Tue, 20 Aug 2019 17:05:32 -0500 Subject: Fix auto_run_tests.pl for ace tests --- ACE/bin/auto_run_tests.pl | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/ACE/bin/auto_run_tests.pl b/ACE/bin/auto_run_tests.pl index 3e9b5887677..176ff4c34bb 100755 --- a/ACE/bin/auto_run_tests.pl +++ b/ACE/bin/auto_run_tests.pl @@ -35,20 +35,22 @@ sub run_command ($$) { my $command = shift; my $print_error = shift; my $result = 0; - if (system($command) and $print_error) { - my $error_message; + if (system($command)) { $result = $? >> 8; - if ($? == -1) { - $error_message = "failed to run: $!"; + 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"; } - 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; } -- cgit v1.2.1 From 145dbd60969fc394c2c40ae0c44cec49e2740a82 Mon Sep 17 00:00:00 2001 From: Adam Mitz Date: Wed, 28 Aug 2019 11:04:01 -0500 Subject: Revert part of #943, whitespace is significant in the auto_run_tests output, this is parsed by other scripts. --- ACE/bin/auto_run_tests.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ACE/bin/auto_run_tests.pl b/ACE/bin/auto_run_tests.pl index 176ff4c34bb..2de148187de 100755 --- a/ACE/bin/auto_run_tests.pl +++ b/ACE/bin/auto_run_tests.pl @@ -291,7 +291,7 @@ foreach my $test_lst (@file_list) { # see note about tests/run_test.pl printing reports for ace tests individually if (!$is_ace_test) { - print "\nauto_run_tests_finished: $test Time: $time"."s Result: $result\n"; + print "\nauto_run_tests_finished: $test Time:$time"."s Result:$result\n"; print "==============================================================================\n"; } } -- cgit v1.2.1