tests/compose: Write logs directly
Make logging work the same as it does for the vmcheck-STI work (at some point I'll try to unify the 3 parallel+script implementions we have). This fixes the problem that when the test times out, the filename won't have `.txt` and S3 won't have the right MIME type. Closes: #1479 Approved by: jlebon
This commit is contained in:
parent
800402b00a
commit
628a3aa22f
@ -10,7 +10,7 @@ export topsrcdir=$(cd $dn/.. && pwd)
|
||||
# avoid refetching yum metadata everytime
|
||||
export RPMOSTREE_USE_CACHED_METADATA=1
|
||||
|
||||
LOGDIR=${LOGDIR:-$(pwd)/test-compose-logs}
|
||||
export LOGDIR=${LOGDIR:-$(pwd)/test-compose-logs}
|
||||
mkdir -p ${LOGDIR}
|
||||
|
||||
colour_print() {
|
||||
@ -81,19 +81,7 @@ 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 -j +1 --progress --halt soon,fail=1 \
|
||||
--results ${LOGDIR} /bin/sh -c "${dn}/compose-tests/{} 2>&1" |& tail
|
||||
parallel -v -j +1 --progress --halt soon,fail=1 \
|
||||
--results ${LOGDIR}/parallel --quote /bin/sh -c "${dn}/compose-tests/run-test.sh {}"
|
||||
echo "$(date): All tests passed"
|
||||
|
10
tests/compose-tests/run-test.sh
Executable file
10
tests/compose-tests/run-test.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
tf=$1
|
||||
export TEST_ARTIFACTS=${LOGDIR}/${tf}
|
||||
mkdir -p ${TEST_ARTIFACTS}
|
||||
# Redirect our stdout/stderr, since we don't want what GNU parallel does
|
||||
exec 1>${TEST_ARTIFACTS}/output.txt
|
||||
exec 2>&1
|
||||
exec $(dirname $0)/${tf}
|
Loading…
Reference in New Issue
Block a user