Files
apfstests/tools/mkgroupfile
T
Darrick J. Wong 17f6ac8ecc fstests: automatically generate group files
Now that we've moved the group membership details into the test case
files themselves, automatically generate the group files during build.
The autogenerated files are named "group.list" instead of "group" to
avoid conflicts between generated and (stale) SCM files as everyone
rebases.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2021-06-27 22:50:06 +08:00

43 lines
927 B
Bash
Executable File

#!/bin/bash
# Generate a group file from the _begin_fstest call in each test.
if [ "$1" = "--help" ]; then
echo "Usage: (cd tests/XXX/ ; ../../tools/mkgroupfile [output])"
exit 1
fi
test_dir="$PWD"
groupfile="$1"
if [ ! -x ../../check ]; then
echo "$0: Run this from tests/XXX/."
exit 1
fi
generate_groupfile() {
cat << ENDL
# QA groups control file, automatically generated.
# See _begin_fstest in each test for details.
ENDL
cd ../../
export GENERATE_GROUPS=yes
grep -R -l "^_begin_fstest" "$test_dir/" 2>/dev/null | while read testfile; do
test -x "$testfile" && "$testfile"
done | sort -g
cd "$test_dir"
}
if [ -z "$groupfile" ] || [ "$groupfile" = "-" ]; then
# Dump the group file to stdout and exit
generate_groupfile
exit 0
fi
# Otherwise, write the group file to disk somewhere.
ngroupfile="${groupfile}.new"
rm -f "$ngroupfile"
generate_groupfile >> "$ngroupfile"
mv "$ngroupfile" "$groupfile"