anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0105-test-don-t-overwrite-TESTDIR-if-already-set.patch

4bff0a
From 9cf9680910544638129bf083bca902881d9ab5bc Mon Sep 17 00:00:00 2001
4bff0a
From: Frantisek Sumsal <frantisek@sumsal.cz>
4bff0a
Date: Tue, 12 Mar 2019 22:44:25 +0100
4bff0a
Subject: [PATCH] test: don't overwrite TESTDIR if already set
4bff0a
4bff0a
(cherry picked from commit 3f50fff536d715aee5e5195ec60e2af047b73c7f)
4bff0a
---
4bff0a
 test/test-functions | 9 +++++++--
4bff0a
 1 file changed, 7 insertions(+), 2 deletions(-)
4bff0a
4bff0a
diff --git a/test/test-functions b/test/test-functions
4bff0a
index 670c2625f7..af9d16140f 100644
4bff0a
--- a/test/test-functions
4bff0a
+++ b/test/test-functions
4bff0a
@@ -711,8 +711,13 @@ inst_libs() {
4bff0a
 
4bff0a
 import_testdir() {
4bff0a
     [[ -e $STATEFILE ]] && . $STATEFILE
4bff0a
-    if [[ -z "$TESTDIR" ]] || [[ ! -d "$TESTDIR" ]]; then
4bff0a
-        TESTDIR=$(mktemp --tmpdir=/var/tmp -d -t systemd-test.XXXXXX)
4bff0a
+    if [[ ! -d "$TESTDIR" ]]; then
4bff0a
+        if [[ -z "$TESTDIR" ]]; then
4bff0a
+            TESTDIR=$(mktemp --tmpdir=/var/tmp -d -t systemd-test.XXXXXX)
4bff0a
+        else
4bff0a
+            mkdir -p "$TESTDIR"
4bff0a
+        fi
4bff0a
+
4bff0a
         echo "TESTDIR=\"$TESTDIR\"" > $STATEFILE
4bff0a
         export TESTDIR
4bff0a
     fi