summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-04-30 12:31:39 +0200
committerThomas Haller <thaller@redhat.com>2015-04-30 12:43:09 +0200
commit8fe12aa362ece271e6c5a7bfa0d39c9e1ebcc70e (patch)
treecb44309ec7f60de102a5d44ef352b3f5530f7348
parent0f47785e4796881321ad89582287ba864dd9846a (diff)
downloadNetworkManager-dcbw/rh1207730-rdisc-fixes.tar.gz
fixup! rdisc: split fake & linux test code; add testcasesdcbw/rh1207730-rdisc-fixes
-rw-r--r--src/rdisc/tests/test-rdisc-linux.c13
1 files 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);