summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/basic/rpm.t7
-rw-r--r--tests/include.rc20
2 files changed, 24 insertions, 3 deletions
diff --git a/tests/basic/rpm.t b/tests/basic/rpm.t
index 560d9f8b81b..15963e190e1 100755
--- a/tests/basic/rpm.t
+++ b/tests/basic/rpm.t
@@ -58,6 +58,8 @@ chmod g=rwx ${RESULT_DIR}
chown :mock ${RESULT_DIR}
# build for the last two Fedora EPEL releases (x86_64 only)
+# TAP/Prove aren't smart about loops
+TESTS_EXPECTED_IN_LOOP=2
for MOCK_CONF in $(ls -x1 /etc/mock/*.cfg | egrep -e 'epel-[0-9]+-x86_64.cfg$' | tail -n2)
do
EPEL_RELEASE=$(basename ${MOCK_CONF} .cfg)
@@ -80,13 +82,14 @@ EOF
if (groups | grep -q mock)
then
# the current user is in group 'mock'
- TEST ${RESULT_DIR}/${EPEL_RELEASE}/mock.sh
+ RUNMOCK="${RESULT_DIR}/${EPEL_RELEASE}/mock.sh"
else
# switch to the user called 'mock'
chown mock:mock ${RESULT_DIR}/${EPEL_RELEASE}
# "su" might not work, using sudo instead
- TEST sudo -u mock -E ${RESULT_DIR}/${EPEL_RELEASE}/mock.sh
+ RUNMOCK="sudo -u mock -E ${RESULT_DIR}/${EPEL_RELEASE}/mock.sh"
fi
+ TEST_IN_LOOP ${RUNMOCK}
done
# we could build for the last two Fedora releases too, but that is not
diff --git a/tests/include.rc b/tests/include.rc
index 4008ad36f0c..bb541eaa1e4 100644
--- a/tests/include.rc
+++ b/tests/include.rc
@@ -14,7 +14,17 @@ mkdir -p $B0;
mkdir -p $M0 $M1;
mkdir -p $N0 $N1;
-testcnt=`egrep '^[[:space:]]*(EXPECT|TEST|EXPECT_WITHIN|EXPECT_KEYWORD)' $0 | wc -l`;
+testcnt=`egrep '^[[:space:]]*(EXPECT|TEST|EXPECT_WITHIN|EXPECT_KEYWORD)[[:space:]]' $0 | wc -l`
+expect_tests=`egrep '^[[:space:]]*TESTS_EXPECTED_IN_LOOP[[:space:]]*' $0`
+
+x_ifs=$IFS
+IFS=$'\n'
+for line in $expect_tests; do
+ expect_tests=`echo $line | cut -f 2 -d =`
+ testcnt=`expr $testcnt + $expect_tests`
+done
+IFS=$x_ifs
+
echo 1..$testcnt
t=1
@@ -164,6 +174,13 @@ function SKIP_TESTS()
}
+function _TEST_IN_LOOP()
+{
+ testcnt=`expr $testcnt + 1`;
+ _TEST $@
+}
+
+
function cleanup()
{
killall -15 glusterfs glusterfsd glusterd 2>/dev/null || true;
@@ -224,4 +241,5 @@ alias EXPECT='_EXPECT $LINENO'
alias TEST='_TEST $LINENO'
alias EXPECT_WITHIN='_EXPECT_WITHIN $LINENO'
alias EXPECT_KEYWORD='_EXPECT_KEYWORD $LINENO'
+alias TEST_IN_LOOP='_TEST_IN_LOOP $LINENO'
shopt -s expand_aliases