diff options
author | Alyssa Ross <hi@alyssa.is> | 2022-02-21 17:38:19 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2022-02-21 17:38:19 +0000 |
commit | adbbaca29c0d0cbbbfb3693379d2593608fe293b (patch) | |
tree | 4ee7ec6b73330234972ef0fce7163837700e46db /host | |
parent | 2f381694caa61f5ba6172c773bdfdbf5f341bc38 (diff) | |
download | spectrum-adbbaca29c0d0cbbbfb3693379d2593608fe293b.tar spectrum-adbbaca29c0d0cbbbfb3693379d2593608fe293b.tar.gz spectrum-adbbaca29c0d0cbbbfb3693379d2593608fe293b.tar.bz2 spectrum-adbbaca29c0d0cbbbfb3693379d2593608fe293b.tar.lz spectrum-adbbaca29c0d0cbbbfb3693379d2593608fe293b.tar.xz spectrum-adbbaca29c0d0cbbbfb3693379d2593608fe293b.tar.zst spectrum-adbbaca29c0d0cbbbfb3693379d2593608fe293b.zip |
host/start-vm: skip tests if no /sys
Diffstat (limited to 'host')
-rw-r--r-- | host/start-vm/tests/bridge_add_if.c | 6 | ||||
-rw-r--r-- | host/start-vm/tests/bridge_remove_if.c | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/host/start-vm/tests/bridge_add_if.c b/host/start-vm/tests/bridge_add_if.c index adc9e59..4ca6809 100644 --- a/host/start-vm/tests/bridge_add_if.c +++ b/host/start-vm/tests/bridge_add_if.c @@ -19,8 +19,10 @@ int main(void) int r, tap; struct stat statbuf; - if (!unshare(CLONE_NEWUSER|CLONE_NEWNET|CLONE_NEWNS)) - assert(!mount("sysfs", "/sys", "sysfs", 0, NULL)); + if (!unshare(CLONE_NEWUSER|CLONE_NEWNET|CLONE_NEWNS)) { + if (mount("sysfs", "/sys", "sysfs", 0, NULL) == -1) + return errno == ENOENT ? 77 : 1; + } tap = tap_open(tap_name, 0); if (tap == -1) diff --git a/host/start-vm/tests/bridge_remove_if.c b/host/start-vm/tests/bridge_remove_if.c index ff66094..5ce61bd 100644 --- a/host/start-vm/tests/bridge_remove_if.c +++ b/host/start-vm/tests/bridge_remove_if.c @@ -19,8 +19,10 @@ int main(void) int r, tap; struct stat statbuf; - if (!unshare(CLONE_NEWUSER|CLONE_NEWNET|CLONE_NEWNS)) - assert(!mount("sysfs", "/sys", "sysfs", 0, NULL)); + if (!unshare(CLONE_NEWUSER|CLONE_NEWNET|CLONE_NEWNS)) { + if (mount("sysfs", "/sys", "sysfs", 0, NULL) == -1) + return errno == ENOENT ? 77 : 1; + } tap = tap_open(tap_name, 0); if (tap == -1) |