diff options
Diffstat (limited to 'lib/tests/test_utils.c')
| -rw-r--r-- | lib/tests/test_utils.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/tests/test_utils.c b/lib/tests/test_utils.c index 7b10494c..a109e3f4 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 | |||
