|
|
52b84b |
From 35e9e01b2879854a2adb8d571d0204990cad38d9 Mon Sep 17 00:00:00 2001
|
|
|
be3800 |
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
|
|
be3800 |
Date: Fri, 14 Sep 2018 13:25:02 +0900
|
|
|
be3800 |
Subject: [PATCH] test: do not use global variable to pass error
|
|
|
be3800 |
|
|
|
be3800 |
(cherry picked from commit 0013fac248a15be3acce84c17a65e3ae0377294b)
|
|
|
be3800 |
|
|
|
52b84b |
Resolves: #1823767
|
|
|
be3800 |
---
|
|
|
be3800 |
test/TEST-21-SYSUSERS/test.sh | 1 +
|
|
|
be3800 |
test/test-functions | 8 +++++---
|
|
|
be3800 |
2 files changed, 6 insertions(+), 3 deletions(-)
|
|
|
be3800 |
|
|
|
be3800 |
diff --git a/test/TEST-21-SYSUSERS/test.sh b/test/TEST-21-SYSUSERS/test.sh
|
|
|
be3800 |
index 73cbe10b69..b1049e720d 100755
|
|
|
be3800 |
--- a/test/TEST-21-SYSUSERS/test.sh
|
|
|
be3800 |
+++ b/test/TEST-21-SYSUSERS/test.sh
|
|
|
be3800 |
@@ -15,6 +15,7 @@ prepare_testdir() {
|
|
|
be3800 |
for i in $1.initial-{passwd,group,shadow}; do
|
|
|
be3800 |
test -f $i && cp $i $TESTDIR/etc/${i#*.initial-}
|
|
|
be3800 |
done
|
|
|
be3800 |
+ return 0
|
|
|
be3800 |
}
|
|
|
be3800 |
|
|
|
be3800 |
preprocess() {
|
|
|
be3800 |
diff --git a/test/test-functions b/test/test-functions
|
|
|
be3800 |
index fe25a501da..da83891f46 100644
|
|
|
be3800 |
--- a/test/test-functions
|
|
|
be3800 |
+++ b/test/test-functions
|
|
|
be3800 |
@@ -449,7 +449,7 @@ EOF
|
|
|
be3800 |
}
|
|
|
be3800 |
|
|
|
be3800 |
check_result_nspawn() {
|
|
|
be3800 |
- ret=1
|
|
|
be3800 |
+ local ret=1
|
|
|
be3800 |
[[ -e $TESTDIR/$1/testok ]] && ret=0
|
|
|
be3800 |
[[ -f $TESTDIR/$1/failed ]] && cp -a $TESTDIR/$1/failed $TESTDIR
|
|
|
be3800 |
cp -a $TESTDIR/$1/var/log/journal $TESTDIR
|
|
|
be3800 |
@@ -462,7 +462,7 @@ check_result_nspawn() {
|
|
|
be3800 |
|
|
|
be3800 |
# can be overridden in specific test
|
|
|
be3800 |
check_result_qemu() {
|
|
|
be3800 |
- ret=1
|
|
|
be3800 |
+ local ret=1
|
|
|
be3800 |
mkdir -p $TESTDIR/root
|
|
|
be3800 |
mount ${LOOPDEV}p1 $TESTDIR/root
|
|
|
be3800 |
[[ -e $TESTDIR/root/testok ]] && ret=0
|
|
|
be3800 |
@@ -1527,7 +1527,9 @@ do_test() {
|
|
|
be3800 |
case $1 in
|
|
|
be3800 |
--run)
|
|
|
be3800 |
echo "TEST RUN: $TEST_DESCRIPTION"
|
|
|
be3800 |
- if test_run; then
|
|
|
be3800 |
+ test_run
|
|
|
be3800 |
+ ret=$?
|
|
|
be3800 |
+ if (( $ret == 0 )); then
|
|
|
be3800 |
echo "TEST RUN: $TEST_DESCRIPTION [OK]"
|
|
|
be3800 |
else
|
|
|
be3800 |
echo "TEST RUN: $TEST_DESCRIPTION [FAILED]"
|