2 # ensure that each command's help "SYNOPSIS" line starts with the command name
4 # Copyright (C) 2008 Red Hat, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see
18 # <http://www.gnu.org/licenses/>.
20 test -z "$srcdir" && srcdir=$(pwd)
21 test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
22 test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
24 if test "$VERBOSE" = yes; then
26 $abs_top_builddir/tools/virsh --version
29 . "$srcdir/test-lib.sh"
33 test_url=test:///default
35 $abs_top_builddir/tools/virsh -c $test_url help > cmds || framework_failure
36 cmds=$(sed -n 's/^ \([^ ][^ ]*\) .*/\1/p' cmds) || framework_failure
37 test -n "$cmds" || framework_failure
40 $abs_top_builddir/tools/virsh -c $test_url help $i > help || fail=1
41 grep -A1 '^ SYNOPSIS$' help > synopsis \
42 || { echo 1>&2 missing or invalid help SYNOPSIS for $i; fail=1; }
43 sed -n 2p synopsis > s2 || framework_failure
44 grep -E "^ $i( |$)" s2 > /dev/null \
45 || { echo 1>&2 "invalid help SYNOPSIS for $i:"; cat s2 1>&2; fail=1; }
48 (exit $fail); exit $fail