This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Split APItest/t/handy.t
authorKarl Williamson <khw@cpan.org>
Sun, 19 Feb 2017 05:28:58 +0000 (22:28 -0700)
committerKarl Williamson <khw@cpan.org>
Mon, 20 Feb 2017 06:25:13 +0000 (23:25 -0700)
This is a very long running test.  This commit splits it into smaller
chunks, based on the environment variable TEST_JOBS, up to 10.   Each
chunk executes 1/TEST_JOBS of the total test.  If TEST_JOBS is not set,
it reverts to 1 chunk.  The alternative would be to revert to 10, but
since there is overhead associated with each new chunk, I chose, for
now, 1.

There may be a better solution later on, but I think this is good enough
for now.

12 files changed:
MANIFEST
ext/XS-APItest/t/handy0.t [new file with mode: 0644]
ext/XS-APItest/t/handy1.t [new file with mode: 0644]
ext/XS-APItest/t/handy2.t [new file with mode: 0644]
ext/XS-APItest/t/handy3.t [new file with mode: 0644]
ext/XS-APItest/t/handy4.t [new file with mode: 0644]
ext/XS-APItest/t/handy5.t [new file with mode: 0644]
ext/XS-APItest/t/handy6.t [new file with mode: 0644]
ext/XS-APItest/t/handy7.t [new file with mode: 0644]
ext/XS-APItest/t/handy8.t [new file with mode: 0644]
ext/XS-APItest/t/handy9.t [new file with mode: 0644]
ext/XS-APItest/t/handy_base.pl [moved from ext/XS-APItest/t/handy.t with 97% similarity]

index 3552b60..6ab8b2c 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -4228,7 +4228,17 @@ ext/XS-APItest/t/gv_fetchmeth.t          XS::APItest: tests for gv_fetchmeth() and varia
 ext/XS-APItest/t/gv_fetchmeth_autoload.t       XS::APItest: tests for gv_fetchmeth_autoload() and variants
 ext/XS-APItest/t/gv_fetchmethod_flags.t        XS::APItest: tests for gv_fetchmethod_flags() and variants
 ext/XS-APItest/t/gv_init.t     XS::APItest: tests for gv_init and variants
-ext/XS-APItest/t/handy.t       XS::APItest: tests for handy.h
+ext/XS-APItest/t/handy0.t      XS::APItest: tests for handy.h
+ext/XS-APItest/t/handy1.t      XS::APItest: tests for handy.h
+ext/XS-APItest/t/handy2.t      XS::APItest: tests for handy.h
+ext/XS-APItest/t/handy3.t      XS::APItest: tests for handy.h
+ext/XS-APItest/t/handy4.t      XS::APItest: tests for handy.h
+ext/XS-APItest/t/handy5.t      XS::APItest: tests for handy.h
+ext/XS-APItest/t/handy6.t      XS::APItest: tests for handy.h
+ext/XS-APItest/t/handy7.t      XS::APItest: tests for handy.h
+ext/XS-APItest/t/handy8.t      XS::APItest: tests for handy.h
+ext/XS-APItest/t/handy9.t      XS::APItest: tests for handy.h
+ext/XS-APItest/t/handy_base.pl XS::APItest: tests for handy.h
 ext/XS-APItest/t/hash.t                XS::APItest: tests for hash related APIs
 ext/XS-APItest/t/join_with_space.t     test op_convert_list
 ext/XS-APItest/t/keyword_multiline.t   test keyword plugin parsing across lines
