summaryrefslogtreecommitdiffstats
path: root/lib/tests/test_all.t
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2008-08-21 15:18:58 (GMT)
committerTon Voon <tonvoon@users.sourceforge.net>2008-08-21 15:18:58 (GMT)
commitf31cd40f7a014c076615c4a1c28b989162a6ca9d (patch)
tree4b5c4f0aa4080fd99271a60a904990500b6ad933 /lib/tests/test_all.t
parent6a8240dd78716967e1eccb32ccfd966f321258b6 (diff)
downloadmonitoring-plugins-f31cd40f7a014c076615c4a1c28b989162a6ca9d.tar.gz
Correctly link to included libtap. Simplify invoking test scripts.
Removed basename test as we should use base_name from GNUlib which is tested separately git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2042 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'lib/tests/test_all.t')
-rwxr-xr-xlib/tests/test_all.t38
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 0000000..1fae81a
--- /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
5use strict;
6use Test::Harness;
7use Getopt::Std;
8
9my $opts = {};
10getopts("v", $opts) or die "Getopt failed";
11
12$Test::Harness::verbose = $opts->{v};
13$Test::Harness::switches="";
14
15my $special_errors = {
16 test_ini => "please enable parse-ini to test",
17 test_opts => "please enable parse-ini to test",
18};
19my $default_error = "could not compile";
20
21my @tests;
22foreach 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;
27use Test::More;
28if (! -e "$file") {
29 plan skip_all => "./$file not compiled - $error";
30}
31exec "./$file";
32EOF
33 close F;
34 push @tests, $file_t;
35}
36chmod 0750, @tests;
37runtests @tests;
38unlink @tests;