From 2df30e9b1c45d22371f9d7fd3e504e6cbffe5250 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Sun, 8 Dec 2019 15:41:42 +0100 Subject: Make modules-test not exit after first failure --- tools/build/modules-test.pl | 49 +++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/tools/build/modules-test.pl b/tools/build/modules-test.pl index 3d70fcf..c4b9d00 100644 --- a/tools/build/modules-test.pl +++ b/tools/build/modules-test.pl @@ -10,6 +10,7 @@ GetOptions('verbose' => \my $verbose); my $base = shift @ARGV; my $perl6 = shift @ARGV; +my @failures; while (<>) { # Skip comments @@ -18,33 +19,43 @@ while (<>) { # Extract only the module name from the current line my ($moduledir) = /(\S+)/; + if (! -d "$base/modules/$moduledir/t") { + print "[" . getcwd . "] ...no t/ directory found.\n"; + next; + } + # Run the tests through prove - if (-d "$base/modules/$moduledir/t") { - chdir("$base/modules/$moduledir"); + chdir("$base/modules/$moduledir"); - my @cmd = ( - 'prove', - $verbose ? '-v' : (), - '-e', $perl6, - '-r', - 't', - ); + my @cmd = ( + 'prove', + $verbose ? '-v' : (), + '-e', $perl6, + '-r', + 't', + ); - # Show the command that's going to be ran, for debugging purposes - print "[" . getcwd . "] @cmd\n"; + # Show the command that's going to be ran, for debugging purposes + print "[" . getcwd . "] @cmd\n"; - # Actually run the command - my $exit = system "@cmd"; + # Actually run the command + my $exit = system "@cmd"; - # Exit early if any errors occurred - exit 1 if $exit; - } - else { - print "...no t/ directory found.\n"; + # Exit early if any errors occurred + if ($exit) { + push @failures, $_; } print "\n"; } # If we reach this, no errors have been found -exit 0; +if (@failures) { + print "The following modules failed their tests:\n"; + + foreach (@failures) { + print "- $_\n"; + } + + exit 1; +} -- cgit v1.1