diff --git a/ext/XS-APItest/t/handy0.t b/ext/XS-APItest/t/handy0.t
new file mode 100644 (file)
index 0000000..7c3e4e3
--- /dev/null
@@ -0,0 +1,7 @@
+use strict;
+use warnings;
+no warnings 'once';
+
+$::TEST_CHUNK = 0;
+
+do './t/handy_base.pl';
diff --git a/ext/XS-APItest/t/handy1.t b/ext/XS-APItest/t/handy1.t
new file mode 100644 (file)
index 0000000..2fd8ec1
--- /dev/null
@@ -0,0 +1,7 @@
+use strict;
+use warnings;
+no warnings 'once';
+
+$::TEST_CHUNK = 1;
+
+do './t/handy_base.pl';
diff --git a/ext/XS-APItest/t/handy2.t b/ext/XS-APItest/t/handy2.t
new file mode 100644 (file)
index 0000000..2d4e78d
--- /dev/null
@@ -0,0 +1,7 @@
+use strict;
+use warnings;
+no warnings 'once';
+
+$::TEST_CHUNK = 2;
+
+do './t/handy_base.pl';
diff --git a/ext/XS-APItest/t/handy3.t b/ext/XS-APItest/t/handy3.t
new file mode 100644 (file)
index 0000000..fe07af3
--- /dev/null
@@ -0,0 +1,7 @@
+use strict;
+use warnings;
+no warnings 'once';
+
+$::TEST_CHUNK = 3;
+
+do './t/handy_base.pl';
diff --git a/ext/XS-APItest/t/handy4.t b/ext/XS-APItest/t/handy4.t
new file mode 100644 (file)
index 0000000..08977a1
--- /dev/null
@@ -0,0 +1,7 @@
+use strict;
+use warnings;
+no warnings 'once';
+
+$::TEST_CHUNK = 4;
+
+do './t/handy_base.pl';
diff --git a/ext/XS-APItest/t/handy5.t b/ext/XS-APItest/t/handy5.t
new file mode 100644 (file)
index 0000000..d2bb926
--- /dev/null
@@ -0,0 +1,7 @@
+use strict;
+use warnings;
+no warnings 'once';
+
+$::TEST_CHUNK = 5;
+
+do './t/handy_base.pl';
diff --git a/ext/XS-APItest/t/handy6.t b/ext/XS-APItest/t/handy6.t
new file mode 100644 (file)
index 0000000..44fd1c6
--- /dev/null
@@ -0,0 +1,7 @@
+use strict;
+use warnings;
+no warnings 'once';
+
+$::TEST_CHUNK = 6;
+
+do './t/handy_base.pl';
diff --git a/ext/XS-APItest/t/handy7.t b/ext/XS-APItest/t/handy7.t
new file mode 100644 (file)
index 0000000..c6c2d50
--- /dev/null
@@ -0,0 +1,7 @@
+use strict;
+use warnings;
+no warnings 'once';
+
+$::TEST_CHUNK = 7;
+
+do './t/handy_base.pl';
diff --git a/ext/XS-APItest/t/handy8.t b/ext/XS-APItest/t/handy8.t
new file mode 100644 (file)
index 0000000..7e546d7
--- /dev/null
@@ -0,0 +1,7 @@
+use strict;
+use warnings;
+no warnings 'once';
+
+$::TEST_CHUNK = 8;
+
+do './t/handy_base.pl';
diff --git a/ext/XS-APItest/t/handy9.t b/ext/XS-APItest/t/handy9.t
new file mode 100644 (file)
index 0000000..38d89c0
--- /dev/null
@@ -0,0 +1,7 @@
+use strict;
+use warnings;
+no warnings 'once';
+
+$::TEST_CHUNK = 9;
+
+do './t/handy_base.pl';
similarity index 97%
rename from ext/XS-APItest/t/handy.t
rename to ext/XS-APItest/t/handy_base.pl
index 5ae97cd..676f7df 100644 (file)
@@ -166,7 +166,18 @@ my %utf8_param_code = (
                         "deprecated mathoms"    => -2,
                       );
 
+# This test is split into this number of files.
+my $num_test_files = $ENV{TEST_JOBS} || 1;
+$num_test_files = 10 if $num_test_files > 10;
+
+my $property_count = -1;
 foreach my $name (sort keys %properties, 'octal') {
+
+    # We test every nth property in this run so that this test is split into
+    # smaller chunks to minimize test suite elapsed time when run in parallel.
+    $property_count++;
+    next if $property_count % $num_test_files != $::TEST_CHUNK;
+
     my @invlist;
     if ($name eq 'octal') {
         # Hand-roll an inversion list with 0-7 in it and nothing else.
@@ -389,8 +400,12 @@ my %to_properties = (
                 UPPER => 'Uppercase_Mapping',
             );
 
-
+$property_count = -1;
 foreach my $name (sort keys %to_properties) {
+
+    $property_count++;
+    next if $property_count % $num_test_files != $::TEST_CHUNK;
+
     my $property = $to_properties{$name};
     my ($list_ref, $map_ref, $format, $missing)
                                       = prop_invmap($property, );