summaryrefslogtreecommitdiffstats
path: root/lib/tests
diff options
context:
space:
mode:
authorRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2023-10-15 16:17:36 (GMT)
committerRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2023-10-15 16:17:36 (GMT)
commit4b9d90f31c700298185aa4c7b20fe1c5e8bf19c2 (patch)
treede7e745ae5a8c81caa7c9f41be56a0747b4f106c /lib/tests
parentb1801c10846283176622db21974fe5003602630d (diff)
downloadmonitoring-plugins-4b9d90f31c700298185aa4c7b20fe1c5e8bf19c2.tar.gz
Whitespace fixes in lib
Diffstat (limited to 'lib/tests')
-rw-r--r--lib/tests/test_base64.c10
-rw-r--r--lib/tests/test_cmd.c10
-rw-r--r--lib/tests/test_disk.c18
-rw-r--r--lib/tests/test_ini1.c10
-rw-r--r--lib/tests/test_ini3.c10
-rw-r--r--lib/tests/test_opts2.c2
-rw-r--r--lib/tests/test_tcp.c14
-rw-r--r--lib/tests/test_utils.c21
8 files changed, 47 insertions, 48 deletions
diff --git a/lib/tests/test_base64.c b/lib/tests/test_base64.c
index 5103d10..05dd794 100644
--- a/lib/tests/test_base64.c
+++ b/lib/tests/test_base64.c
@@ -1,19 +1,19 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* This program is free software: you can redistribute it and/or modify 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 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 5* the Free Software Foundation, either version 3 of the License, or
6* (at your option) any later version. 6* (at your option) any later version.
7* 7*
8* This program is distributed in the hope that it will be useful, 8* This program is distributed in the hope that it will be useful,
9* but WITHOUT ANY WARRANTY; without even the implied warranty of 9* but WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details. 11* GNU General Public License for more details.
12* 12*
13* You should have received a copy of the GNU General Public License 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/>. 14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15* 15*
16* 16*
17*****************************************************************************/ 17*****************************************************************************/
18 18
19#include "common.h" 19#include "common.h"
diff --git a/lib/tests/test_cmd.c b/lib/tests/test_cmd.c
index 4bb60aa..02ae11f 100644
--- a/lib/tests/test_cmd.c
+++ b/lib/tests/test_cmd.c
@@ -1,19 +1,19 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* This program is free software: you can redistribute it and/or modify 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 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 5* the Free Software Foundation, either version 3 of the License, or
6* (at your option) any later version. 6* (at your option) any later version.
7* 7*
8* This program is distributed in the hope that it will be useful, 8* This program is distributed in the hope that it will be useful,
9* but WITHOUT ANY WARRANTY; without even the implied warranty of 9* but WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details. 11* GNU General Public License for more details.
12* 12*
13* You should have received a copy of the GNU General Public License 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/>. 14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15* 15*
16* 16*
17*****************************************************************************/ 17*****************************************************************************/
18 18
19#include "common.h" 19#include "common.h"
diff --git a/lib/tests/test_disk.c b/lib/tests/test_disk.c
index 9bd68c7..269d20b 100644
--- a/lib/tests/test_disk.c
+++ b/lib/tests/test_disk.c
@@ -1,19 +1,19 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* This program is free software: you can redistribute it and/or modify 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 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 5* the Free Software Foundation, either version 3 of the License, or
6* (at your option) any later version. 6* (at your option) any later version.
7* 7*
8* This program is distributed in the hope that it will be useful, 8* This program is distributed in the hope that it will be useful,
9* but WITHOUT ANY WARRANTY; without even the implied warranty of 9* but WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details. 11* GNU General Public License for more details.
12* 12*
13* You should have received a copy of the GNU General Public License 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/>. 14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15* 15*
16* 16*
17*****************************************************************************/ 17*****************************************************************************/
18 18
19#include "common.h" 19#include "common.h"
@@ -167,7 +167,7 @@ main (int argc, char **argv)
167 } 167 }
168 ok(found == 0, "first element successfully deleted"); 168 ok(found == 0, "first element successfully deleted");
169 found = 0; 169 found = 0;
170 170
171 p=paths; 171 p=paths;
172 while (p) { 172 while (p) {
173 if (! strcmp(p->name, "/tmp")) 173 if (! strcmp(p->name, "/tmp"))
@@ -203,9 +203,9 @@ main (int argc, char **argv)
203} 203}
204 204
205 205
206void 206void
207np_test_mount_entry_regex (struct mount_entry *dummy_mount_list, char *regstr, int cflags, int expect, char *desc) 207np_test_mount_entry_regex (struct mount_entry *dummy_mount_list, char *regstr, int cflags, int expect, char *desc)
208{ 208{
209 int matches = 0; 209 int matches = 0;
210 regex_t re; 210 regex_t re;
211 struct mount_entry *me; 211 struct mount_entry *me;
@@ -214,7 +214,7 @@ np_test_mount_entry_regex (struct mount_entry *dummy_mount_list, char *regstr, i
214 if(np_regex_match_mount_entry(me,&re)) 214 if(np_regex_match_mount_entry(me,&re))
215 matches++; 215 matches++;
216 } 216 }
217 ok( matches == expect, 217 ok( matches == expect,
218 "%s '%s' matched %i/3 entries. ok: %i/3", 218 "%s '%s' matched %i/3 entries. ok: %i/3",
219 desc, regstr, expect, matches); 219 desc, regstr, expect, matches);
220 220
diff --git a/lib/tests/test_ini1.c b/lib/tests/test_ini1.c
index 77f8854..6843bac 100644
--- a/lib/tests/test_ini1.c
+++ b/lib/tests/test_ini1.c
@@ -1,19 +1,19 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* This program is free software: you can redistribute it and/or modify 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 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 5* the Free Software Foundation, either version 3 of the License, or
6* (at your option) any later version. 6* (at your option) any later version.
7* 7*
8* This program is distributed in the hope that it will be useful, 8* This program is distributed in the hope that it will be useful,
9* but WITHOUT ANY WARRANTY; without even the implied warranty of 9* but WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details. 11* GNU General Public License for more details.
12* 12*
13* You should have received a copy of the GNU General Public License 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/>. 14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15* 15*
16* 16*
17*****************************************************************************/ 17*****************************************************************************/
18 18
19#include "common.h" 19#include "common.h"
diff --git a/lib/tests/test_ini3.c b/lib/tests/test_ini3.c
index 814b3ec..8a2a041 100644
--- a/lib/tests/test_ini3.c
+++ b/lib/tests/test_ini3.c
@@ -1,19 +1,19 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* This program is free software: you can redistribute it and/or modify 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 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 5* the Free Software Foundation, either version 3 of the License, or
6* (at your option) any later version. 6* (at your option) any later version.
7* 7*
8* This program is distributed in the hope that it will be useful, 8* This program is distributed in the hope that it will be useful,
9* but WITHOUT ANY WARRANTY; without even the implied warranty of 9* but WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details. 11* GNU General Public License for more details.
12* 12*
13* You should have received a copy of the GNU General Public License 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/>. 14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15* 15*
16* 16*
17*****************************************************************************/ 17*****************************************************************************/
18 18
19#include "parse_ini.h" 19#include "parse_ini.h"
diff --git a/lib/tests/test_opts2.c b/lib/tests/test_opts2.c
index c3d2067..780220e 100644
--- a/lib/tests/test_opts2.c
+++ b/lib/tests/test_opts2.c
@@ -12,7 +12,7 @@
12* 12*
13* You should have received a copy of the GNU General Public License 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/>. 14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15* 15*
16*****************************************************************************/ 16*****************************************************************************/
17 17
18#include "common.h" 18#include "common.h"
diff --git a/lib/tests/test_tcp.c b/lib/tests/test_tcp.c
index 114252b..1954b0f 100644
--- a/lib/tests/test_tcp.c
+++ b/lib/tests/test_tcp.c
@@ -1,19 +1,19 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* This program is free software: you can redistribute it and/or modify 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 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 5* the Free Software Foundation, either version 3 of the License, or
6* (at your option) any later version. 6* (at your option) any later version.
7* 7*
8* This program is distributed in the hope that it will be useful, 8* This program is distributed in the hope that it will be useful,
9* but WITHOUT ANY WARRANTY; without even the implied warranty of 9* but WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details. 11* GNU General Public License for more details.
12* 12*
13* You should have received a copy of the GNU General Public License 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/>. 14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15* 15*
16* 16*
17*****************************************************************************/ 17*****************************************************************************/
18 18
19#include "common.h" 19#include "common.h"
@@ -33,7 +33,7 @@ main(void)
33 server_expect[0] = strdup("AA"); 33 server_expect[0] = strdup("AA");
34 server_expect[1] = strdup("bb"); 34 server_expect[1] = strdup("bb");
35 server_expect[2] = strdup("CC"); 35 server_expect[2] = strdup("CC");
36 36
37 ok(np_expect_match("AA bb CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_SUCCESS, 37 ok(np_expect_match("AA bb CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_SUCCESS,
38 "Test matching any string at the beginning (first expect string)"); 38 "Test matching any string at the beginning (first expect string)");
39 ok(np_expect_match("bb AA CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_SUCCESS, 39 ok(np_expect_match("bb AA CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_SUCCESS,
@@ -52,7 +52,7 @@ main(void)
52 "Test not matching all strings"); 52 "Test not matching all strings");
53 ok(np_expect_match("XX XX", server_expect, server_expect_count, NP_MATCH_ALL) == NP_MATCH_RETRY, 53 ok(np_expect_match("XX XX", server_expect, server_expect_count, NP_MATCH_ALL) == NP_MATCH_RETRY,
54 "Test not matching any string (testing all)"); 54 "Test not matching any string (testing all)");
55 55
56 56
57 return exit_status(); 57 return exit_status();
58} 58}
diff --git a/lib/tests/test_utils.c b/lib/tests/test_utils.c
index 7b10494..a109e3f 100644
--- a/lib/tests/test_utils.c
+++ b/lib/tests/test_utils.c
@@ -1,19 +1,19 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* This program is free software: you can redistribute it and/or modify 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 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 5* the Free Software Foundation, either version 3 of the License, or
6* (at your option) any later version. 6* (at your option) any later version.
7* 7*
8* This program is distributed in the hope that it will be useful, 8* This program is distributed in the hope that it will be useful,
9* but WITHOUT ANY WARRANTY; without even the implied warranty of 9* but WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details. 11* GNU General Public License for more details.
12* 12*
13* You should have received a copy of the GNU General Public License 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/>. 14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15* 15*
16* 16*
17*****************************************************************************/ 17*****************************************************************************/
18 18
19#include "common.h" 19#include "common.h"
@@ -377,13 +377,13 @@ main (int argc, char **argv)
377 377
378/* 378/*
379 temp_fp = fopen("var/statefile", "r"); 379 temp_fp = fopen("var/statefile", "r");
380 if (temp_fp==NULL) 380 if (temp_fp==NULL)
381 printf("Error opening. errno=%d\n", errno); 381 printf("Error opening. errno=%d\n", errno);
382 printf("temp_fp=%s\n", temp_fp); 382 printf("temp_fp=%s\n", temp_fp);
383 ok( _np_state_read_file(temp_fp) == TRUE, "Can read state file" ); 383 ok( _np_state_read_file(temp_fp) == true, "Can read state file" );
384 fclose(temp_fp); 384 fclose(temp_fp);
385*/ 385*/
386 386
387 temp_state_key->_filename="var/statefile"; 387 temp_state_key->_filename="var/statefile";
388 temp_state_data = np_state_read(); 388 temp_state_data = np_state_read();
389 ok( this_monitoring_plugin->state->state_data!=NULL, "Got state data now" ) || diag("Are you running in right directory? Will get coredump next if not"); 389 ok( this_monitoring_plugin->state->state_data!=NULL, "Got state data now" ) || diag("Are you running in right directory? Will get coredump next if not");
@@ -446,14 +446,14 @@ main (int argc, char **argv)
446 /* Check time is set to current_time */ 446 /* Check time is set to current_time */
447 ok(system("cmp var/generated var/statefile > /dev/null")!=0, "Generated file should be different this time"); 447 ok(system("cmp var/generated var/statefile > /dev/null")!=0, "Generated file should be different this time");
448 ok(this_monitoring_plugin->state->state_data->time-current_time<=1, "Has time generated from current time"); 448 ok(this_monitoring_plugin->state->state_data->time-current_time<=1, "Has time generated from current time");
449 449
450 450
451 /* Don't know how to automatically test this. Need to be able to redefine die and catch the error */ 451 /* Don't know how to automatically test this. Need to be able to redefine die and catch the error */
452 /* 452 /*
453 temp_state_key->_filename="/dev/do/not/expect/to/be/able/to/write"; 453 temp_state_key->_filename="/dev/do/not/expect/to/be/able/to/write";
454 np_state_write_string(0, "Bad file"); 454 np_state_write_string(0, "Bad file");
455 */ 455 */
456 456
457 457
458 np_cleanup(); 458 np_cleanup();
459 459
@@ -508,4 +508,3 @@ main (int argc, char **argv)
508 508
509 return exit_status(); 509 return exit_status();
510} 510}
511