richardphibel / rpms / systemd

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