teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

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

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