blob: 51c1c62df9d482a97fa4bfea48aba6a3d84b1784 [file] [log] [blame]
Klement Sekerab23ffd72021-05-31 16:08:53 +02001#!/bin/bash
2
3ff="0"
4items=
5for i in "$@"
6do
7case $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 ;;
45esac
46done
47
48extra_args=""
49if [ -z "$ws_dir" ]
50then
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"
54fi
55
56if [ -z "$venv_dir" ]
57then
Saima Yunusc7f93b32022-08-10 03:25:31 -040058 venv_dir="$ws_dir/build-root/test/venv"
Klement Sekerab23ffd72021-05-31 16:08:53 +020059 echo "Argument --venv-path not specified, defaulting to '$venv_dir'"
60 extra_args="$extra_args --venv-dir=$venv_dir"
61fi
62
63if [ -z "$tag" ]
64then
65 tag="vpp_debug"
66 echo "Argument --vpp-tag not specified, defaulting to '$tag'"
67 extra_args="$extra_args --vpp-tag=$tag"
68fi
69
70eval 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 $*