summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/test/test-execute.c6
-rw-r--r--test/meson.build3
-rw-r--r--test/test-execute/exec-systemcallerrornumber-name.service (renamed from test/test-execute/exec-systemcallerrornumber.service)2
-rw-r--r--test/test-execute/exec-systemcallerrornumber-number.service8
4 files changed, 15 insertions, 4 deletions
diff --git a/src/test/test-execute.c b/src/test/test-execute.c
index c86e074e9d..998724189f 100644
--- a/src/test/test-execute.c
+++ b/src/test/test-execute.c
@@ -270,8 +270,10 @@ static void test_exec_systemcallfilter(Manager *m) {
static void test_exec_systemcallerrornumber(Manager *m) {
#if HAVE_SECCOMP
- if (is_seccomp_available())
- test(m, "exec-systemcallerrornumber.service", 1, CLD_EXITED);
+ if (!is_seccomp_available())
+ return;
+ test(m, "exec-systemcallerrornumber-name.service", errno_from_name("EACCES"), CLD_EXITED);
+ test(m, "exec-systemcallerrornumber-number.service", 255, CLD_EXITED);
#endif
}
diff --git a/test/meson.build b/test/meson.build
index 941878dea4..69d6c758b0 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -100,7 +100,8 @@ test_data_files = '''
test-execute/exec-supplementarygroups-single-group-user.service
test-execute/exec-supplementarygroups-single-group.service
test-execute/exec-supplementarygroups.service
- test-execute/exec-systemcallerrornumber.service
+ test-execute/exec-systemcallerrornumber-name.service
+ test-execute/exec-systemcallerrornumber-number.service
test-execute/exec-systemcallfilter-failing.service
test-execute/exec-systemcallfilter-failing2.service
test-execute/exec-systemcallfilter-not-failing.service
diff --git a/test/test-execute/exec-systemcallerrornumber.service b/test/test-execute/exec-systemcallerrornumber-name.service
index ff7da3c1a4..229b862794 100644
--- a/test/test-execute/exec-systemcallerrornumber.service
+++ b/test/test-execute/exec-systemcallerrornumber-name.service
@@ -2,7 +2,7 @@
Description=Test for SystemCallErrorNumber
[Service]
-ExecStart=/bin/sh -x -c 'uname -a'
+ExecStart=/bin/python3 -c 'import os\ntry: os.uname()\nexcept Exception as e: exit(e.errno)'
Type=oneshot
SystemCallFilter=~uname
SystemCallErrorNumber=EACCES
diff --git a/test/test-execute/exec-systemcallerrornumber-number.service b/test/test-execute/exec-systemcallerrornumber-number.service
new file mode 100644
index 0000000000..2e13f08bf5
--- /dev/null
+++ b/test/test-execute/exec-systemcallerrornumber-number.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Test for SystemCallErrorNumber
+
+[Service]
+ExecStart=/bin/python3 -c 'import os\ntry: os.uname()\nexcept Exception as e: exit(e.errno)'
+Type=oneshot
+SystemCallFilter=~uname
+SystemCallErrorNumber=255