summaryrefslogtreecommitdiffstats
path: root/utils/rtklib/test.sh
blob: ec59e4db580a201af8b735cf746e45fc3cc165d2 (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
#!/bin/sh
#
# Functional smoke test for the RTKLIB command-line tools.
#
# Each tool prints a usage/synopsis block (containing its own name) to stderr
# when invoked with an unrecognized option, then exits 0. We confirm the
# binary runs in the target environment and produces the expected synopsis.

bin="/usr/bin/$1"

case "$1" in
convbin|pos2kml|rnx2rtkp|rtkrcv|str2str)
	[ -x "$bin" ] || {
		echo "FAIL: $bin not found or not executable"
		exit 1
	}

	# Any unknown '-' option triggers printhelp()/printusage(); rtkrcv
	# exits 0, the others may exit non-zero — capture both streams and
	# ignore the exit code, then look for the binary name in the output.
	out=$("$bin" -? 2>&1 || true)
	echo "$out" | grep -qF "$1" || {
		echo "FAIL: $1 synopsis did not mention '$1'"
		echo "$out"
		exit 1
	}
	echo "$1: synopsis OK"
	;;
*)
	echo "Untested package: $1" >&2
	exit 1
	;;
esac