]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: don't expect that clone() always makes it to the kernel
authorLennart Poettering <lennart@poettering.net>
Fri, 4 Jun 2021 08:35:43 +0000 (10:35 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 4 Jun 2021 11:38:00 +0000 (13:38 +0200)
We might get EPERM on certain clone() flag combinations. Apparently in
Docker for example.

Prompted by: https://github.com/systemd/systemd/pull/19800#issuecomment-854196491

src/test/test-util.c

index 0fe7a381c708ee6e827f17a5f3955e799a0c9d75..3eef2c30198dfd1bb1a1b7bb4d2713ebc9c2a06f 100644 (file)
@@ -316,7 +316,7 @@ static void test_raw_clone(void) {
 
         errno = 0;
         assert_se(raw_clone(CLONE_FS|CLONE_NEWNS) == -1);
-        assert_se(errno == EINVAL);
+        assert_se(errno == EINVAL || ERRNO_IS_PRIVILEGE(errno)); /* Certain container environments prohibit namespaces to us, don't fail in that case */
 }
 
 static void test_physical_memory(void) {