Debian Codegraph @

testing/web-platform/tests/tools/ci/ci_tools_unittest.sh

raw
1 #!/bin/bash
2 set -ex
3
4 SCRIPT_DIR=$(cd $(dirname "$0") && pwd -P)
5 WPT_ROOT=$SCRIPT_DIR/../..
6 cd $WPT_ROOT
7
8 run_applicable_tox () {
9 # instead of just running TOXENV (e.g., py38)
10 # run all environments that start with TOXENV
11 # (e.g., py38-firefox as well as py38)
12 local OLD_TOXENV="$TOXENV"
13 unset TOXENV
14 local RUN_ENVS=$(tox -l | grep "^${OLD_TOXENV}\(\-\|\$\)" | tr "\n" ",")
15 if [[ -n "$RUN_ENVS" ]]; then
16 tox -e "$RUN_ENVS"
17 fi
18 export TOXENV="$OLD_TOXENV"
19 }
20
21 if ./wpt test-jobs --includes tools_unittest; then
22 pip install --user -U tox
23 cd tools
24 run_applicable_tox
25 cd $WPT_ROOT
26 else
27 echo "Skipping tools unittest"
28 fi
29
30 if ./wpt test-jobs --includes wptrunner_unittest; then
31 cd tools/wptrunner
32 run_applicable_tox
33 cd $WPT_ROOT
34 else
35 echo "Skipping wptrunner unittest"
36 fi