X-Git-Url: https://git.tcpdump.org/libpcap/blobdiff_plain/3e30d5106bd34bdefc3e0e6382690bc46f5e3ba9..refs/heads/master:/testprogs/TESTst.pm?ds=inline diff --git a/testprogs/TESTst.pm b/testprogs/TESTst.pm index 95f18051..ffdcb670 100644 --- a/testprogs/TESTst.pm +++ b/testprogs/TESTst.pm @@ -1,32 +1,30 @@ +require 5.8.4; # Solaris 10 use strict; use warnings FATAL => qw(uninitialized); +# TESTlib.pm +use subs qw(get_njobs); # TESTrun helper functions (single-threaded implementation). my @tests; -my $done; sub my_tmp_id { return 'main'; } -sub set_njobs { - print "INFO: This Perl does not support threads.\n"; - my $njobs = shift; - die sprintf "ERROR: Impossible to run $njobs tester threads!" if $njobs > 1; -} - sub start_tests { + print "INFO: This Perl does not support threads.\n"; + my $njobs = get_njobs; + die "ERROR: Impossible to run $njobs tester threads!" if $njobs > 1; @tests = @_; - $done = 0; } # Here ordering of the results is obviously the same as ordering of the tests. sub get_next_result { - return undef if $done == scalar @tests; - my $result = $tests[$done]{func} ($tests[$done]->%*); - $result->{label} = $tests[$done]{label}; - $done++; + my $test = shift @tests; + return undef unless defined $test; + my $result = $test->{func} ($test); + $result->{label} = $test->{label}; return $result; }