summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2006-10-18 12:05:10 (GMT)
committerTon Voon <tonvoon@users.sourceforge.net>2006-10-18 12:05:10 (GMT)
commit450ad346edcf2304087ffa74a46eef274336c16b (patch)
tree02855674d2d5c1f891095e25be4f8818e8bdfed8 /lib
parentc56c42b9c999742ff3cfebf1cadc8c93ad68048c (diff)
downloadmonitoring-plugins-450ad346edcf2304087ffa74a46eef274336c16b.tar.gz
Fix tests for exact matches when searching filesystems
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1497 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'lib')
-rw-r--r--lib/tests/test_disk.c13
-rw-r--r--lib/utils_disk.h1
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/tests/test_disk.c b/lib/tests/test_disk.c
index 8940236..e48b30a 100644
--- a/lib/tests/test_disk.c
+++ b/lib/tests/test_disk.c
@@ -36,7 +36,7 @@ main (int argc, char **argv)
36 struct mount_entry *me; 36 struct mount_entry *me;
37 struct mount_entry **mtail = &dummy_mount_list; 37 struct mount_entry **mtail = &dummy_mount_list;
38 38
39 plan_tests(17); 39 plan_tests(18);
40 40
41 ok( np_find_name(exclude_filesystem, "/var/log") == FALSE, "/var/log not in list"); 41 ok( np_find_name(exclude_filesystem, "/var/log") == FALSE, "/var/log not in list");
42 np_add_name(&exclude_filesystem, "/var/log"); 42 np_add_name(&exclude_filesystem, "/var/log");
@@ -105,17 +105,20 @@ main (int argc, char **argv)
105 np_add_parameter(&paths, "/var"); 105 np_add_parameter(&paths, "/var");
106 np_add_parameter(&paths, "/tmp"); 106 np_add_parameter(&paths, "/tmp");
107 np_add_parameter(&paths, "/home/tonvoon"); 107 np_add_parameter(&paths, "/home/tonvoon");
108 np_add_parameter(&paths, "/home");
108 109
109 np_set_best_match(paths, dummy_mount_list, TRUE); 110 np_set_best_match(paths, dummy_mount_list, TRUE);
110 for (p = paths; p; p = p->name_next) { 111 for (p = paths; p; p = p->name_next) {
111 if (! strcmp(p->name, "/home/groups")) { 112 if (! strcmp(p->name, "/home/groups")) {
112 ok( p->found == 0, "/home/groups correctly not found"); 113 ok( ! p->best_match , "/home/groups correctly not found");
113 } else if (! strcmp(p->name, "/var")) { 114 } else if (! strcmp(p->name, "/var")) {
114 ok( p->found == 1, "/var found"); 115 ok( p->best_match, "/var found");
115 } else if (! strcmp(p->name, "/tmp")) { 116 } else if (! strcmp(p->name, "/tmp")) {
116 ok( p->found == 0, "/tmp correctly not found"); 117 ok(! p->best_match, "/tmp correctly not found");
117 } else if (! strcmp(p->name, "/home/tonvoon")) { 118 } else if (! strcmp(p->name, "/home/tonvoon")) {
118 ok( p->found == 0, "/home/tonvoon not found"); 119 ok(! p->best_match, "/home/tonvoon not found");
120 } else if (! strcmp(p->name, "/home")) {
121 ok( p->best_match, "/home found");
119 } 122 }
120 } 123 }
121 124
diff --git a/lib/utils_disk.h b/lib/utils_disk.h
index 928fdbe..700f5d2 100644
--- a/lib/utils_disk.h
+++ b/lib/utils_disk.h
@@ -12,7 +12,6 @@ struct name_list
12struct parameter_list 12struct parameter_list
13{ 13{
14 char *name; 14 char *name;
15 int found;
16 thresholds *freespace_bytes; 15 thresholds *freespace_bytes;
17 thresholds *freespace_units; 16 thresholds *freespace_units;
18 thresholds *freespace_percent; 17 thresholds *freespace_percent;