diff options
author | Craig A. Berry <craigberry@mac.com> | 2023-04-16 08:12:51 -0500 |
---|---|---|
committer | Craig A. Berry <craigberry@mac.com> | 2023-04-16 19:45:05 -0500 |
commit | ce8b32d4fca69ba96e2f7679c3b9fbdf183a35e0 (patch) | |
tree | dd16c04fba3c5b69e61057e5c134a28051bf7994 /t | |
parent | a1b81be29d90bb790a148fcc7e776047c84c7c8a (diff) | |
download | perl-ce8b32d4fca69ba96e2f7679c3b9fbdf183a35e0.tar.gz |
t/harness: avoid brace expansion
Brace expansion is not available in a POSIX shell, is handled
slightly differently by the shells that do support it, and is
unlikely to work when the underlying implementation for Perl's
glob() function is not a Unix shell. So instead of doing:
{foo,bar,baz}/*.t
just accumulate the results of simpler glob operations:
foo/*.t
bar/*.t
baz/*.t
This also allows us to dispense with the recursive function
_extract_tests() and its fancy dispatch based on reference type;
we would only ever be calling it with a simple string argument,
so we might as well just call glob() directly.
Diffstat (limited to 't')
-rw-r--r-- | t/harness | 28 |
1 files changed, 2 insertions, 26 deletions
@@ -116,28 +116,6 @@ if ($ENV{HARNESS_OPTIONS}) { $jobs ||= 1; -sub _extract_tests; -sub _extract_tests { - # This can probably be done more tersely with a map, but I doubt that it - # would be as clear - my @results; - foreach (@_) { - my $ref = ref $_; - if ($ref) { - if ($ref eq 'ARRAY') { - push @results, _extract_tests @$_; - } elsif ($ref eq 'HASH') { - push @results, _extract_tests values %$_; - } else { - die "Unknown reference type $ref"; - } - } else { - push @results, glob $_; - } - } - @results; -} - my %total_time; sub _compute_tests_and_ordering($) { my @tests = $_[0]->@*; @@ -367,14 +345,12 @@ if (@ARGV) { push @$which, 'bigmem' if $ENV{PERL_TEST_MEMORY}; if (@next) { - my $next = { par => '{' . join (',', @next) . '}/*.t' }; - @next = _extract_tests ($next); + @next = map { glob ("$_/*.t") } @next; push @tests, @next; push @seq, _compute_tests_and_ordering(\@next)->@*; } - my $last = { par => '{' . join (',', @last) . '}/*.t' }; - @last = _extract_tests ($last); + @last = map { glob ("$_/*.t") } @last; my ($non_ext, @ext_from_manifest)= _tests_from_manifest($Config{extensions}, $Config{known_extensions}, "all"); |