naccyde / rpms / systemd

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