tests/compose: Various fixes

- Actually use separate `${test_tmpdir}` for test setup (closes a race)
 - Merge stdout/stderr (more readable)
 - Ensure logs are renamed to `.txt` even on failure
 - Use `--progress` for some feedback
 - Use `-j +1` so that even on unicore machines we get at least 2
   jobs (and in general NCPUS+1)

Closes: #1188
Approved by: jlebon
This commit is contained in:
Colin Walters 2018-01-09 15:38:09 -05:00 committed by Atomic Bot
parent c82a7b53a0
commit b1c92a6a1d
2 changed files with 15 additions and 7 deletions

View File

@ -80,11 +80,19 @@ fi
echo "Compose tests starting: $(date)"
echo "Executing: ${tests}"
echo "Writing logs to ${LOGDIR}"
function postprocess_logs() {
# Help out S3 to have the right MIME type
for x in ${LOGDIR}/1/*.sh; do
if test -d ${x}; then
mv ${x}/{stdout,output.txt}
rm ${x}/stderr
fi
done
}
trap postprocess_logs EXIT
# Note we merge stdout/stderr here since I don't see value
# in separating them.
(for tf in ${tests}; do echo $tf; done) | \
parallel --halt soon,fail=1 --results ${LOGDIR} ${dn}/compose-tests/{} |& tail
parallel -j +1 --progress --halt soon,fail=1 \
--results ${LOGDIR} /bin/sh -c "${dn}/compose-tests/{} 2>&1" |& tail
echo "$(date): All tests passed"
# Help out S3 to have the right MIME type
for x in ${LOGDIR}/1/*.sh; do
mv ${x}/stdout{,.txt}
mv ${x}/stderr{,.txt}
done

View File

@ -1,9 +1,9 @@
dn=$(cd $(dirname $0) && pwd)
. ${dn}/../common/libtest.sh
test_tmpdir=$(mktemp -d /var/tmp/rpm-ostree-compose-test.XXXXXX)
touch ${test_tmpdir}/.test
trap _cleanup_tmpdir EXIT
cd ${test_tmpdir}
. ${dn}/../common/libtest.sh
pyeditjson() {
cat >editjson.py <<EOF