From 628a3aa22ffddc95110b2b10325fb329be514001 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 31 Jul 2018 10:57:31 -0400 Subject: [PATCH] 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 --- tests/compose | 18 +++--------------- tests/compose-tests/run-test.sh | 10 ++++++++++ 2 files changed, 13 insertions(+), 15 deletions(-) create mode 100755 tests/compose-tests/run-test.sh diff --git a/tests/compose b/tests/compose index dad4bcaf..175a39fa 100755 --- a/tests/compose +++ b/tests/compose @@ -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" diff --git a/tests/compose-tests/run-test.sh b/tests/compose-tests/run-test.sh new file mode 100755 index 00000000..04f62104 --- /dev/null +++ b/tests/compose-tests/run-test.sh @@ -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}