platform/tests: skip team test when we fail to create team link

This is necessary on Travis/Ubuntu 16.04, otherwise the test
fails with

  # NetworkManager-MESSAGE: <warn>  [1575301791.7600] platform-linux: do-add-link[nm-test-device/team]: failure 95 (Operation not supported)
  Aborted (core dumped)
  # test:ERROR:../src/platform/tests/test-link.c:353:test_software: assertion failed: (software_add (link_type, DEVICE_NAME))
  ERROR: src/platform/tests/test-link-linux - too few tests run (expected 76, got 6)
This commit is contained in:
Thomas Haller
2019-12-02 17:03:34 +01:00
parent 16223cff91
commit f7e3cc0b71

View File

@@ -463,9 +463,9 @@ _system (const char *cmd)
static void
test_bond (void)
{
if (nmtstp_is_root_test () &&
!g_file_test ("/proc/1/net/bonding", G_FILE_TEST_IS_DIR) &&
_system("modprobe --show bonding") != 0) {
if ( nmtstp_is_root_test ()
&& !g_file_test ("/proc/1/net/bonding", G_FILE_TEST_IS_DIR)
&& _system("modprobe --show bonding") != 0) {
g_test_skip ("Skipping test for bonding: bonding module not available");
return;
}
@@ -476,6 +476,20 @@ test_bond (void)
static void
test_team (void)
{
int r;
if (nmtstp_is_root_test ()) {
r = nm_platform_link_team_add (NM_PLATFORM_GET, "nm-team-check", NULL);
if (r < 0) {
g_assert_cmpint (r, ==, -EOPNOTSUPP);
g_test_skip ("Skipping test for teaming: team module not functioning");
return;
}
nmtstp_link_delete (NM_PLATFORM_GET, -1, -1, "nm-team-check", FALSE);
}
test_software (NM_LINK_TYPE_TEAM, "team");
}