]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-udev: Skip running in container
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 27 May 2023 10:21:19 +0000 (12:21 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 30 May 2023 12:48:38 +0000 (14:48 +0200)
Containers generally don't have permission to mknod() which is
required by test-udev so let's skip the test as well if we detect
we're running in a container.

test/test-udev.py

index 7e9afc4fc8a1fae89aa71bbd7ffdceb3af0bb912..710aaed3a9b805f3a8ee2c9ab70526e85748bc0f 100755 (executable)
@@ -2346,6 +2346,12 @@ def environment_issue():
                        check=False)
     if c.returncode == 0:
         return 'Running in a chroot, skipping the test'
+
+    c = subprocess.run(['systemd-detect-virt', '-c', '-q'],
+                       check=False)
+    if c.returncode == 0:
+        return 'Running in a container, skipping the test'
+
     return None