summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-03-26 12:10:32 +0100
committerThomas Haller <thaller@redhat.com>2015-04-08 14:39:16 +0200
commit5fd3827e49af9ce7e1ebac35a9471aaca04b2bc0 (patch)
tree43566f4fb17f4f36a60892a3e8cfd9add2e2b825
parentcdd3e1c30277a4647d40714e8d46c0e983aae689 (diff)
downloadNetworkManager-5fd3827e49af9ce7e1ebac35a9471aaca04b2bc0.tar.gz
route-manager/test: fix usage of g_assert_expect_message()
Tests that use g_assert_expect_message() must initialize with nmtst_init_assert_logging(). Otherwise, the caller can change the logging level via NMTST_DEBUG=log-level=DEBUG,log-domains=DEFAULT which breaks the assertions. nmtst_init_assert_logging() allows the caller to turn of checking of assertions via NMTST_DEBUG=log-level=DEBUG,log-domains=DEFAULT,no-expect-message Also, don't use g_message() in platform tests otherwise the test fail because nmtst now sets g_log_set_always_fatal().
-rw-r--r--src/platform/tests/test-common.c4
-rw-r--r--src/tests/test-route-manager.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/platform/tests/test-common.c b/src/platform/tests/test-common.c
index 5194580dca..1980282dc8 100644
--- a/src/platform/tests/test-common.c
+++ b/src/platform/tests/test-common.c
@@ -263,10 +263,10 @@ main (int argc, char **argv)
nmtst_reexec_sudo ();
#ifdef REQUIRE_ROOT_TESTS
- g_message ("Fail test: requires root privileges (%s)", program);
+ g_print ("Fail test: requires root privileges (%s)\n", program);
return EXIT_FAILURE;
#else
- g_message ("Skipping test: requires root privileges (%s)", program);
+ g_print ("Skipping test: requires root privileges (%s)\n", program);
return 77;
#endif
}
diff --git a/src/tests/test-route-manager.c b/src/tests/test-route-manager.c
index 9b4f6d800d..ab1faeb9fa 100644
--- a/src/tests/test-route-manager.c
+++ b/src/tests/test-route-manager.c
@@ -676,7 +676,7 @@ fixture_teardown (test_fixture *fixture, gconstpointer user_data)
void
init_tests (int *argc, char ***argv)
{
- nmtst_init_with_logging (argc, argv, NULL, "ALL");
+ nmtst_init_assert_logging (argc, argv, "WARN", "ALL");
}
void