summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtests/basic/rpm.t27
1 files changed, 17 insertions, 10 deletions
diff --git a/tests/basic/rpm.t b/tests/basic/rpm.t
index ef4b5abf0cb..d7f40d32b97 100755
--- a/tests/basic/rpm.t
+++ b/tests/basic/rpm.t
@@ -22,6 +22,8 @@ fi
# check for changed files
CHANGED_FILES=$(git diff --name-only ${GIT_PARENT})
+# if a commit changes this test, we should not skip it
+SELFTEST=$(grep -e 'tests/basic/rpm.t' <<< "${CHANGED_FILES}")
# filter out any files not affecting the build itself
CHANGED_FILES=$(grep -E -v \
-e '\.c$' \
@@ -29,9 +31,9 @@ CHANGED_FILES=$(grep -E -v \
-e '\.py$' \
-e '^tests/' \
<<< "${CHANGED_FILES}")
-if [ -z "${CHANGED_FILES}" ]
+if [ -z "${CHANGED_FILES}" -a -z "${SELFTEST}" ]
then
- # only contents of files were changed, no need to retest rpmbuild
+ # nothing affecting packaging changed, no need to retest rpmbuild
SKIP_TESTS
rm -rf ${RESULT_DIR}
cleanup
@@ -55,12 +57,10 @@ TEST make dist
ls extras
TEST make -C extras/LinuxRPM testsrpm
-chmod g=rwx ${RESULT_DIR}
+chmod 0777 ${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)
@@ -68,9 +68,9 @@ do
chmod g=rwx ${RESULT_DIR}/${EPEL_RELEASE}
chown :mock ${RESULT_DIR}/${EPEL_RELEASE}
# expand the mock command line
- MOCK_CMD=$(echo /usr/bin/mock --cleanup-after \
+ MOCK_CMD="/usr/bin/mock --cleanup-after \
--resultdir=${RESULT_DIR}/${EPEL_RELEASE} \
- -r ${EPEL_RELEASE} --rebuild ${PWD}/*.src.rpm)
+ -r ${EPEL_RELEASE} --rebuild ${PWD}/*.src.rpm"
# write the mock command to a file, so that its easier to execute
cat << EOF > ${RESULT_DIR}/${EPEL_RELEASE}/mock.sh
@@ -83,14 +83,21 @@ EOF
if (groups | grep -q mock)
then
# the current user is in group 'mock'
- RUNMOCK="${RESULT_DIR}/${EPEL_RELEASE}/mock.sh"
+ ${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
- RUNMOCK="sudo -u mock -E ${RESULT_DIR}/${EPEL_RELEASE}/mock.sh"
+ sudo -u mock -E ${RESULT_DIR}/${EPEL_RELEASE}/mock.sh &
fi
- TEST_IN_LOOP ${RUNMOCK}
+ sleep 5
+done
+
+# TAP and Prove aren't smart about loops
+TESTS_EXPECTED_IN_LOOP=2
+for mockjob in $(jobs -p)
+do
+ TEST_IN_LOOP wait ${mockjob}
done
# we could build for the last two Fedora releases too, but that is not