Go straight to a file with the subunit2 output.

It's just too hard otherwise.
This commit is contained in:
Jean-Paul Calderone 2018-07-08 18:49:45 -04:00
parent 80027f3ef1
commit 97bc77d96b
3 changed files with 15 additions and 21 deletions

View File

@ -12,7 +12,6 @@ shift || :
# Make sure we can actually write things to this directory.
sudo --user nobody mkdir -p "${ARTIFACTS}"
TOX_JSON="${ARTIFACTS}"/tox-result.json
SUBUNIT2="${ARTIFACTS}"/results.subunit2
# Use an intermediate directory here because CircleCI extracts some label
@ -26,33 +25,20 @@ JUNITXML="${ARTIFACTS}"/junit/unittests/results.xml
# 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 TAHOE_LAFS_TRIAL_ARGS="--reporter=subunitv2" \
#
# Send the output directly to a file because transporting the binary subunit2
# via tox and then scraping it out is hideous and failure prone.
sudo \
SUBUNITREPORTER_OUTPUT_PATH="${SUBUNIT2}" \
TAHOE_LAFS_TRIAL_ARGS="--reporter=subunitv2-file" \
--set-home \
--user nobody \
/tmp/tests/bin/tox \
-c /tmp/project/tox.ini \
--result-json "${TOX_JSON}" \
--workdir /tmp/tahoe-lafs.tox \
-e "${TAHOE_LAFS_TOX_ENVIRONMENT}" \
${TAHOE_LAFS_TOX_ARGS}
# Extract the test process output which should be subunit2-format.
/tmp/tests/bin/python -c '
from json import load
from sys import stdin, stdout, argv
result = load(stdin)
for environ in argv[1].split(","):
# Heuristically discover which blob is probably the test output!
test_result = next(
result
for result
in result["testenvs"][environ]["test"]
if "test: allmydata." in result["output"]
)
messy_output = test_result["output"]
stdout.write(messy_output.split("\n", 3)[3].strip() + "\n")
' "${TAHOE_LAFS_TOX_ENVIRONMENT}" < "${TOX_JSON}" > "${SUBUNIT2}"
# Create a junitxml results area.
mkdir -p "$(dirname "${JUNITXML}")"
/tmp/tests/bin/subunit2junitxml < "${SUBUNIT2}" > "${JUNITXML}"

View File

@ -10,6 +10,14 @@ shift || :
# non-root user. See below.
sudo --set-home -u nobody virtualenv --python python2.7 /tmp/tests
# Get "certifi" to avoid bug #2913. Basically if a `setup_requires=...` causes
# a package to be installed (with setuptools) then it'll fail on certain
# platforms (travis's OX-X 10.12, Slackware 14.2) because PyPI's TLS
# requirements (TLS >= 1.2) are incompatible with the old TLS clients
# available to those systems. Installing it ahead of time (with pip) avoids
# this problem.
sudo --set-home -u nobody PIP_FIND_LINKS=/tmp/packages /tmp/tests/bin/pip install certifi
# Python packages we need to support the test infrastructure. *Not* packages
# Tahoe-LAFS itself (implementation or test suite) need.
TEST_DEPS="tox codecov"

View File

@ -13,7 +13,7 @@ skipsdist = True
[testenv]
basepython=python2.7
passenv = TAHOE_LAFS_* USERPROFILE HOMEDRIVE HOMEPATH
passenv = TAHOE_LAFS_* SUBUNITREPORTER_* USERPROFILE HOMEDRIVE HOMEPATH
# Get "certifi" to avoid bug #2913. Basically if a `setup_requires=...` causes
# a package to be installed (with setuptools) then it'll fail on certain
# platforms (travis's OX-X 10.12, Slackware 14.2) because PyPI's TLS