Generate subunit1 and then junitxml test results

Successfully this time, perhaps.
This commit is contained in:
Jean-Paul Calderone 2018-07-05 16:03:37 -04:00
parent 16e4370630
commit cead72ac58
2 changed files with 22 additions and 12 deletions

View File

@ -13,22 +13,24 @@ shift || :
# Also run with /tmp as a workdir because the non-root user won't be able to
# create the tox working filesystem state in the source checkout because it is
# owned by root.
sudo --set-home -u nobody /tmp/tests/bin/tox \
sudo TAHOE_LAFS_TRIAL_ARGS="--reporter=subunit" \
--set-home \
--user nobody \
/tmp/tests/bin/tox \
-c /tmp/project/tox.ini \
--result-json /tmp/tox-result.json \
--workdir /tmp \
-e "${TAHOE_LAFS_TOX_ENVIRONMENT}" \
--reporter=subunit ${TAHOE_LAFS_TOX_ARGS}
${TAHOE_LAFS_TOX_ARGS}
# Extract the test process output which should be subunit1-format.
mkdir /tmp/junit
cat /tmp/tox-result.json | /tmp/tests/bin/python -c '
from json import load
from sys import stdin
result = load(sys.stdin)
messy_output = result["testenvs"]["py27"]["test"][-1]["output"]
sys.stdout.write(messy_output.split("\n", 3)[3].strip())
' > /tmp/test-result.subunit1
# Convert the subunit1 data to junitxml which CircleCI can ingest.
mkdir -p /tmp/junit
subunit-1to2 < /tmp/test-result.subunit1 | subunit2junitxml > /tmp/junit/results.junitxml
from sys import stdin, stdout, argv
result = load(stdin)
messy_output = result["testenvs"][argv[1]]["test"][-1]["output"]
stdout.write(messy_output.split("\n", 3)[3].strip())
' "${TAHOE_LAFS_TOX_ENVIRONMENT}" |
/tmp/tests/bin/subunit-1to2 |
/tmp/tests/bin/subunit2junitxml > /tmp/junit/results.junitxml

View File

@ -10,7 +10,15 @@ shift || :
# non-root user. See below.
sudo --set-home -u nobody virtualenv --python python2.7 /tmp/tests
sudo --set-home -u nobody /tmp/tests/bin/pip install tox codecov
# Python packages we need to support the test infrastructure. *Not* packages
# Tahoe-LAFS itself (implementation or test suite) need.
TEST_DEPS="tox codecov"
# Python packages we need to generate test reports for CI infrastructure.
# *Not* packages Tahoe-LAFS itself (implement or test suite) need.
REPORTING_DEPS="python-subunit junitxml"
sudo --set-home -u nobody /tmp/tests/bin/pip install ${TEST_DEPS} ${REPORTING_DEPS}
# Get everything else installed in it, too.
sudo --set-home -u nobody /tmp/tests/bin/tox -c /tmp/project/tox.ini --workdir /tmp --notest -e "${TAHOE_LAFS_TOX_ENVIRONMENT}" ${TAHOE_LAFS_TOX_ARGS}