xfs: make sure xfs_db/xfs_quota commands are documented
[xfstests-dev.git] / tests / xfs / 515
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0-or-newer
3 # Copyright (c) 2020, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 515
6 #
7 # Ensure all xfs_quota commands are documented.
8
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1    # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20         cd /
21         rm -f $tmp.* $file
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26
27 # real QA test starts here
28 _supported_fs xfs
29 _supported_os Linux
30 _require_command "$XFS_QUOTA_PROG" "xfs_quota"
31 _require_command "$MAN_PROG" man
32 _require_test
33
34 echo "Silence is golden"
35
36 MANPAGE=$($MAN_PROG --path xfs_quota)
37
38 case "$MANPAGE" in
39 *.gz|*.z\|*.Z)  CAT=zcat;;
40 *.bz2)          CAT=bzcat;;
41 *.xz)           CAT=xzcat;;
42 *)              CAT=cat;;
43 esac
44 _require_command `which $CAT` $CAT
45
46 for COMMAND in `$XFS_QUOTA_PROG -x -c help $file | awk '{print $1}' | grep -v "^Use"`; do
47   $CAT "$MANPAGE" | egrep -q "^\.B.*$COMMAND" || \
48         echo "$COMMAND not documented in the xfs_quota manpage"
49 done
50
51 # success, all done
52 status=0
53 exit