aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2019-12-05 16:55:08 +0100
committerPatrick Spek <p.spek@tyil.nl>2019-12-05 16:55:08 +0100
commitfe8e97975194a47772ecdaef4462cd99d9e5c891 (patch)
tree3b1509e615544c476a871380cdbb756ebccdd1b0
parent00f451632167fff34c94b5b9c81117e16b67d94a (diff)
Update modules-test script
-rw-r--r--tools/build/modules-test.pl49
1 files changed, 37 insertions, 12 deletions
diff --git a/tools/build/modules-test.pl b/tools/build/modules-test.pl
index 396f066..1c8239b 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;
@@ -9,17 +12,39 @@ my $base = shift @ARGV;
my $perl6 = shift @ARGV;
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+)/;
+
+ # Run the tests through prove
+ if (-d "$base/modules/$moduledir/t") {
+ 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 "@cmd\n";
+
+ # 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";
+ }
+
+ print "\n";
}
-0;
+# If we reach this, no errors have been found
+exit 0;