aboutsummaryrefslogtreecommitdiffstats
path: root/test/scripts/run.sh
blob: 51c1c62df9d482a97fa4bfea48aba6a3d84b1784 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash

ff="0"
items=
for i in "$@"
do
case $i in
	--venv-dir=*)
		venv_dir="${i#*=}"
		if [ -d $venv_dir ]
		then
			venv_dir=$(cd $venv_dir; pwd)
		else
			echo "ERROR: '$venv_dir' is not a directory"
			exit 1
		fi
		items="$items --venv-dir=\"$venv_dir\""
		;;
	--vpp-ws-dir=*)
		ws_dir="${i#*=}"
		if [ -d $ws_dir ]
		then
			ws_dir=$(cd $ws_dir; pwd)
		else
			echo "ERROR: '$ws_dir' is not a directory"
			exit 1
		fi
		items="$items --vpp-ws-dir=\"$ws_dir\""
		;;
	--force-foreground)
		ff="1"
		items="$items \"$i\""
		;;
	--vpp-tag=*)
		tag="${i#*=}"
		items="$items \"$i\""
		;;
	--python-opts=*)
		python_opts="${i#*=}"
		;;
	*)
		# unknown option - skip
		items="$items \"$i\""
		;;
esac
done

extra_args=""
if [ -z "$ws_dir" ]
then
	ws_dir=$(pwd)
	echo "Argument --vpp-ws-dir not specified, defaulting to '$ws_dir'"
	extra_args="$extra_args --vpp-ws-dir=$ws_dir"
fi

if [ -z "$venv_dir" ]
then
	venv_dir="$ws_dir/build-root/test/venv"
	echo "Argument --venv-path not specified, defaulting to '$venv_dir'"
	extra_args="$extra_args --venv-dir=$venv_dir"
fi

if [ -z "$tag" ]
then
	tag="vpp_debug"
	echo "Argument --vpp-tag not specified, defaulting to '$tag'"
	extra_args="$extra_args --vpp-tag=$tag"
fi

eval set -- $items
$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 $*