summaryrefslogtreecommitdiffstats
path: root/tools/build/ci_test.sh
blob: d1d2ee48f0a14a7cbefe486e9c1185992c064e90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash

# Run the tests in Github Action
#
# Failed tests run up to three times, to take into account flakey tests.
# Of course the random generator is not re-seeded between runs, in order to
# repeat the same result.

set -euo pipefail
set -x

# Assemble a markers expression from the MARKERS and NOT_MARKERS env vars
markers=""
for m in ${MARKERS:-}; do
    [[ "$markers" != "" ]] && markers="$markers and"
    markers="$markers $m"
done
for m in ${NOT_MARKERS:-}; do
    [[ "$markers" != "" ]] && markers="$markers and"
    markers="$markers not $m"
done

pytest="python -bb -m pytest --color=yes"

$pytest -m "$markers" "$@" && exit 0

$pytest -m "$markers" --lf --randomly-seed=last "$@" && exit 0

$pytest -m "$markers" --lf --randomly-seed=last "$@"