From ffe5a1b6e0ab86e251c1b2cb3af91804c7a63ac4 Mon Sep 17 00:00:00 2001 From: Teemu Toivola Date: Sun, 17 Aug 2014 02:04:59 +0300 Subject: [PATCH] disable some tests on non-Linux systems, mostly due to use of /proc --- tests/daemon_tests.c | 12 +++++++++++- tests/database_tests.c | 2 ++ tests/ifinfo_tests.c | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/daemon_tests.c b/tests/daemon_tests.c index 8b26507..13112c1 100644 --- a/tests/daemon_tests.c +++ b/tests/daemon_tests.c @@ -34,7 +34,11 @@ END_TEST START_TEST(getgroup_root_string) { +#if defined(__linux__) ck_assert_int_eq((int)getgroup("root"), 0); +#else + ck_assert_int_eq((int)getgroup("wheel"), 0); +#endif } END_TEST @@ -742,12 +746,14 @@ void add_daemon_tests(Suite *s) tcase_add_exit_test(tc_daemon, getgroup_no_such_user_string, 1); tcase_add_exit_test(tc_daemon, getgroup_no_such_user_numeric, 1); tcase_add_test(tc_daemon, debugtimestamp_does_not_exit); + tcase_add_test(tc_daemon, initdstate_does_not_crash); +#if defined(__linux__) tcase_add_test(tc_daemon, addinterfaces_does_nothing_with_no_files); tcase_add_test(tc_daemon, addinterfaces_adds_interfaces); - tcase_add_test(tc_daemon, initdstate_does_not_crash); tcase_add_exit_test(tc_daemon, preparedatabases_exits_with_no_database_dir, 1); tcase_add_exit_test(tc_daemon, preparedatabases_exits_with_no_databases, 1); tcase_add_test(tc_daemon, preparedatabases_with_no_databases_creates_databases); +#endif tcase_add_test(tc_daemon, setsignaltraps_does_not_exit); tcase_add_exit_test(tc_daemon, filldatabaselist_exits_with_no_database_dir, 1); tcase_add_test(tc_daemon, filldatabaselist_does_not_exit_with_empty_database_dir); @@ -759,10 +765,12 @@ void add_daemon_tests(Suite *s) tcase_add_test(tc_daemon, checkdbsaveneed_needs); tcase_add_test(tc_daemon, datalist_cacheget_with_no_database); tcase_add_test(tc_daemon, datalist_cacheget_with_database); +#if defined(__linux__) tcase_add_test(tc_daemon, datalist_getifinfo_with_disabled_interface); tcase_add_test(tc_daemon, datalist_getifinfo_with_enabled_unavailable_interface); tcase_add_test(tc_daemon, datalist_getifinfo_with_interface_sync); tcase_add_test(tc_daemon, datalist_getifinfo_with_interface_and_no_sync); +#endif tcase_add_test(tc_daemon, datalist_timevalidation_in_normal_time); tcase_add_test(tc_daemon, datalist_timevalidation_in_future_time); tcase_add_exit_test(tc_daemon, datalist_timevalidation_in_too_future_time, 1); @@ -770,7 +778,9 @@ void add_daemon_tests(Suite *s) tcase_add_test(tc_daemon, datalist_writedb_detects_missing_database_file); tcase_add_test(tc_daemon, datalist_writedb_writes_database_file); tcase_add_test(tc_daemon, processdatalist_empty_does_nothing); +#if defined(__linux__) tcase_add_test(tc_daemon, processdatalist_filled_does_things); +#endif tcase_add_test(tc_daemon, handleintsignals_handles_signals); tcase_add_test(tc_daemon, direxists_with_no_dir); tcase_add_test(tc_daemon, direxists_with_dir); diff --git a/tests/database_tests.c b/tests/database_tests.c index 35dbe43..45e63c0 100644 --- a/tests/database_tests.c +++ b/tests/database_tests.c @@ -972,10 +972,12 @@ void add_database_tests(Suite *s) tcase_add_test(tc_db, validatedb_with_initdb); tcase_add_test(tc_db, validatedb_with_invalid_totals); tcase_add_test(tc_db, validatedb_with_top10_use); +#if defined(__linux__) tcase_add_test(tc_db, dbcheck_with_no_interfaces); tcase_add_test(tc_db, dbcheck_with_empty_cache); tcase_add_test(tc_db, dbcheck_with_no_changes_in_iflist); tcase_add_test(tc_db, dbcheck_with_filled_cache); +#endif tcase_add_test(tc_db, importdb_can_parse_exported_database); tcase_add_test(tc_db, database_outputs_do_not_crash); suite_add_tcase(s, tc_db); diff --git a/tests/ifinfo_tests.c b/tests/ifinfo_tests.c index c3784d8..c2bd713 100644 --- a/tests/ifinfo_tests.c +++ b/tests/ifinfo_tests.c @@ -469,6 +469,7 @@ void add_ifinfo_tests(Suite *s) tcase_add_test(tc_ifinfo, parseifinfo_long_update_interval_causes_sync); tcase_add_test(tc_ifinfo, parseifinfo_hitting_maxbw_limit_causes_sync); tcase_add_test(tc_ifinfo, parseifinfo_multiple_parses); +#if defined(__linux__) tcase_add_test(tc_ifinfo, getiflist_no_source); tcase_add_test(tc_ifinfo, getiflist_one_interface); tcase_add_test(tc_ifinfo, getiflist_multiple_interfaces); @@ -477,5 +478,6 @@ void add_ifinfo_tests(Suite *s) tcase_add_test(tc_ifinfo, readproc_success); tcase_add_test(tc_ifinfo, getifinfo_not_found); tcase_add_test(tc_ifinfo, getifinfo_success); +#endif suite_add_tcase(s, tc_ifinfo); } -- 2.40.0