source: trunk/misc/python3/ratchet.sh @ a2e7072

Last change on this file since a2e7072 was a2e7072, checked in by Itamar Turner-Trauring <itamar@…>, at 2020-08-13T19:48:21Z

Fix the ratchet.sh script.

  • Property mode set to 100755
File size: 1.3 KB
Line 
1#!/usr/bin/env bash
2set -euxo pipefail
3tracking_filename="ratchet-passing"
4
5# Start somewhere predictable.
6cd "$(dirname $0)"
7base=$(pwd)
8
9# Actually, though, trial outputs some things that are only gitignored in the project root.
10cd "../.."
11
12export SUBUNITREPORTER_OUTPUT_PATH="$base/results.subunit2"
13# Since the next two calls are expected to exit non-0, relax our guard.
14trial --reporter=subunitv2-file allmydata || true
15subunit2junitxml < "${SUBUNITREPORTER_OUTPUT_PATH}" > "$base/results.xml" || true
16
17# Okay, now we're clear.
18cd "$base"
19
20# Make sure ratchet.py itself is clean.
21python3 -m doctest ratchet.py
22
23# Now see about Tahoe-LAFS (also expected to fail) ...
24set +e
25python3 ratchet.py up results.xml "$tracking_filename"
26code=$?
27set -e
28
29# Emit a diff of the tracking file, to aid in the situation where changes are
30# not discovered until CI (where TERM might `dumb`).
31if [ $TERM = 'dumb' ]; then
32  export TERM=ansi
33fi
34
35echo "The ${tracking_filename} diff is:"
36echo "================================="
37# "git diff" gets pretty confused in this execution context when trying to
38# write to stdout.  Somehow it fails with SIGTTOU.
39git diff -- "${tracking_filename}" > tracking.diff
40cat tracking.diff
41echo "================================="
42
43echo "Exiting with code ${code} from ratchet.py."
44exit ${code}
Note: See TracBrowser for help on using the repository browser.