]> The Tcpdump Group git mirrors - libpcap/blob - testprogs/TESTst.pm
Factor TESTlib.pm out. [skip appveyor]
[libpcap] / testprogs / TESTst.pm
1 require 5.8.4; # Solaris 10
2 use strict;
3 use warnings FATAL => qw(uninitialized);
4 # TESTlib.pm
5 use subs qw(get_njobs);
6
7 # TESTrun helper functions (single-threaded implementation).
8
9 my @tests;
10
11 sub my_tmp_id {
12 return 'main';
13 }
14
15 sub start_tests {
16 print "INFO: This Perl does not support threads.\n";
17 my $njobs = get_njobs;
18 die "ERROR: Impossible to run $njobs tester threads!" if $njobs > 1;
19 @tests = @_;
20 }
21
22 # Here ordering of the results is obviously the same as ordering of the tests.
23 sub get_next_result {
24 my $test = shift @tests;
25 return undef unless defined $test;
26 my $result = $test->{func} ($test);
27 $result->{label} = $test->{label};
28 return $result;
29 }
30
31 1;