summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2013-09-06 10:12:55 -0400
committerAnand Avati <avati@redhat.com>2013-09-10 13:39:42 -0700
commit4c4aaa5abf68d4da8e3c626ab7a469b81354b9e2 (patch)
treeff7d8521308570198bf7e9e6ea497fec98138390
parentc05cd5a392efb382fc726c55f507beeedc824b02 (diff)
tests/basic/rpm.t: run mock builds in parallel
save about six minutes per regression by building in parallel Change-Id: Iaf6fa545e20b0322b10e9e4ab7cc3d4254a0ece5 BUG: 1006269 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/5845 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
-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 ef4b5ab..d7f40d3 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