diff options
author | David Mitchell <davem@iabyn.com> | 2017-06-19 15:17:23 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2017-06-21 10:56:24 +0100 |
commit | e89a8e106c308b4c2fbaa6a213a6753aeeae6c0e (patch) | |
tree | 70bba4d7e5fbf7f186e9ef1316f535305bf7ced1 /Porting/bench.pl | |
parent | 9daf692fa7ab770932a56f209ef94ee7adb75c47 (diff) | |
download | perl-e89a8e106c308b4c2fbaa6a213a6753aeeae6c0e.tar.gz |
Porting/bench.pl: improve 'no such test' err msg
With --tests=A,B,.. if a test isn't found, it gives an error message,
and under --vebrose lists all available tests.
Make it:
not under --verbose: suggest running under verbose to get a list;
under --verbose: list available tests one per line rather than all on one
line.
Diffstat (limited to 'Porting/bench.pl')
-rwxr-xr-x | Porting/bench.pl | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Porting/bench.pl b/Porting/bench.pl index 631b176bb2..bd57adb47e 100755 --- a/Porting/bench.pl +++ b/Porting/bench.pl @@ -593,10 +593,18 @@ sub filter_tests { else { my %t; for (split /,/, $opt) { - die "Error: no such test found: '$_'\n" - . ($OPTS{verbose} ? " have: @{[ sort keys %$tests ]}\n" : "") - unless exists $tests->{$_}; $t{$_} = 1; + next if exists $tests->{$_}; + + my $e = "Error: no such test found: '$_'\n"; + if ($OPTS{verbose}) { + $e .= "Valid test names are:\n"; + $e .= " $_\n" for sort keys %$tests; + } + else { + $e .= "Re-run with --verbose for a list of valid tests.\n"; + } + die $e; } for (keys %$tests) { delete $tests->{$_} unless exists $t{$_}; |