diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile.am | 6 | ||||
-rw-r--r-- | lib/parse_ini.c | 4 | ||||
-rw-r--r-- | lib/tests/Makefile.am | 16 | ||||
-rwxr-xr-x | lib/tests/test_ini.t | 2 | ||||
-rwxr-xr-x | lib/tests/test_opts.t | 2 |
5 files changed, 23 insertions, 7 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index 5d65bed6..73c12911 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am | |||
@@ -6,7 +6,11 @@ noinst_LIBRARIES = libnagiosplug.a | |||
6 | 6 | ||
7 | 7 | ||
8 | libnagiosplug_a_SOURCES = utils_base.c utils_disk.c utils_tcp.c utils_cmd.c | 8 | libnagiosplug_a_SOURCES = utils_base.c utils_disk.c utils_tcp.c utils_cmd.c |
9 | EXTRA_DIST = utils_base.h utils_disk.h utils_tcp.h utils_cmd.h | 9 | EXTRA_DIST = utils_base.h utils_disk.h utils_tcp.h utils_cmd.h parse_ini.h extra_opts.h |
10 | |||
11 | if USE_PARSE_INI | ||
12 | libnagiosplug_a_SOURCES += parse_ini.c extra_opts.c | ||
13 | endif USE_PARSE_INI | ||
10 | 14 | ||
11 | INCLUDES = -I$(srcdir) -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins | 15 | INCLUDES = -I$(srcdir) -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins |
12 | 16 | ||
diff --git a/lib/parse_ini.c b/lib/parse_ini.c index aaba03e0..d5661c9e 100644 --- a/lib/parse_ini.c +++ b/lib/parse_ini.c | |||
@@ -34,8 +34,8 @@ | |||
34 | #include <sys/stat.h> | 34 | #include <sys/stat.h> |
35 | #include <unistd.h> | 35 | #include <unistd.h> |
36 | 36 | ||
37 | /* FIXME: N::P dies if section is not found */ | 37 | /* TODO: die like N::P if section is not found */ |
38 | /* FIXME: N::P dies if config file is not found */ | 38 | /* TODO: die like N::P if config file is not found */ |
39 | 39 | ||
40 | /* np_ini_info contains the result of parsing a "locator" in the format | 40 | /* np_ini_info contains the result of parsing a "locator" in the format |
41 | * [stanza_name][@config_filename] (check_foo@/etc/foo.ini, for example) | 41 | * [stanza_name][@config_filename] (check_foo@/etc/foo.ini, for example) |
diff --git a/lib/tests/Makefile.am b/lib/tests/Makefile.am index bd25ccfe..25e2bed3 100644 --- a/lib/tests/Makefile.am +++ b/lib/tests/Makefile.am | |||
@@ -7,9 +7,11 @@ check_PROGRAMS = @EXTRA_TEST@ | |||
7 | 7 | ||
8 | INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins | 8 | INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins |
9 | 9 | ||
10 | EXTRA_PROGRAMS = test_utils test_disk test_tcp test_cmd test_base64 | 10 | EXTRA_PROGRAMS = test_utils test_disk test_tcp test_cmd test_base64 test_ini test_opts |
11 | 11 | ||
12 | EXTRA_DIST = test_utils.t test_disk.t test_tcp.t test_cmd.t test_base64.t | 12 | np_test_scripts = test_base64.t test_cmd.t test_disk.t test_ini.t test_opts.t test_tcp.t test_utils.t |
13 | np_test_files = config-dos.ini config-opts.ini config-tiny.ini plugin.ini plugins.ini | ||
14 | EXTRA_DIST = $(np_test_scripts) $(np_test_files) | ||
13 | 15 | ||
14 | LIBS = @LIBINTL@ | 16 | LIBS = @LIBINTL@ |
15 | 17 | ||
@@ -38,6 +40,16 @@ test_base64_CFLAGS = -g -I.. | |||
38 | test_base64_LDFLAGS = -L/usr/local/lib -ltap | 40 | test_base64_LDFLAGS = -L/usr/local/lib -ltap |
39 | test_base64_LDADD = $(top_srcdir)/gl/base64.o | 41 | test_base64_LDADD = $(top_srcdir)/gl/base64.o |
40 | 42 | ||
43 | test_ini_SOURCES = test_ini.c | ||
44 | test_ini_CFLAGS = -g -I.. | ||
45 | test_ini_LDFLAGS = -L/usr/local/lib -ltap | ||
46 | test_ini_LDADD = ../utils_base.o ../parse_ini.o | ||
47 | |||
48 | test_opts_SOURCES = test_opts.c | ||
49 | test_opts_CFLAGS = -g -I.. | ||
50 | test_opts_LDFLAGS = -L/usr/local/lib -ltap | ||
51 | test_opts_LDADD = ../utils_base.o ../parse_ini.o ../extra_opts.o | ||
52 | |||
41 | test: ${noinst_PROGRAMS} | 53 | test: ${noinst_PROGRAMS} |
42 | perl -MTest::Harness -e '$$Test::Harness::switches=""; runtests(map {$$_ .= ".t"} @ARGV)' $(EXTRA_PROGRAMS) | 54 | perl -MTest::Harness -e '$$Test::Harness::switches=""; runtests(map {$$_ .= ".t"} @ARGV)' $(EXTRA_PROGRAMS) |
43 | 55 | ||
diff --git a/lib/tests/test_ini.t b/lib/tests/test_ini.t index b130a01b..0487098c 100755 --- a/lib/tests/test_ini.t +++ b/lib/tests/test_ini.t | |||
@@ -1,6 +1,6 @@ | |||
1 | #!/usr/bin/perl | 1 | #!/usr/bin/perl |
2 | use Test::More; | 2 | use Test::More; |
3 | if (! -e "./test_ini") { | 3 | if (! -e "./test_ini") { |
4 | plan skip_all => "./test_ini not compiled - please install tap library to test"; | 4 | plan skip_all => "./test_ini not compiled - please install tap library and/or enable parse-ini to test"; |
5 | } | 5 | } |
6 | exec "./test_ini"; | 6 | exec "./test_ini"; |
diff --git a/lib/tests/test_opts.t b/lib/tests/test_opts.t index 86a5b21a..d69b8f1d 100755 --- a/lib/tests/test_opts.t +++ b/lib/tests/test_opts.t | |||
@@ -1,6 +1,6 @@ | |||
1 | #!/usr/bin/perl | 1 | #!/usr/bin/perl |
2 | use Test::More; | 2 | use Test::More; |
3 | if (! -e "./test_opts") { | 3 | if (! -e "./test_opts") { |
4 | plan skip_all => "./test_opts not compiled - please install tap library to test"; | 4 | plan skip_all => "./test_opts not compiled - please install tap library and/or enable parse-ini to test"; |
5 | } | 5 | } |
6 | exec "./test_opts"; | 6 | exec "./test_opts"; |