2018-06-15 19:17:32 +00:00
|
|
|
#!/bin/bash -e
|
2018-06-15 18:21:33 +00:00
|
|
|
|
2018-06-15 19:40:50 +00:00
|
|
|
TAHOE_LAFS_TOX_ENVIRONMENT=$1
|
|
|
|
shift
|
|
|
|
|
|
|
|
TAHOE_LAFS_TOX_ARGS=$1
|
2018-06-15 20:02:49 +00:00
|
|
|
shift || :
|
2018-06-15 19:40:50 +00:00
|
|
|
|
2018-06-15 18:21:33 +00:00
|
|
|
# Run the test suite as a non-root user. This is the expected usage some
|
|
|
|
# small areas of the test suite assume non-root privileges (such as unreadable
|
|
|
|
# files being unreadable).
|
|
|
|
#
|
|
|
|
# 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.
|
2018-07-05 20:03:37 +00:00
|
|
|
sudo TAHOE_LAFS_TRIAL_ARGS="--reporter=subunit" \
|
|
|
|
--set-home \
|
|
|
|
--user nobody \
|
|
|
|
/tmp/tests/bin/tox \
|
2018-07-05 18:19:23 +00:00
|
|
|
-c /tmp/project/tox.ini \
|
|
|
|
--result-json /tmp/tox-result.json \
|
2018-07-06 14:15:32 +00:00
|
|
|
--workdir /tmp/tahoe-lafs.tox \
|
2018-07-05 18:19:23 +00:00
|
|
|
-e "${TAHOE_LAFS_TOX_ENVIRONMENT}" \
|
2018-07-05 20:03:37 +00:00
|
|
|
${TAHOE_LAFS_TOX_ARGS}
|
2018-07-05 18:19:23 +00:00
|
|
|
|
|
|
|
# Extract the test process output which should be subunit1-format.
|
2018-07-06 14:15:52 +00:00
|
|
|
/tmp/tests/bin/python -c '
|
2018-07-05 18:19:23 +00:00
|
|
|
from json import load
|
2018-07-05 20:03:37 +00:00
|
|
|
from sys import stdin, stdout, argv
|
|
|
|
result = load(stdin)
|
2018-07-06 14:47:28 +00:00
|
|
|
for environ in argv[1].split(","):
|
|
|
|
messy_output = result["testenvs"][environ]["test"][-1]["output"]
|
|
|
|
stdout.write(messy_output.split("\n", 3)[3].strip() + "\n")
|
2018-07-06 14:15:52 +00:00
|
|
|
' "${TAHOE_LAFS_TOX_ENVIRONMENT}" < /tmp/tox-result.json > /tmp/results.subunit1
|
|
|
|
|
|
|
|
# Upgrade subunit version because subunit2junitxml only works on subunit2
|
|
|
|
/tmp/tests/bin/subunit-1to2 < /tmp/results.subunit1 > /tmp/results.subunit2
|
|
|
|
|
|
|
|
# Create a junitxml results area. Put these results in a subdirectory of the
|
|
|
|
# ultimate location because CircleCI extracts some label information from the
|
|
|
|
# subdirectory name.
|
2018-07-06 14:59:10 +00:00
|
|
|
mkdir -p /tmp/artifacts/junit/unittests
|
|
|
|
/tmp/tests/bin/subunit2junitxml < /tmp/results.subunit2 > /tmp/artifacts/junit/unittests/results.xml
|