From 68c056f2f8193c4b0aade4128729fd6eb4c3b5de Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 18 Dec 2020 10:20:31 -0600 Subject: [PATCH] Fix makeTestfile.pl to report test failures properly If a test program reports test failures, the Perl wrapper must return the same error status. On Windows where we use system() instead of exec() that needs some value fiddling. --- src/tools/makeTestfile.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tools/makeTestfile.pl b/src/tools/makeTestfile.pl index be4648258..942b562e1 100644 --- a/src/tools/makeTestfile.pl +++ b/src/tools/makeTestfile.pl @@ -36,8 +36,10 @@ use Cwd 'abs_path'; if (\$^O eq 'MSWin32') { # Use system on Windows, exec doesn't work the same there and - # GNUmake thinks the test has finished as soon as Perl exits. - system('./$exe') == 0 or die "Can't run $exe: \$!\\n"; + # GNUmake thinks the test has finished too soon. + my \$status = system('./$exe'); + die "Can't run $exe: \$!\\n" if \$status == -1; + exit \$status >> 8; } else { exec './$exe' or die "Can't run $exe: \$!\\n";