Debian Codegraph @

debian/run_tests

raw
1 #!/bin/bash
2
3 # Copyright 2022-2024 Julian Gilbey <[email protected]>
4 # License: MIT License
5
6 # Determine whether every test passes in at least one pytest run.
7 # We run the command given on the command line at most MAX_PYTEST_RUNS,
8 # stopping if a pytest run is successful.
9
10 interpreter=$1
11
12 MAX_PYTEST_RUNS=5
13
14 # Remove any old log files
15 rm -f pytest_log.txt
16
17 run=1
18 while [ $run -le $MAX_PYTEST_RUNS ]
19 do
20 echo "*** STARTING RUN $run: $* $exclusions"
21 set -o pipefail
22 "$@" | tee -a pytest_log.txt
23 ret=$?
24 set +o pipefail
25 if [ $ret -eq 0 ]
26 then
27 echo "*** END OF RUN $run: ALL TESTS RUN HAVE NOW PASSED/XFAILED ***"
28 rm -f pytest_log.txt
29 exit 0
30 fi
31 echo "*** END OF RUN $run: NOT ALL TESTS HAVE YET PASSED/XFAILED ***"
32 run=$(($run + 1))
33 done
34
35 echo "*** SOME TESTS FAILED/ERRORED EVERY RUN, ABORTING ***"
36 rm -f pytest_log.txt
37 exit 1