diff options
Diffstat (limited to 'lib/tests/test_all.t')
-rwxr-xr-x | lib/tests/test_all.t | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/tests/test_all.t b/lib/tests/test_all.t new file mode 100755 index 00000000..1fae81a8 --- /dev/null +++ b/lib/tests/test_all.t | |||
@@ -0,0 +1,38 @@ | |||
1 | #!/usr/bin/perl | ||
2 | # Creates $file.t for each @ARGV | ||
3 | # Then calls runtests for all these files | ||
4 | |||
5 | use strict; | ||
6 | use Test::Harness; | ||
7 | use Getopt::Std; | ||
8 | |||
9 | my $opts = {}; | ||
10 | getopts("v", $opts) or die "Getopt failed"; | ||
11 | |||
12 | $Test::Harness::verbose = $opts->{v}; | ||
13 | $Test::Harness::switches=""; | ||
14 | |||
15 | my $special_errors = { | ||
16 | test_ini => "please enable parse-ini to test", | ||
17 | test_opts => "please enable parse-ini to test", | ||
18 | }; | ||
19 | my $default_error = "could not compile"; | ||
20 | |||
21 | my @tests; | ||
22 | foreach my $file (@ARGV) { | ||
23 | my $file_t = "$file.t"; | ||
24 | my $error = $special_errors->{ $file } || $default_error; | ||
25 | open F, ">", $file_t or die "Cannot open $file_t for writing"; | ||
26 | print F <<EOF; | ||
27 | use Test::More; | ||
28 | if (! -e "$file") { | ||
29 | plan skip_all => "./$file not compiled - $error"; | ||
30 | } | ||
31 | exec "./$file"; | ||
32 | EOF | ||
33 | close F; | ||
34 | push @tests, $file_t; | ||
35 | } | ||
36 | chmod 0750, @tests; | ||
37 | runtests @tests; | ||
38 | unlink @tests; | ||