In perl.git, the branch blead has been updated <https://perl5.git.perl.org/perl.git/commitdiff/55e8b15f00b722623914897598815cc9f4a7c34f?hp=33951b79329d4486fe6ad260a4842e69dfa98462>
- Log ----------------------------------------------------------------- commit 55e8b15f00b722623914897598815cc9f4a7c34f Author: Karl Williamson <[email protected]> Date: Mon Jan 28 02:28:25 2019 -0700 Split t/re/fold_grind.t into multiple test files This has been a goal for a long time, but I thought it would be a lot of work, but now have realized that there was a fairly easy simplistic approach. The core file is renamed fold_grind.pl. It formerly had an outer loop which iterated over the possible character set regex pattern modifiers, /a, /l, etc that were tested. Now that loop is just a block and new wrapper files have been created, one per modifier. They just pass a global to the core file that gives which modifier this test file is to use. Hence each file corresponds to one iteration of the old outer loop, splitting the tests up into 6 smaller tests that can run in parallel. ----------------------------------------------------------------------- Summary of changes: MANIFEST | 8 ++++++- t/re/{fold_grind.t => fold_grind.pl} | 45 ++++++++---------------------------- t/re/fold_grind_8.t | 36 +++++++++++++++++++++++++++++ t/re/fold_grind_a.t | 24 +++++++++++++++++++ t/re/fold_grind_aa.t | 20 ++++++++++++++++ t/re/fold_grind_d.t | 24 +++++++++++++++++++ t/re/fold_grind_l.t | 41 ++++++++++++++++++++++++++++++++ t/re/fold_grind_u.t | 24 +++++++++++++++++++ 8 files changed, 185 insertions(+), 37 deletions(-) rename t/re/{fold_grind.t => fold_grind.pl} (96%) create mode 100644 t/re/fold_grind_8.t create mode 100644 t/re/fold_grind_a.t create mode 100644 t/re/fold_grind_aa.t create mode 100644 t/re/fold_grind_d.t create mode 100644 t/re/fold_grind_l.t create mode 100644 t/re/fold_grind_u.t diff --git a/MANIFEST b/MANIFEST index e282452028..ec6ee36963 100644 --- a/MANIFEST +++ b/MANIFEST @@ -5863,7 +5863,13 @@ t/porting/utils.t Check that utility scripts still compile t/re/alpha_assertions.t See if things like '(*postive_lookahed:...) work properly t/re/anyof.t See if bracketed char classes [...] compile properly t/re/charset.t See if regex modifiers like /d, /u work properly -t/re/fold_grind.t See if case folding works properly +t/re/fold_grind.pl Core file to see if regex case folding works properly +t/re/fold_grind_8.t Wrapper for fold_grind.pl for /l testing with a UTF-8 locale +t/re/fold_grind_a.t Wrapper for fold_grind.pl for /a testing +t/re/fold_grind_aa.t Wrapper for fold_grind.pl for /aa testing +t/re/fold_grind_d.t Wrapper for fold_grind.pl for /d testing +t/re/fold_grind_l.t Wrapper for fold_grind.pl for /l testing with a C locale +t/re/fold_grind_u.t Wrapper for fold_grind.pl for /u testing t/re/keep_tabs.t Tests where \t can't be expanded. t/re/no_utf8_pm.t Verify utf8.pm doesn't get loaded unless required t/re/overload.t Test against string corruption in pattern matches on overloaded objects diff --git a/t/re/fold_grind.t b/t/re/fold_grind.pl similarity index 96% rename from t/re/fold_grind.t rename to t/re/fold_grind.pl index 0665517d61..4082bf7e32 100644 --- a/t/re/fold_grind.t +++ b/t/re/fold_grind.pl @@ -1,4 +1,8 @@ # Grind out a lot of combinatoric tests for folding. +# It uses various charset modifiers, passed in via $::TEST_CHUNK. The caller +# will also have set the locale to use if /l is the modifier. +# L is a pseudo-modifier that indicates to use the modifier /l instead, and +# the locale set by the caller is known to be UTF-8, binmode STDOUT, ":utf8"; @@ -28,6 +32,8 @@ no warnings 'locale'; # Plenty of these would otherwise get generated use Encode; use POSIX; +my $charset = $::TEST_CHUNK; + # Special-cased characters in the .c's that we want to make sure get tested. my %be_sure_to_test = ( chr utf8::unicode_to_native(0xDF) => 1, # LATIN_SMALL_LETTER_SHARP_S @@ -426,33 +432,6 @@ sub pairs (@) { map { prefix $_[$_], @_[0..$_-1, $_+1..$#_] } 0..$#_ } -my $utf8_locale; - -my @charsets = qw(d u a aa); -if (locales_enabled('LC_CTYPE')) { - my $current_locale = POSIX::setlocale( &POSIX::LC_CTYPE, "C") // ""; - if ($current_locale eq 'C') { - use locale; - - # Some implementations don't have the 128-255 range characters all - # mean nothing under the C locale (an example being VMS). This is - # legal, but since we don't know what the right answers should be, - # skip the locale tests in that situation. - for my $i (128 .. 255) { - my $char = chr(utf8::unicode_to_native($i)); - goto skip_C_locale_tests if uc($char) ne $char || lc($char) ne $char; - } - push @charsets, 'l'; - - skip_C_locale_tests: - - # Look for utf8 locale. We use the pseudo-modifier 'L' to indicate - # that we really want /l, but change to a UTF-8 locale. - $utf8_locale = find_utf8_ctype_locale(); - push @charsets, 'L' if defined $utf8_locale; - } -} - # Finally ready to do the tests foreach my $test (sort { numerically } keys %tests) { @@ -515,16 +494,10 @@ foreach my $test (sort { numerically } keys %tests) { #note $progress; # Now grind out tests, using various combinations. - foreach my $charset (@charsets) { + { my $charset_mod = lc $charset; - my $current_locale = ""; - if ($charset_mod eq 'l') { - $current_locale = POSIX::setlocale(&POSIX::LC_CTYPE, - ($charset eq 'L') - ? $utf8_locale - : 'C'); - $current_locale = 'C locale' if $current_locale eq 'C'; - } + my $current_locale = setlocale(&POSIX::LC_CTYPE); + $current_locale = 'C locale' if $current_locale eq 'C'; $okays = 0; $this_iteration = 0; diff --git a/t/re/fold_grind_8.t b/t/re/fold_grind_8.t new file mode 100644 index 0000000000..b614c10638 --- /dev/null +++ b/t/re/fold_grind_8.t @@ -0,0 +1,36 @@ +#!./perl + +# Call fold_grind with /l and a UTF-8 locale + +use strict; +use warnings; +no warnings 'once'; + +BEGIN { + chdir 't' if -d 't'; + require './test.pl'; + require './loc_tools.pl'; + set_up_inc('../lib'); +} + +skip_all "No locales" unless locales_enabled('LC_CTYPE'); + +# Look for a utf8 locale. +my $utf8_locale = find_utf8_ctype_locale(); +skip_all "Couldn't find a UTF-8 locale" unless defined $utf8_locale; + +my $current_locale = POSIX::setlocale( &POSIX::LC_CTYPE, $utf8_locale) // ""; +skip_all "Couldn't set locale to $utf8_locale" + unless $current_locale eq $utf8_locale; + +$::TEST_CHUNK = 'L'; + +do './re/fold_grind.pl'; +print STDERR "$@\n" if $@; +print STDERR "$!\n" if $!; + +1; + +# +# ex: set ts=8 sts=4 sw=4 et: +# diff --git a/t/re/fold_grind_a.t b/t/re/fold_grind_a.t new file mode 100644 index 0000000000..175e9ca3b9 --- /dev/null +++ b/t/re/fold_grind_a.t @@ -0,0 +1,24 @@ +#!./perl + +use strict; +use warnings; +no warnings 'once'; + +BEGIN { + chdir 't' if -d 't'; + require './test.pl'; + require './loc_tools.pl'; + set_up_inc('../lib'); +} + +$::TEST_CHUNK = 'a'; + +do './re/fold_grind.pl'; +print STDERR "$@\n" if $@; +print STDERR "$!\n" if $!; + +1; + +# +# ex: set ts=8 sts=4 sw=4 et: +# diff --git a/t/re/fold_grind_aa.t b/t/re/fold_grind_aa.t new file mode 100644 index 0000000000..40df70684c --- /dev/null +++ b/t/re/fold_grind_aa.t @@ -0,0 +1,20 @@ +#!./perl + +# Call fold_grind with /aa + +use strict; +use warnings; +no warnings 'once'; + +BEGIN { + chdir 't' if -d 't'; + require './test.pl'; + require './loc_tools.pl'; + set_up_inc('../lib'); +} + +$::TEST_CHUNK = 'aa'; + +do './re/fold_grind.pl'; +print STDERR "$@\n" if $@; +print STDERR "$!\n" if $!; diff --git a/t/re/fold_grind_d.t b/t/re/fold_grind_d.t new file mode 100644 index 0000000000..14897fb3e6 --- /dev/null +++ b/t/re/fold_grind_d.t @@ -0,0 +1,24 @@ +#!./perl + +use strict; +use warnings; +no warnings 'once'; + +BEGIN { + chdir 't' if -d 't'; + require './test.pl'; + require './loc_tools.pl'; + set_up_inc('../lib'); +} + +$::TEST_CHUNK = 'd'; + +do './re/fold_grind.pl'; +print STDERR "$@\n" if $@; +print STDERR "$!\n" if $!; + +1; + +# +# ex: set ts=8 sts=4 sw=4 et: +# diff --git a/t/re/fold_grind_l.t b/t/re/fold_grind_l.t new file mode 100644 index 0000000000..c5cfc7b32f --- /dev/null +++ b/t/re/fold_grind_l.t @@ -0,0 +1,41 @@ +#!./perl + +use strict; +use warnings; +no warnings 'once'; + +BEGIN { + chdir 't' if -d 't'; + require './test.pl'; + require './loc_tools.pl'; + set_up_inc('../lib'); +} + +skip_all "No locales" unless locales_enabled('LC_CTYPE'); + +my $current_locale = POSIX::setlocale( &POSIX::LC_CTYPE, "C") // ""; +skip_all "Couldn't set locale to C" unless $current_locale eq 'C'; + +use locale; + +# Some implementations don't have the 128-255 range characters all +# mean nothing under the C locale (an example being VMS). This is +# legal, but since we don't know what the right answers should be, +# skip the locale tests in that situation. +for my $i (128 .. 255) { + my $char = chr(utf8::unicode_to_native($i)); + skip_all "C locale doesn't behave as expected" if uc($char) ne $char + || lc($char) ne $char; +} + +$::TEST_CHUNK = 'l'; + +do './re/fold_grind.pl'; +print STDERR "$@\n" if $@; +print STDERR "$!\n" if $!; + +1; + +# +# ex: set ts=8 sts=4 sw=4 et: +# diff --git a/t/re/fold_grind_u.t b/t/re/fold_grind_u.t new file mode 100644 index 0000000000..fb2013ed59 --- /dev/null +++ b/t/re/fold_grind_u.t @@ -0,0 +1,24 @@ +#!./perl + +use strict; +use warnings; +no warnings 'once'; + +BEGIN { + chdir 't' if -d 't'; + require './test.pl'; + require './loc_tools.pl'; + set_up_inc('../lib'); +} + +$::TEST_CHUNK = 'u'; + +do './re/fold_grind.pl'; +print STDERR "$@\n" if $@; +print STDERR "$!\n" if $!; + +1; + +# +# ex: set ts=8 sts=4 sw=4 et: +# -- Perl5 Master Repository
