platform/tests: use "nm-test-utils.h" in "monitor.c"

This gives us a way to externally configure the logging level like:

  NMTST_DEBUG=log-level=TRACE ./src/platform/tests/monitor
This commit is contained in:
Thomas Haller
2015-10-16 10:23:31 +02:00
parent d55f19e4c4
commit ca8e40e1dc

View File

@@ -4,25 +4,27 @@
#include <syslog.h> #include <syslog.h>
#include "nm-default.h" #include "nm-default.h"
#include "nm-fake-platform.h"
#include "nm-linux-platform.h" #include "nm-linux-platform.h"
#include "nm-test-utils.h"
NMTST_DEFINE ();
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
GMainLoop *loop; GMainLoop *loop;
nm_g_type_init (); if (!g_getenv ("G_MESSAGES_DEBUG"))
g_setenv ("G_MESSAGES_DEBUG", "all", TRUE);
nmtst_init_with_logging (&argc, &argv, "DEBUG", "ALL");
nm_log_info (LOGD_PLATFORM, "platform monitor start");
loop = g_main_loop_new (NULL, FALSE); loop = g_main_loop_new (NULL, FALSE);
nm_logging_setup ("debug", NULL, NULL, NULL);
openlog (G_LOG_DOMAIN, LOG_CONS | LOG_PERROR, LOG_DAEMON);
g_assert (argc <= 2); nm_linux_platform_setup ();
if (argc > 1 && !g_strcmp0 (argv[1], "--fake"))
nm_fake_platform_setup ();
else
nm_linux_platform_setup ();
g_main_loop_run (loop); g_main_loop_run (loop);