diff options
author | Naoum Hankache <naoum88@gmail.com> | 2020-02-26 20:14:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-26 20:14:39 +0300 |
commit | a6253c2b109538031b7c9b52cbd56adb266c4746 (patch) | |
tree | 1b349ba24e7732118d884b4122ef741f091e2704 /tools/build/modules-test.pl | |
parent | 139ba6333a8b7497b5349a6ed9fde963ea7a90e7 (diff) | |
parent | 34714c9ec604da31fc87a98f1f7f165ea50214d1 (diff) |
Merge pull request #144 from Tyil/master
Get Rakudo Star working for 2019.07.1
Diffstat (limited to 'tools/build/modules-test.pl')
-rw-r--r-- | tools/build/modules-test.pl | 60 |
1 files changed, 48 insertions, 12 deletions
diff --git a/tools/build/modules-test.pl b/tools/build/modules-test.pl index 396f066..c4b9d00 100644 --- a/tools/build/modules-test.pl +++ b/tools/build/modules-test.pl @@ -1,5 +1,8 @@ #! perl +use warnings; +use strict; + use Cwd; use Getopt::Long; @@ -7,19 +10,52 @@ GetOptions('verbose' => \my $verbose); my $base = shift @ARGV; my $perl6 = shift @ARGV; +my @failures; while (<>) { - next if /^\s*(#|$)/; - my ($moduledir) = /(\S+)/; - print "Testing modules/$moduledir with $perl6...\n"; - if (-d "$base/modules/$moduledir/t") { - chdir("$base/modules/$moduledir"); - system('prove', $verbose ? '-v' : (), '-e', $perl6, '-r', 't'); - } - else { - print "...no t/ directory found.\n"; - } - print "\n"; + # Skip comments + next if /^\s*(#|$)/; + + # 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 + chdir("$base/modules/$moduledir"); + + 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"; + + # Actually run the command + my $exit = system "@cmd"; + + # Exit early if any errors occurred + if ($exit) { + push @failures, $_; + } + + print "\n"; } -0; +# If we reach this, no errors have been found +if (@failures) { + print "The following modules failed their tests:\n"; + + foreach (@failures) { + print "- $_\n"; + } + + exit 1; +} |