blob: 544a536ed36d6f8096d30345fcd0581a1aaace07 [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
58 venv_dir="$ws_dir/test/venv"
59 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 $*