forked from stb-tester/stb-tester
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstbt.sh.in
83 lines (74 loc) · 2.74 KB
/
stbt.sh.in
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
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/sh
# Copyright 2012-2013 YouView TV Ltd.
# License: LGPL v2.1 or (at your option) any later version (see
# https://github.com/stb-tester/stb-tester/blob/master/LICENSE for details).
#/ usage: stbt [--help] [--version] [--with-experimental] <command> [args]
#/
#/ Available commands are:
#/ run Run a testcase
#/ batch Run testcases repeatedly, create html report
#/ auto-selftest Test your test-cases against saved screenshots
#/ config Print configuration value
#/ control Send remote control signals
#/ lint Static analysis of testcases
#/ match Compare two images
#/ power Control networked power switch
#/ record Record a testcase
#/ screenshot Capture a single screenshot
#/ tv View live video on screen
#/ virtual-stb Configure stbt to use an STB emulator
#/
#/ Experimental commands. These may change in the future in a backwards-
#/ incompatible way. They require passing the '--with-experimental' flag:
#/ camera Configure stbt to capture video from a TV using a camera
#/
#/ For help on a specific command do 'stbt <command> --help'.
#/ See 'man stbt' for more detailed information.
usage() { grep '^#/' "$0" | cut -c4-; }
export STBT_VERSION="@VERSION@"
[ $# -ge 1 ] || { usage >&2; exit 1; }
if [ $1 = '--with-experimental' ]; then
experimental=1
shift
else
experimental=0
fi
cmd=$1
shift
check_experimental() {
if [ "$experimental" != 1 ]; then
echo "stbt $cmd is an experimental feature which may change in" 1>&2
echo "the future in a backwards-incompatible way. If you still" 1>&2
echo "want to proceed use 'stbt --with-experimental $cmd'." 1>&2
exit 1
fi
}
case "$cmd" in
-h|--help)
usage; exit 0;;
-v|--version)
echo "stb-tester $STBT_VERSION"; exit 0;;
auto-selftest)
exec @LIBEXECDIR@/stbt/stbt_auto_selftest.py "$@";;
run|record|batch|config|control|lint|power|screenshot|match|tv)
exec @LIBEXECDIR@/stbt/stbt-"$cmd" "$@";;
templatematch) # for backwards compatibility
exec @LIBEXECDIR@/stbt/stbt-match "$@";;
virtual-stb)
export PYTHONPATH=$PYTHONPATH:@LIBEXECDIR@/stbt/
if ! [ -e @LIBEXECDIR@/stbt/stbt_virtual_stb.py ]; then
echo "stbt virtual-stb is not installed." >&2
exit 1
fi
exec @LIBEXECDIR@/stbt/stbt_virtual_stb.py "$@";;
# Experimental sub-commands:
camera)
if [ ! -e @LIBEXECDIR@/stbt/stbt-"$cmd" ]; then
echo "stb-tester camera support is not installed." 1>&2
exit 1
fi
check_experimental
exec @LIBEXECDIR@/stbt/stbt-"$cmd" "$@";;
*)
usage >&2; exit 1;;
esac