From 8fe12aa362ece271e6c5a7bfa0d39c9e1ebcc70e Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 30 Apr 2015 12:31:39 +0200 Subject: fixup! rdisc: split fake & linux test code; add testcases --- src/rdisc/tests/test-rdisc-linux.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/rdisc/tests/test-rdisc-linux.c b/src/rdisc/tests/test-rdisc-linux.c index 7ee6d977c5..9b2ccafd67 100644 --- a/src/rdisc/tests/test-rdisc-linux.c +++ b/src/rdisc/tests/test-rdisc-linux.c @@ -43,6 +43,11 @@ main (int argc, char **argv) nmtst_init_with_logging (&argc, &argv, NULL, "DEFAULT"); + if (getuid () != 0) { + g_print ("Missing permission: must run as root\n"); + return EXIT_FAILURE; + } + loop = g_main_loop_new (NULL, FALSE); nm_linux_platform_setup (); @@ -51,13 +56,15 @@ main (int argc, char **argv) ifname = argv[1]; ifindex = nm_platform_link_get_ifindex (ifname); } else { - ifindex = 1; - ifname = nm_platform_link_get_name (ifindex); + g_print ("Missing command line argument \"interface-name\"\n"); + return EXIT_FAILURE; } rdisc = nm_lndp_rdisc_new (ifindex, ifname); - if (!rdisc) + if (!rdisc) { + g_print ("Failed to create NMRDisc instance\n"); return EXIT_FAILURE; + } nm_rdisc_start (rdisc); g_main_loop_run (loop); -- cgit v1.2.1