882f6c533f49d9b588ae713d7eafbcf35f01883f
3 # SPDX-License-Identifier: GPL-2.0-only
5 # Copyright (C) 2019 EfficiOS Inc.
10 if [ -n "${BT_TESTS_SRCDIR:-}" ]; then
11 UTILSSH
="$BT_TESTS_SRCDIR/utils/utils.sh"
13 UTILSSH
="$(dirname "$0")/../utils/utils.sh"
16 # shellcheck source=../utils/utils.sh
21 stdout
=$
(mktemp
-t test-help-stdout.XXXXXX
)
22 stderr
=$
(mktemp
-t test-help-stderr.XXXXXX
)
24 # Return 0 if file "$1" exists and is empty, non-0 otherwise.
28 [[ -f "$1" && ! -s "$1" ]]
31 # Test with a working plugin name.
32 bt_cli
"${stdout}" "${stderr}" help ctf
33 ok $?
"help ctf plugin exit status"
36 'Description: CTF input and output' \
38 "help ctf plugin expected output"
41 ok $?
"help ctf plugin produces no error"
43 # Test with a working component class name.
44 bt_cli
"${stdout}" "${stderr}" help src.ctf.fs
45 ok $?
"help src.ctf.fs component class exit status"
48 'Description: Read CTF traces from the file system.' \
50 "help src.ctf.fs component class expected output"
53 ok $?
"help src.ctf.fs component class produces no error"
55 # Test without parameter.
56 bt_cli
"${stdout}" "${stderr}" help
57 isnt $?
0 "help without parameter exit status"
60 "Missing plugin name or component class descriptor." \
62 "help without parameter produces expected error"
65 ok $?
"help without parameter produces no output"
67 # Test with too many parameters.
68 bt_cli
"${stdout}" "${stderr}" help ctf fs
69 isnt $?
0 "help with too many parameters exit status"
72 "Extraneous command-line argument specified to \`help\` command:" \
74 "help with too many parameters produces expected error"
77 ok $?
"help with too many parameters produces no output"
79 # Test with unknown plugin name.
80 bt_cli
"${stdout}" "${stderr}" help zigotos
81 isnt $?
0 "help with unknown plugin name"
84 'Cannot find plugin: plugin-name="zigotos"' \
86 "help with unknown plugin name produces expected error"
89 ok $?
"help with unknown plugin name produces no output"
91 # Test with unknown component class name (but known plugin).
92 bt_cli
"${stdout}" "${stderr}" help src.ctf.bob
93 isnt $?
0 "help with unknown component class name"
96 'Cannot find component class: plugin-name="ctf", comp-cls-name="bob", comp-cls-type=SOURCE' \
98 "help with unknown component class name produces expected error"
101 'Description: CTF input and output' \
103 "help with unknown component class name prints plugin help"
105 # Test with unknown component class plugin
106 bt_cli
"${stdout}" "${stderr}" help src.bob.fs
107 isnt $?
0 "help with unknown component class plugin"
110 'Cannot find plugin: plugin-name="bob"' \
112 "help with unknown component class plugin produces expected error"
115 ok $?
"help with unknown component class plugin produces no output"
117 rm -f "${stdout}" "${stderr}"
This page took 0.033345 seconds and 5 git commands to generate.