summaryrefslogtreecommitdiffstats
path: root/lib/tests
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tests')
-rw-r--r--lib/tests/Makefile.am6
-rw-r--r--lib/tests/test_disk.c192
-rwxr-xr-xlib/tests/test_disk.t6
-rw-r--r--lib/tests/test_generic_output.c315
-rw-r--r--lib/tests/test_generic_output.t6
5 files changed, 324 insertions, 201 deletions
diff --git a/lib/tests/Makefile.am b/lib/tests/Makefile.am
index 31d79df6..7798a72e 100644
--- a/lib/tests/Makefile.am
+++ b/lib/tests/Makefile.am
@@ -8,9 +8,9 @@ check_PROGRAMS = @EXTRA_TEST@
8AM_CPPFLAGS = -DNP_STATE_DIR_PREFIX=\"$(localstatedir)\" \ 8AM_CPPFLAGS = -DNP_STATE_DIR_PREFIX=\"$(localstatedir)\" \
9 -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins 9 -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins
10 10
11EXTRA_PROGRAMS = test_utils test_disk test_tcp test_cmd test_base64 test_ini1 test_ini3 test_opts1 test_opts2 test_opts3 11EXTRA_PROGRAMS = test_utils test_tcp test_cmd test_base64 test_ini1 test_ini3 test_opts1 test_opts2 test_opts3 test_generic_output
12 12
13np_test_scripts = test_base64.t test_cmd.t test_disk.t test_ini1.t test_ini3.t test_opts1.t test_opts2.t test_opts3.t test_tcp.t test_utils.t 13np_test_scripts = test_base64.t test_cmd.t test_ini1.t test_ini3.t test_opts1.t test_opts2.t test_opts3.t test_tcp.t test_utils.t test_generic_output.t
14np_test_files = config-dos.ini config-opts.ini config-tiny.ini plugin.ini plugins.ini 14np_test_files = config-dos.ini config-opts.ini config-tiny.ini plugin.ini plugins.ini
15EXTRA_DIST = $(np_test_scripts) $(np_test_files) var 15EXTRA_DIST = $(np_test_scripts) $(np_test_files) var
16 16
@@ -29,7 +29,7 @@ AM_CFLAGS = -g -I$(top_srcdir)/lib -I$(top_srcdir)/gl $(tap_cflags)
29AM_LDFLAGS = $(tap_ldflags) -ltap 29AM_LDFLAGS = $(tap_ldflags) -ltap
30LDADD = $(top_srcdir)/lib/libmonitoringplug.a $(top_srcdir)/gl/libgnu.a $(LIB_CRYPTO) 30LDADD = $(top_srcdir)/lib/libmonitoringplug.a $(top_srcdir)/gl/libgnu.a $(LIB_CRYPTO)
31 31
32SOURCES = test_utils.c test_disk.c test_tcp.c test_cmd.c test_base64.c test_ini1.c test_ini3.c test_opts1.c test_opts2.c test_opts3.c 32SOURCES = test_utils.c test_tcp.c test_cmd.c test_base64.c test_ini1.c test_ini3.c test_opts1.c test_opts2.c test_opts3.c test_generic_output.c
33 33
34test: ${noinst_PROGRAMS} 34test: ${noinst_PROGRAMS}
35 perl -MTest::Harness -e '$$Test::Harness::switches=""; runtests(map {$$_ .= ".t"} @ARGV)' $(EXTRA_PROGRAMS) 35 perl -MTest::Harness -e '$$Test::Harness::switches=""; runtests(map {$$_ .= ".t"} @ARGV)' $(EXTRA_PROGRAMS)
diff --git a/lib/tests/test_disk.c b/lib/tests/test_disk.c
deleted file mode 100644
index c18db7a4..00000000
--- a/lib/tests/test_disk.c
+++ /dev/null
@@ -1,192 +0,0 @@
1/*****************************************************************************
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 *
17 *****************************************************************************/
18
19#include "common.h"
20#include "utils_disk.h"
21#include "tap.h"
22#include "regex.h"
23
24void np_test_mount_entry_regex(struct mount_entry *dummy_mount_list, char *regstr, int cflags, int expect, char *desc);
25
26int main(int argc, char **argv) {
27 struct name_list *exclude_filesystem = NULL;
28 struct name_list *exclude_fstype = NULL;
29 struct name_list *dummy_mountlist = NULL;
30 struct name_list *temp_name;
31 struct parameter_list *paths = NULL;
32 struct parameter_list *p, *prev = NULL, *last = NULL;
33
34 struct mount_entry *dummy_mount_list;
35 struct mount_entry *me;
36 struct mount_entry **mtail = &dummy_mount_list;
37 int cflags = REG_NOSUB | REG_EXTENDED;
38 int found = 0, count = 0;
39
40 plan_tests(33);
41
42 ok(np_find_name(exclude_filesystem, "/var/log") == false, "/var/log not in list");
43 np_add_name(&exclude_filesystem, "/var/log");
44 ok(np_find_name(exclude_filesystem, "/var/log") == true, "is in list now");
45 ok(np_find_name(exclude_filesystem, "/home") == false, "/home not in list");
46 np_add_name(&exclude_filesystem, "/home");
47 ok(np_find_name(exclude_filesystem, "/home") == true, "is in list now");
48 ok(np_find_name(exclude_filesystem, "/var/log") == true, "/var/log still in list");
49
50 ok(np_find_name(exclude_fstype, "iso9660") == false, "iso9660 not in list");
51 np_add_name(&exclude_fstype, "iso9660");
52 ok(np_find_name(exclude_fstype, "iso9660") == true, "is in list now");
53
54 ok(np_find_name(exclude_filesystem, "iso9660") == false, "Make sure no clashing in variables");
55
56 /*
57 for (temp_name = exclude_filesystem; temp_name; temp_name = temp_name->next) {
58 printf("Name: %s\n", temp_name->name);
59 }
60 */
61
62 me = (struct mount_entry *)malloc(sizeof *me);
63 me->me_devname = strdup("/dev/c0t0d0s0");
64 me->me_mountdir = strdup("/");
65 *mtail = me;
66 mtail = &me->me_next;
67
68 me = (struct mount_entry *)malloc(sizeof *me);
69 me->me_devname = strdup("/dev/c1t0d1s0");
70 me->me_mountdir = strdup("/var");
71 *mtail = me;
72 mtail = &me->me_next;
73
74 me = (struct mount_entry *)malloc(sizeof *me);
75 me->me_devname = strdup("/dev/c2t0d0s0");
76 me->me_mountdir = strdup("/home");
77 *mtail = me;
78 mtail = &me->me_next;
79
80 np_test_mount_entry_regex(dummy_mount_list, strdup("/"), cflags, 3, strdup("a"));
81 np_test_mount_entry_regex(dummy_mount_list, strdup("/dev"), cflags, 3, strdup("regex on dev names:"));
82 np_test_mount_entry_regex(dummy_mount_list, strdup("/foo"), cflags, 0, strdup("regex on non existent dev/path:"));
83 np_test_mount_entry_regex(dummy_mount_list, strdup("/Foo"), cflags | REG_ICASE, 0, strdup("regi on non existent dev/path:"));
84 np_test_mount_entry_regex(dummy_mount_list, strdup("/c.t0"), cflags, 3, strdup("partial devname regex match:"));
85 np_test_mount_entry_regex(dummy_mount_list, strdup("c0t0"), cflags, 1, strdup("partial devname regex match:"));
86 np_test_mount_entry_regex(dummy_mount_list, strdup("C0t0"), cflags | REG_ICASE, 1, strdup("partial devname regi match:"));
87 np_test_mount_entry_regex(dummy_mount_list, strdup("home"), cflags, 1, strdup("partial pathname regex match:"));
88 np_test_mount_entry_regex(dummy_mount_list, strdup("hOme"), cflags | REG_ICASE, 1, strdup("partial pathname regi match:"));
89 np_test_mount_entry_regex(dummy_mount_list, strdup("(/home)|(/var)"), cflags, 2, strdup("grouped regex pathname match:"));
90 np_test_mount_entry_regex(dummy_mount_list, strdup("(/homE)|(/Var)"), cflags | REG_ICASE, 2, strdup("grouped regi pathname match:"));
91
92 np_add_parameter(&paths, "/home/groups");
93 np_add_parameter(&paths, "/var");
94 np_add_parameter(&paths, "/tmp");
95 np_add_parameter(&paths, "/home/tonvoon");
96 np_add_parameter(&paths, "/dev/c2t0d0s0");
97
98 np_set_best_match(paths, dummy_mount_list, false);
99 for (p = paths; p; p = p->name_next) {
100 struct mount_entry *temp_me;
101 temp_me = p->best_match;
102 if (!strcmp(p->name, "/home/groups")) {
103 ok(temp_me && !strcmp(temp_me->me_mountdir, "/home"), "/home/groups got right best match: /home");
104 } else if (!strcmp(p->name, "/var")) {
105 ok(temp_me && !strcmp(temp_me->me_mountdir, "/var"), "/var got right best match: /var");
106 } else if (!strcmp(p->name, "/tmp")) {
107 ok(temp_me && !strcmp(temp_me->me_mountdir, "/"), "/tmp got right best match: /");
108 } else if (!strcmp(p->name, "/home/tonvoon")) {
109 ok(temp_me && !strcmp(temp_me->me_mountdir, "/home"), "/home/tonvoon got right best match: /home");
110 } else if (!strcmp(p->name, "/dev/c2t0d0s0")) {
111 ok(temp_me && !strcmp(temp_me->me_devname, "/dev/c2t0d0s0"), "/dev/c2t0d0s0 got right best match: /dev/c2t0d0s0");
112 }
113 }
114
115 paths = NULL; /* Bad boy - should free, but this is a test suite */
116 np_add_parameter(&paths, "/home/groups");
117 np_add_parameter(&paths, "/var");
118 np_add_parameter(&paths, "/tmp");
119 np_add_parameter(&paths, "/home/tonvoon");
120 np_add_parameter(&paths, "/home");
121
122 np_set_best_match(paths, dummy_mount_list, true);
123 for (p = paths; p; p = p->name_next) {
124 if (!strcmp(p->name, "/home/groups")) {
125 ok(!p->best_match, "/home/groups correctly not found");
126 } else if (!strcmp(p->name, "/var")) {
127 ok(p->best_match, "/var found");
128 } else if (!strcmp(p->name, "/tmp")) {
129 ok(!p->best_match, "/tmp correctly not found");
130 } else if (!strcmp(p->name, "/home/tonvoon")) {
131 ok(!p->best_match, "/home/tonvoon not found");
132 } else if (!strcmp(p->name, "/home")) {
133 ok(p->best_match, "/home found");
134 }
135 }
136
137 /* test deleting first element in paths */
138 paths = np_del_parameter(paths, NULL);
139 for (p = paths; p; p = p->name_next) {
140 if (!strcmp(p->name, "/home/groups"))
141 found = 1;
142 }
143 ok(found == 0, "first element successfully deleted");
144 found = 0;
145
146 p = paths;
147 while (p) {
148 if (!strcmp(p->name, "/tmp"))
149 p = np_del_parameter(p, prev);
150 else {
151 prev = p;
152 p = p->name_next;
153 }
154 }
155
156 for (p = paths; p; p = p->name_next) {
157 if (!strcmp(p->name, "/tmp"))
158 found = 1;
159 if (p->name_next)
160 prev = p;
161 else
162 last = p;
163 }
164 ok(found == 0, "/tmp element successfully deleted");
165
166 p = np_del_parameter(last, prev);
167 for (p = paths; p; p = p->name_next) {
168 if (!strcmp(p->name, "/home"))
169 found = 1;
170 last = p;
171 count++;
172 }
173 ok(found == 0, "last (/home) element successfully deleted");
174 ok(count == 2, "two elements remaining");
175
176 return exit_status();
177}
178
179void np_test_mount_entry_regex(struct mount_entry *dummy_mount_list, char *regstr, int cflags, int expect, char *desc) {
180 int matches = 0;
181 regex_t re;
182 struct mount_entry *me;
183 if (regcomp(&re, regstr, cflags) == 0) {
184 for (me = dummy_mount_list; me; me = me->me_next) {
185 if (np_regex_match_mount_entry(me, &re))
186 matches++;
187 }
188 ok(matches == expect, "%s '%s' matched %i/3 entries. ok: %i/3", desc, regstr, expect, matches);
189
190 } else
191 ok(false, "regex '%s' not compilable", regstr);
192}
diff --git a/lib/tests/test_disk.t b/lib/tests/test_disk.t
deleted file mode 100755
index da84dfdf..00000000
--- a/lib/tests/test_disk.t
+++ /dev/null
@@ -1,6 +0,0 @@
1#!/usr/bin/perl
2use Test::More;
3if (! -e "./test_disk") {
4 plan skip_all => "./test_disk not compiled - please enable libtap library to test";
5}
6exec "./test_disk";
diff --git a/lib/tests/test_generic_output.c b/lib/tests/test_generic_output.c
new file mode 100644
index 00000000..e67aefc9
--- /dev/null
+++ b/lib/tests/test_generic_output.c
@@ -0,0 +1,315 @@
1#include "../lib/output.h"
2#include "../../tap/tap.h"
3#include "./states.h"
4
5#include <string.h>
6
7void test_one_subcheck(void);
8void test_two_subchecks(void);
9
10void test_perfdata_formatting(void);
11void test_perfdata_formatting2(void);
12
13void test_deep_check_hierarchy(void);
14void test_deep_check_hierarchy2(void);
15
16void test_default_states1(void);
17void test_default_states2(void);
18
19int main(void) {
20 plan_tests(19);
21
22 diag("Simple test with one subcheck");
23 test_one_subcheck();
24
25 diag("Test with two subchecks");
26 test_two_subchecks();
27
28 diag("Test for performance data formatting");
29 test_perfdata_formatting();
30
31 diag("Another test for performance data formatting");
32 test_perfdata_formatting2();
33
34 diag("Test for deeper hierarchies");
35 test_deep_check_hierarchy();
36
37 diag("Another test for deeper hierarchies");
38 test_deep_check_hierarchy2();
39
40 diag("Testing the default state logic");
41 test_default_states1();
42
43 diag("Testing the default state logic #2");
44 test_default_states2();
45
46 return exit_status();
47}
48
49void test_one_subcheck(void) {
50 mp_subcheck sc1 = mp_subcheck_init();
51
52 sc1.output = "foobar";
53 sc1 = mp_set_subcheck_state(sc1, STATE_WARNING);
54
55 mp_check check = mp_check_init();
56 mp_add_subcheck_to_check(&check, sc1);
57
58 ok(mp_compute_check_state(check) == STATE_WARNING, "Main state should be warning");
59
60 char *output = mp_fmt_output(check);
61
62 // diag("Formatted output");
63 // diag(output);
64
65 char expected[] = "[WARNING] - ok=0, warning=1, critical=0, unknown=0\n"
66 "\t\\_[WARNING] - foobar\n";
67
68 // diag("Expected output");
69 // diag(expected);
70
71 ok(strcmp(output, expected) == 0, "Simple output test");
72}
73
74void test_perfdata_formatting2(void) {
75 mp_perfdata pd1 = perfdata_init();
76 mp_perfdata pd2 = perfdata_init();
77
78 pd1.label = "foo";
79 pd2.label = "bar";
80
81 pd1 = mp_set_pd_value(pd1, 23);
82 pd2 = mp_set_pd_value(pd2, 1LL);
83
84 pd_list *tmp = pd_list_init();
85
86 pd_list_append(tmp, pd1);
87 pd_list_append(tmp, pd2);
88
89 char *result = pd_list_to_string(*tmp);
90
91 ok(strcmp(result, "foo=23;;; bar=1;;;") == 0, "Perfdata string formatting");
92}
93
94void test_perfdata_formatting(void) {
95 mp_perfdata pd1 = perfdata_init();
96
97 pd1.uom = "s";
98 pd1.label = "foo";
99
100 pd1 = mp_set_pd_value(pd1, 23);
101
102 char *pd_string = pd_to_string(pd1);
103
104 ok(strcmp(pd_string, "foo=23s;;;") == 0, "Perfdata string formatting");
105}
106
107void test_two_subchecks(void) {
108 mp_subcheck sc1 = mp_subcheck_init();
109
110 sc1.output = "foobar";
111 sc1 = mp_set_subcheck_state(sc1, STATE_WARNING);
112
113 ok(mp_compute_subcheck_state(sc1) == STATE_WARNING, "Test subcheck state directly after setting it");
114
115 mp_perfdata pd1 = perfdata_init();
116
117 pd1 = mp_set_pd_value(pd1, 23);
118
119 pd1.uom = "s";
120 pd1.label = "foo";
121
122 mp_add_perfdata_to_subcheck(&sc1, pd1);
123
124 mp_subcheck sc2 = mp_subcheck_init();
125 sc2.output = "baz";
126 sc2 = mp_set_subcheck_state(sc2, STATE_OK);
127
128 ok(mp_compute_subcheck_state(sc2) == STATE_OK, "Test subcheck 2 state after setting it");
129
130 mp_add_subcheck_to_subcheck(&sc1, sc2);
131
132 ok(mp_compute_subcheck_state(sc1) == STATE_WARNING, "Test subcheck state after adding a subcheck");
133
134 mp_check check = mp_check_init();
135 mp_add_subcheck_to_check(&check, sc1);
136
137 ok(mp_compute_check_state(check) == STATE_WARNING, "Test main check result");
138
139 char *output = mp_fmt_output(check);
140
141 // diag("Formatted output. Length: %u", strlen(output));
142 // diag(output);
143
144 ok(output != NULL, "Output should not be NULL");
145
146 char expected[] = "[WARNING] - ok=0, warning=1, critical=0, unknown=0\n"
147 "\t\\_[WARNING] - foobar\n"
148 "\t\t\\_[OK] - baz\n"
149 "|foo=23s;;; \n";
150
151 // diag("Expected output. Length: %u", strlen(expected));
152 // diag(expected);
153
154 ok(strcmp(output, expected) == 0, "Output is as expected");
155}
156
157void test_deep_check_hierarchy(void) {
158 // level 4
159 mp_subcheck sc4 = mp_subcheck_init();
160 sc4.output = "level4";
161 sc4 = mp_set_subcheck_state(sc4, STATE_OK);
162
163 // level 3
164 mp_subcheck sc3 = mp_subcheck_init();
165 sc3.output = "level3";
166 sc3 = mp_set_subcheck_state(sc3, STATE_OK);
167
168 // level 2
169 mp_subcheck sc2 = mp_subcheck_init();
170 sc2.output = "baz";
171 sc2 = mp_set_subcheck_state(sc2, STATE_OK);
172
173 // level 1
174 mp_subcheck sc1 = mp_subcheck_init();
175
176 sc1.output = "foobar";
177 sc1 = mp_set_subcheck_state(sc1, STATE_WARNING);
178
179 mp_perfdata pd1 = perfdata_init();
180
181 pd1.uom = "s";
182 pd1.label = "foo";
183 pd1 = mp_set_pd_value(pd1, 23);
184
185 mp_add_perfdata_to_subcheck(&sc1, pd1);
186
187 // main check
188 mp_check check = mp_check_init();
189
190 mp_add_subcheck_to_subcheck(&sc3, sc4);
191 mp_add_subcheck_to_subcheck(&sc2, sc3);
192 mp_add_subcheck_to_subcheck(&sc1, sc2);
193 mp_add_subcheck_to_check(&check, sc1);
194
195 char *output = mp_fmt_output(check);
196
197 size_t output_length = strlen(output);
198
199 // diag("Formatted output of length %i", output_length);
200 // diag(output);
201
202 ok(output != NULL, "Output should not be NULL");
203
204 char expected[] = "[WARNING] - ok=0, warning=1, critical=0, unknown=0\n"
205 "\t\\_[WARNING] - foobar\n"
206 "\t\t\\_[OK] - baz\n"
207 "\t\t\t\\_[OK] - level3\n"
208 "\t\t\t\t\\_[OK] - level4\n"
209 "|foo=23s;;; \n";
210
211 size_t expected_length = strlen(expected);
212
213 // diag("Expected output of length: %i", expected_length);
214 // diag(expected);
215
216 ok(output_length == expected_length, "Outputs are of equal length");
217 ok(strcmp(output, expected) == 0, "Output is as expected");
218}
219
220void test_deep_check_hierarchy2(void) {
221 // level 1
222 mp_subcheck sc1 = mp_subcheck_init();
223
224 sc1.output = "foobar";
225 sc1 = mp_set_subcheck_state(sc1, STATE_WARNING);
226
227 mp_perfdata pd1 = perfdata_init();
228 pd1.uom = "s";
229 pd1.label = "foo";
230 pd1 = mp_set_pd_value(pd1, 23);
231
232 mp_add_perfdata_to_subcheck(&sc1, pd1);
233
234 // level 2
235 mp_subcheck sc2 = mp_subcheck_init();
236 sc2.output = "baz";
237 sc2 = mp_set_subcheck_state(sc2, STATE_OK);
238
239 mp_perfdata pd2 = perfdata_init();
240 pd2.uom = "B";
241 pd2.label = "baz";
242 pd2 = mp_set_pd_value(pd2, 1024);
243 mp_add_perfdata_to_subcheck(&sc2, pd2);
244
245 // level 3
246 mp_subcheck sc3 = mp_subcheck_init();
247 sc3.output = "level3";
248 sc3 = mp_set_subcheck_state(sc3, STATE_OK);
249
250 mp_perfdata pd3 = perfdata_init();
251 pd3.label = "floatMe";
252 pd3 = mp_set_pd_value(pd3, 1024.1024);
253 mp_add_perfdata_to_subcheck(&sc3, pd3);
254
255 // level 4
256 mp_subcheck sc4 = mp_subcheck_init();
257 sc4.output = "level4";
258 sc4 = mp_set_subcheck_state(sc4, STATE_OK);
259
260 mp_check check = mp_check_init();
261
262 mp_add_subcheck_to_subcheck(&sc3, sc4);
263 mp_add_subcheck_to_subcheck(&sc2, sc3);
264 mp_add_subcheck_to_subcheck(&sc1, sc2);
265 mp_add_subcheck_to_check(&check, sc1);
266
267 char *output = mp_fmt_output(check);
268
269 // diag("Formatted output of length: %i", strlen(output));
270 // diag(output);
271
272 ok(output != NULL, "Output should not be NULL");
273
274 char expected[] = "[WARNING] - ok=0, warning=1, critical=0, unknown=0\n"
275 "\t\\_[WARNING] - foobar\n"
276 "\t\t\\_[OK] - baz\n"
277 "\t\t\t\\_[OK] - level3\n"
278 "\t\t\t\t\\_[OK] - level4\n"
279 "|foo=23s;;; baz=1024B;;; floatMe=1024.102400;;; \n";
280
281 // diag("Expected output of length: %i", strlen(expected));
282 // diag(expected);
283
284 ok(strcmp(output, expected) == 0, "Output is as expected");
285}
286
287void test_default_states1(void) {
288 mp_subcheck sc = mp_subcheck_init();
289
290 mp_state_enum state1 = mp_compute_subcheck_state(sc);
291 ok(state1 == STATE_UNKNOWN, "Default default state is Unknown");
292
293 sc = mp_set_subcheck_default_state(sc, STATE_CRITICAL);
294
295 mp_state_enum state2 = mp_compute_subcheck_state(sc);
296 ok(state2 == STATE_CRITICAL, "Default state is Critical");
297
298 sc = mp_set_subcheck_state(sc, STATE_OK);
299
300 mp_state_enum state3 = mp_compute_subcheck_state(sc);
301 ok(state3 == STATE_OK, "Default state is Critical");
302}
303
304void test_default_states2(void) {
305 mp_check check = mp_check_init();
306
307 mp_subcheck sc = mp_subcheck_init();
308 sc.output = "placeholder";
309 sc = mp_set_subcheck_default_state(sc, STATE_CRITICAL);
310
311 mp_add_subcheck_to_check(&check, sc);
312
313 mp_state_enum result_state = mp_compute_check_state(check);
314 ok(result_state == STATE_CRITICAL, "Derived state is the proper default state");
315}
diff --git a/lib/tests/test_generic_output.t b/lib/tests/test_generic_output.t
new file mode 100644
index 00000000..48c2ddf4
--- /dev/null
+++ b/lib/tests/test_generic_output.t
@@ -0,0 +1,6 @@
1#!/usr/bin/perl
2use Test::More;
3if (! -e "./test_generic_output") {
4 plan skip_all => "./test_generic_output not compiled - please enable libtap library to test";
5}
6exec "./test_generic_output";