summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/platform/tests/test-tc.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/platform/tests/test-tc.c b/src/platform/tests/test-tc.c
index 0c90fcfab6..702af8e25d 100644
--- a/src/platform/tests/test-tc.c
+++ b/src/platform/tests/test-tc.c
@@ -37,6 +37,21 @@ qdiscs_lookup (int ifindex)
NULL, NULL);
}
+static gboolean
+skip_tc_test (void)
+{
+ static int tc_found = -1;
+
+ if (tc_found == -1)
+ tc_found = (nmtstp_run_command ("tc >/dev/null 2>&1") == 0);
+
+ if (!tc_found) {
+ g_test_skip ("The 'tc' binary is not available");
+ return TRUE;
+ }
+ return FALSE;
+}
+
static void
test_qdisc1 (void)
{
@@ -46,6 +61,9 @@ test_qdisc1 (void)
NMPObject *obj;
NMPlatformQdisc *qdisc;
+ if (skip_tc_test ())
+ return;
+
ifindex = nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME);
g_assert_cmpint (ifindex, >, 0);
@@ -83,6 +101,9 @@ test_qdisc_fq_codel (void)
NMPObject *obj;
NMPlatformQdisc *qdisc;
+ if (skip_tc_test ())
+ return;
+
ifindex = nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME);
g_assert_cmpint (ifindex, >, 0);
@@ -122,6 +143,9 @@ test_qdisc_sfq (void)
NMPObject *obj;
NMPlatformQdisc *qdisc;
+ if (skip_tc_test ())
+ return;
+
ifindex = nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME);
g_assert_cmpint (ifindex, >, 0);
@@ -161,6 +185,9 @@ test_qdisc_tbf (void)
NMPObject *obj;
NMPlatformQdisc *qdisc;
+ if (skip_tc_test ())
+ return;
+
ifindex = nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME);
g_assert_cmpint (ifindex, >, 0);