teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone

Blame SOURCES/0363-test-execute-also-check-python3-is-installed-or-not.patch

c2dfb7
From a3a3d861496b8c0d061c6ba21278d0326c50f37d Mon Sep 17 00:00:00 2001
c2dfb7
From: Yu Watanabe <watanabe.yu+github@gmail.com>
c2dfb7
Date: Wed, 12 Sep 2018 18:18:33 +0900
c2dfb7
Subject: [PATCH] test-execute: also check python3 is installed or not
c2dfb7
c2dfb7
(cherry picked from commit 738c74d7b163ea18e3c68115c3ed8ceed166cbf7)
c2dfb7
c2dfb7
Resolves: #1823767
c2dfb7
---
c2dfb7
 src/test/test-execute.c | 17 +++++++++++++++++
c2dfb7
 1 file changed, 17 insertions(+)
c2dfb7
c2dfb7
diff --git a/src/test/test-execute.c b/src/test/test-execute.c
c2dfb7
index 6c22995b1e..af64427bc7 100644
c2dfb7
--- a/src/test/test-execute.c
c2dfb7
+++ b/src/test/test-execute.c
c2dfb7
@@ -317,6 +317,8 @@ static void test_exec_temporaryfilesystem(Manager *m) {
c2dfb7
 
c2dfb7
 static void test_exec_systemcallfilter(Manager *m) {
c2dfb7
 #if HAVE_SECCOMP
c2dfb7
+        int r;
c2dfb7
+
c2dfb7
         if (!is_seccomp_available()) {
c2dfb7
                 log_notice("Seccomp not available, skipping %s", __func__);
c2dfb7
                 return;
c2dfb7
@@ -326,6 +328,13 @@ static void test_exec_systemcallfilter(Manager *m) {
c2dfb7
         test(m, "exec-systemcallfilter-not-failing2.service", 0, CLD_EXITED);
c2dfb7
         test(m, "exec-systemcallfilter-failing.service", SIGSYS, CLD_KILLED);
c2dfb7
         test(m, "exec-systemcallfilter-failing2.service", SIGSYS, CLD_KILLED);
c2dfb7
+
c2dfb7
+        r = find_binary("python3", NULL);
c2dfb7
+        if (r < 0) {
c2dfb7
+                log_notice_errno(r, "Skipping remaining tests in %s, could not find python3 binary: %m", __func__);
c2dfb7
+                return;
c2dfb7
+        }
c2dfb7
+
c2dfb7
         test(m, "exec-systemcallfilter-with-errno-name.service", errno_from_name("EILSEQ"), CLD_EXITED);
c2dfb7
         test(m, "exec-systemcallfilter-with-errno-number.service", 255, CLD_EXITED);
c2dfb7
 #endif
c2dfb7
@@ -333,11 +342,19 @@ static void test_exec_systemcallfilter(Manager *m) {
c2dfb7
 
c2dfb7
 static void test_exec_systemcallerrornumber(Manager *m) {
c2dfb7
 #if HAVE_SECCOMP
c2dfb7
+        int r;
c2dfb7
+
c2dfb7
         if (!is_seccomp_available()) {
c2dfb7
                 log_notice("Seccomp not available, skipping %s", __func__);
c2dfb7
                 return;
c2dfb7
         }
c2dfb7
 
c2dfb7
+        r = find_binary("python3", NULL);
c2dfb7
+        if (r < 0) {
c2dfb7
+                log_notice_errno(r, "Skipping %s, could not find python3 binary: %m", __func__);
c2dfb7
+                return;
c2dfb7
+        }
c2dfb7
+
c2dfb7
         test(m, "exec-systemcallerrornumber-name.service", errno_from_name("EACCES"), CLD_EXITED);
c2dfb7
         test(m, "exec-systemcallerrornumber-number.service", 255, CLD_EXITED);
c2dfb7
 #endif