From 6dd78fdf65cb784d234512d5f5f66efe231e5bff Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Thu, 16 Sep 2021 17:39:35 -0700 Subject: 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 Reviewed-by: Amir Goldstein Signed-off-by: Eryu Guan --- common/preamble | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'common') 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 -- cgit v1.2.3