summaryrefslogtreecommitdiffstats
path: root/net/openthread-br/test.sh
blob: f41dcd8ce4baffacce13761025afe0e909bfdd04 (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
#!/bin/sh
#
# Functional smoke tests for openthread-br.

set -e

case "$PKG_NAME" in
openthread-br)
	# Exercises otbr-agent's option parser and its full runtime closure.
	# --version prints and exits without touching the RCP or the network.
	# The Makefile passes OTBR_VERSION=$(PKG_VERSION), so this is also
	# the string the generic version check matches.
	otbr-agent --version

	# -h exits inside ot-ctl's option parser without contacting the
	# daemon. The older hazard -- a segfault on any unrecognized long
	# option, from a getopt_long() array missing its terminating entry --
	# is fixed in the openthread this release bundles
	# (openthread/openthread#13423).
	# A usage exit of 0 or 1 both mean the parser ran to completion;
	# anything else (a crash reports 128+signal) is what this catches.
	# Only stdout is dropped: ot-ctl's own diagnostics belong in the CI
	# log, where they say what went wrong next to the status below.
	set +e
	ot-ctl -h >/dev/null
	rc=$?
	set -e
	case $rc in
	0|1) ;;
	*)
		echo "test.sh: ot-ctl -h exited with status $rc" >&2
		exit 1
		;;
	esac
	;;

*)
	echo "test.sh: unknown package '$PKG_NAME', refusing to silently pass" >&2
	echo "test.sh: update net/openthread-br/test.sh to cover this package" >&2
	exit 1
	;;
esac