summaryrefslogtreecommitdiffstats
path: root/lib/tests
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@aei.ca>2008-11-28 08:22:39 (GMT)
committerThomas Guyot-Sionnest <dermoth@aei.ca>2008-11-28 08:22:39 (GMT)
commit538b97cea63d68efbd9c9c67d9c41278cfd1ebad (patch)
tree84e707f97fb82f1920fb7568241e8b5d8f71c0af /lib/tests
parentd40abb2504b99e1318840ad1a5d9f4a340c465b5 (diff)
downloadmonitoring-plugins-538b97cea63d68efbd9c9c67d9c41278cfd1ebad.tar.gz
Revert inclusion of libtap into nagiosplugins
(except for the NEWS file) This reverts the following commits (latest first): f3e0909, 9f16b54, be8df51, f31cd40, 5270c7d, a25083f, f1bfe40, c503d85 and 6c476db
Diffstat (limited to 'lib/tests')
-rw-r--r--lib/tests/Makefile.am60
-rwxr-xr-xlib/tests/test_all.t38
-rwxr-xr-xlib/tests/test_base64.t6
-rw-r--r--lib/tests/test_cmd.t6
-rwxr-xr-xlib/tests/test_disk.t6
-rwxr-xr-xlib/tests/test_ini.t6
-rwxr-xr-xlib/tests/test_opts.t6
-rwxr-xr-xlib/tests/test_tcp.t6
-rw-r--r--lib/tests/test_utils.c5
-rwxr-xr-xlib/tests/test_utils.t6
10 files changed, 85 insertions, 60 deletions
diff --git a/lib/tests/Makefile.am b/lib/tests/Makefile.am
index 805acf3..25e2bed 100644
--- a/lib/tests/Makefile.am
+++ b/lib/tests/Makefile.am
@@ -5,36 +5,54 @@ noinst_PROGRAMS = @EXTRA_TEST@
5TESTS = @EXTRA_TEST@ 5TESTS = @EXTRA_TEST@
6check_PROGRAMS = @EXTRA_TEST@ 6check_PROGRAMS = @EXTRA_TEST@
7 7
8TAP_LIB_DIR = $(top_srcdir)/@TAP_DIR@/src 8INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins
9TAP_O = $(TAP_LIB_DIR)/tap.o $(TAP_LIB_DIR)/../lib/libgnu.la
10INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins -I$(TAP_LIB_DIR)
11 9
12EXTRA_PROGRAMS = test_utils test_disk test_tcp test_cmd test_base64 test_ini test_opts 10EXTRA_PROGRAMS = test_utils test_disk test_tcp test_cmd test_base64 test_ini test_opts
13 11
12np_test_scripts = test_base64.t test_cmd.t test_disk.t test_ini.t test_opts.t test_tcp.t test_utils.t
14np_test_files = config-dos.ini config-opts.ini config-tiny.ini plugin.ini plugins.ini 13np_test_files = config-dos.ini config-opts.ini config-tiny.ini plugin.ini plugins.ini
15EXTRA_DIST = test_all.t $(np_test_files) 14EXTRA_DIST = $(np_test_scripts) $(np_test_files)
16
17AM_CFLAGS = -g -I..
18 15
19LIBS = @LIBINTL@ 16LIBS = @LIBINTL@
20 17
21test_utils_LDADD = ../utils_base.o $(TAP_O) 18test_utils_SOURCES = test_utils.c
22 19test_utils_CFLAGS = -g -I..
23test_disk_LDADD = ../utils_disk.o $(top_srcdir)/gl/libgnu.a $(TAP_O) 20test_utils_LDFLAGS = -L/usr/local/lib -ltap
24 21test_utils_LDADD = ../utils_base.o
25test_tcp_LDADD = ../utils_tcp.o $(TAP_O) 22
26 23test_disk_SOURCES = test_disk.c
27test_cmd_LDADD = ../utils_cmd.o ../utils_base.o $(TAP_O) 24test_disk_CFLAGS = -g -I..
28 25test_disk_LDFLAGS = -L/usr/local/lib -ltap
29test_base64_LDADD = $(top_srcdir)/gl/base64.o $(TAP_O) 26test_disk_LDADD = ../utils_disk.o $(top_srcdir)/gl/libgnu.a
30 27
31test_ini_LDADD = ../utils_base.o ../parse_ini.o $(TAP_O) 28test_tcp_SOURCES = test_tcp.c
32 29test_tcp_CFLAGS = -g -I..
33test_opts_LDADD = ../utils_base.o ../parse_ini.o ../extra_opts.o $(TAP_O) 30test_tcp_LDFLAGS = -L/usr/local/lib -ltap
31test_tcp_LDADD = ../utils_tcp.o
32
33test_cmd_SOURCES = test_cmd.c
34test_cmd_CFLAGS = -g -I..
35test_cmd_LDFLAGS = -L/usr/local/lib -ltap
36test_cmd_LDADD = ../utils_cmd.o ../utils_base.o
37
38test_base64_SOURCES = test_base64.c
39test_base64_CFLAGS = -g -I..
40test_base64_LDFLAGS = -L/usr/local/lib -ltap
41test_base64_LDADD = $(top_srcdir)/gl/base64.o
42
43test_ini_SOURCES = test_ini.c
44test_ini_CFLAGS = -g -I..
45test_ini_LDFLAGS = -L/usr/local/lib -ltap
46test_ini_LDADD = ../utils_base.o ../parse_ini.o
47
48test_opts_SOURCES = test_opts.c
49test_opts_CFLAGS = -g -I..
50test_opts_LDFLAGS = -L/usr/local/lib -ltap
51test_opts_LDADD = ../utils_base.o ../parse_ini.o ../extra_opts.o
34 52
35test: ${noinst_PROGRAMS} 53test: ${noinst_PROGRAMS}
36 perl ./test_all.t $(EXTRA_PROGRAMS) 54 perl -MTest::Harness -e '$$Test::Harness::switches=""; runtests(map {$$_ .= ".t"} @ARGV)' $(EXTRA_PROGRAMS)
37 55
38test-debug: ${noinst_PROGRAMS} 56test-debug: ${noinst_PROGRAMS}
39 perl ./test_all.t -v $(EXTRA_PROGRAMS) 57 perl -MTest::Harness -e '$$Test::Harness::verbose=1; $$Test::Harness::switches=""; runtests(map {$$_ .= ".t"} @ARGV)' $(EXTRA_PROGRAMS)
40 58
diff --git a/lib/tests/test_all.t b/lib/tests/test_all.t
deleted file mode 100755
index 1fae81a..0000000
--- a/lib/tests/test_all.t
+++ /dev/null
@@ -1,38 +0,0 @@
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;
diff --git a/lib/tests/test_base64.t b/lib/tests/test_base64.t
new file mode 100755
index 0000000..4b9236f
--- /dev/null
+++ b/lib/tests/test_base64.t
@@ -0,0 +1,6 @@
1#!/usr/bin/perl
2use Test::More;
3if (! -e "./test_base64") {
4 plan skip_all => "./test_base64 not compiled - please install tap library to test";
5}
6exec "./test_base64";
diff --git a/lib/tests/test_cmd.t b/lib/tests/test_cmd.t
new file mode 100644
index 0000000..4dd54ef
--- /dev/null
+++ b/lib/tests/test_cmd.t
@@ -0,0 +1,6 @@
1#!/usr/bin/perl
2use Test::More;
3if (! -e "./test_cmd") {
4 plan skip_all => "./test_cmd not compiled - please install tap library to test";
5}
6exec "./test_cmd";
diff --git a/lib/tests/test_disk.t b/lib/tests/test_disk.t
new file mode 100755
index 0000000..d32567a
--- /dev/null
+++ b/lib/tests/test_disk.t
@@ -0,0 +1,6 @@
1#!/usr/bin/perl
2use Test::More;
3if (! -e "./test_disk") {
4 plan skip_all => "./test_disk not compiled - please install tap library to test";
5}
6exec "./test_disk";
diff --git a/lib/tests/test_ini.t b/lib/tests/test_ini.t
new file mode 100755
index 0000000..0487098
--- /dev/null
+++ b/lib/tests/test_ini.t
@@ -0,0 +1,6 @@
1#!/usr/bin/perl
2use Test::More;
3if (! -e "./test_ini") {
4 plan skip_all => "./test_ini not compiled - please install tap library and/or enable parse-ini to test";
5}
6exec "./test_ini";
diff --git a/lib/tests/test_opts.t b/lib/tests/test_opts.t
new file mode 100755
index 0000000..d69b8f1
--- /dev/null
+++ b/lib/tests/test_opts.t
@@ -0,0 +1,6 @@
1#!/usr/bin/perl
2use Test::More;
3if (! -e "./test_opts") {
4 plan skip_all => "./test_opts not compiled - please install tap library and/or enable parse-ini to test";
5}
6exec "./test_opts";
diff --git a/lib/tests/test_tcp.t b/lib/tests/test_tcp.t
new file mode 100755
index 0000000..8f34b67
--- /dev/null
+++ b/lib/tests/test_tcp.t
@@ -0,0 +1,6 @@
1#!/usr/bin/perl
2use Test::More;
3if (! -e "./test_tcp") {
4 plan skip_all => "./test_tcp not compiled - please install tap library to test";
5}
6exec "./test_tcp";
diff --git a/lib/tests/test_utils.c b/lib/tests/test_utils.c
index 64efca2..5c6cce4 100644
--- a/lib/tests/test_utils.c
+++ b/lib/tests/test_utils.c
@@ -29,7 +29,7 @@ main (int argc, char **argv)
29 thresholds *thresholds = NULL; 29 thresholds *thresholds = NULL;
30 int rc; 30 int rc;
31 31
32 plan_tests(81); 32 plan_tests(82);
33 33
34 range = parse_range_string("6"); 34 range = parse_range_string("6");
35 ok( range != NULL, "'6' is valid range"); 35 ok( range != NULL, "'6' is valid range");
@@ -173,5 +173,8 @@ main (int argc, char **argv)
173 ok( strcmp(test, "everything") == 0, "everything okay"); 173 ok( strcmp(test, "everything") == 0, "everything okay");
174 free(test); 174 free(test);
175 175
176 test = basename("/here/is/a/path");
177 ok( strcmp(test, "path") == 0, "basename okay");
178
176 return exit_status(); 179 return exit_status();
177} 180}
diff --git a/lib/tests/test_utils.t b/lib/tests/test_utils.t
new file mode 100755
index 0000000..152eb71
--- /dev/null
+++ b/lib/tests/test_utils.t
@@ -0,0 +1,6 @@
1#!/usr/bin/perl
2use Test::More;
3if (! -e "./test_utils") {
4 plan skip_all => "./test_utils not compiled - please install tap library to test";
5}
6exec "./test_utils";