Tom Jones | c3b416c | 2024-01-18 14:51:44 +0000 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Klement Sekera | b23ffd7 | 2021-05-31 16:08:53 +0200 | [diff] [blame] | 2 | |
| 3 | ff="0" |
| 4 | items= |
| 5 | for i in "$@" |
| 6 | do |
| 7 | case $i in |
| 8 | --venv-dir=*) |
| 9 | venv_dir="${i#*=}" |
| 10 | if [ -d $venv_dir ] |
| 11 | then |
| 12 | venv_dir=$(cd $venv_dir; pwd) |
| 13 | else |
| 14 | echo "ERROR: '$venv_dir' is not a directory" |
| 15 | exit 1 |
| 16 | fi |
| 17 | items="$items --venv-dir=\"$venv_dir\"" |
| 18 | ;; |
| 19 | --vpp-ws-dir=*) |
| 20 | ws_dir="${i#*=}" |
| 21 | if [ -d $ws_dir ] |
| 22 | then |
| 23 | ws_dir=$(cd $ws_dir; pwd) |
| 24 | else |
| 25 | echo "ERROR: '$ws_dir' is not a directory" |
| 26 | exit 1 |
| 27 | fi |
| 28 | items="$items --vpp-ws-dir=\"$ws_dir\"" |
| 29 | ;; |
| 30 | --force-foreground) |
| 31 | ff="1" |
| 32 | items="$items \"$i\"" |
| 33 | ;; |
| 34 | --vpp-tag=*) |
| 35 | tag="${i#*=}" |
| 36 | items="$items \"$i\"" |
| 37 | ;; |
| 38 | --python-opts=*) |
| 39 | python_opts="${i#*=}" |
| 40 | ;; |
| 41 | *) |
| 42 | # unknown option - skip |
| 43 | items="$items \"$i\"" |
| 44 | ;; |
| 45 | esac |
| 46 | done |
| 47 | |
| 48 | extra_args="" |
| 49 | if [ -z "$ws_dir" ] |
| 50 | then |
| 51 | ws_dir=$(pwd) |
| 52 | echo "Argument --vpp-ws-dir not specified, defaulting to '$ws_dir'" |
| 53 | extra_args="$extra_args --vpp-ws-dir=$ws_dir" |
| 54 | fi |
| 55 | |
| 56 | if [ -z "$venv_dir" ] |
| 57 | then |
Saima Yunus | c7f93b3 | 2022-08-10 03:25:31 -0400 | [diff] [blame] | 58 | venv_dir="$ws_dir/build-root/test/venv" |
Klement Sekera | b23ffd7 | 2021-05-31 16:08:53 +0200 | [diff] [blame] | 59 | echo "Argument --venv-path not specified, defaulting to '$venv_dir'" |
| 60 | extra_args="$extra_args --venv-dir=$venv_dir" |
| 61 | fi |
| 62 | |
| 63 | if [ -z "$tag" ] |
| 64 | then |
| 65 | tag="vpp_debug" |
| 66 | echo "Argument --vpp-tag not specified, defaulting to '$tag'" |
| 67 | extra_args="$extra_args --vpp-tag=$tag" |
| 68 | fi |
| 69 | |
| 70 | eval set -- $items |
| 71 | $ws_dir/test/scripts/setsid_wrapper.sh $ws_dir/test/scripts/run_in_venv_with_cleanup.sh $ff $venv_dir/bin/activate python3 $python_opts $ws_dir/test/run_tests.py $extra_args $* |