summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-09-16 17:39:35 -0700
committerEryu Guan <guaneryu@gmail.com>2021-09-26 21:34:16 +0800
commit6dd78fdf65cb784d234512d5f5f66efe231e5bff (patch)
treed17e6b18cb058f986925e0e3fc6c465e7f771ae6 /common
parent7e769ca8dce9bd2019279999ab7f1c84938fc7b5 (diff)
tools: make sure that test groups are described in the documentation
Create a file to document the purpose of each test group that is currently defined in fstests, and change mkgroupfile to check that every group mentioned in the tests is also mentioned in the documentation. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Diffstat (limited to 'common')
-rw-r--r--common/preamble21
1 files changed, 21 insertions, 0 deletions
diff --git a/common/preamble b/common/preamble
index 66b0ed05..64d79385 100644
--- a/common/preamble
+++ b/common/preamble
@@ -23,6 +23,26 @@ _register_cleanup()
trap "${cleanup}exit \$status" EXIT HUP INT QUIT TERM $*
}
+# Make sure each group is in the documentation file.
+_check_groups() {
+ test -n "$GROUPNAME_DOC_FILE" || return 0
+
+ local testname="$(echo "$0" | sed -e 's/^.*tests\///g')"
+ declare -a missing=()
+
+ for group in "$@"; do
+ if ! grep -q "^${group}[[:space:]]" "$GROUPNAME_DOC_FILE"; then
+ missing+=("\"${group}\"")
+ fi
+ done
+ test "${#missing}" -eq 0 && return 0
+
+ local suffix=
+ test "${#missing}" -gt 1 && suffix="s"
+ echo "$testname: group$suffix ${missing[@]} not mentioned in documentation." 1>&2
+ return 1
+}
+
# Prepare to run a fstest by initializing the required global variables to
# their defaults, sourcing common functions, registering a cleanup function,
# and removing the $seqres.full file.
@@ -42,6 +62,7 @@ _begin_fstest()
# If we're only running the test to generate a group.list file,
# spit out the group data and exit.
if [ -n "$GENERATE_GROUPS" ]; then
+ _check_groups "$@" || exit 1
echo "$seq $@"
exit 0
fi