@@ -16,6 +16,12 @@ VALID_TEST_NAME="$VALID_TEST_ID-\?[[:alnum:]-]*"
_set_seq_and_groups()
{
seq=`basename $0`
+
+ if [ -n "$GENERATE_GROUPS" ]; then
+ echo "$seq $@"
+ exit 0
+ fi
+
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
@@ -132,3 +132,9 @@ FILTER = $(basename $(EXTFILTER4) $(BASIC_OUTFILES))
# finally, select the test files by filtering against against the
# stripped output files and sort them to remove duplicates.
TESTS = $(sort $(filter $(ALLFILES), $(FILTER)))
+
+.PHONY: group
+
+group:
+ @echo " [GROUP] $$PWD/$@"
+ $(Q)$(TOPDIR)/tools/mkgroupfile $@
@@ -7,6 +7,10 @@ include $(TOPDIR)/include/builddefs
TESTS_SUBDIRS = $(sort $(dir $(wildcard $(CURDIR)/[[:lower:]]*/)))
+SUBDIRS = $(wildcard [[:lower:]]*)
+
+default: $(SUBDIRS)
+
include $(BUILDRULES)
install: $(addsuffix -install,$(TESTS_SUBDIRS))
@@ -7,6 +7,9 @@ include $(TOPDIR)/include/builddefs
BTRFS_DIR = btrfs
TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(BTRFS_DIR)
+DIRT = group
+
+default: $(DIRT)
include $(BUILDRULES)
@@ -5,6 +5,9 @@ include $(TOPDIR)/include/builddefs
CEPH_DIR = ceph
TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(CEPH_DIR)
+DIRT = group
+
+default: $(DIRT)
include $(BUILDRULES)
@@ -7,6 +7,9 @@ include $(TOPDIR)/include/builddefs
CIFS_DIR = cifs
TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(CIFS_DIR)
+DIRT = group
+
+default: $(DIRT)
include $(BUILDRULES)
@@ -7,6 +7,9 @@ include $(TOPDIR)/include/builddefs
EXT4_DIR = ext4
TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(EXT4_DIR)
+DIRT = group
+
+default: $(DIRT)
include $(BUILDRULES)
@@ -8,6 +8,9 @@ include $(TOPDIR)/include/builddefs
F2FS_DIR = f2fs
TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(F2FS_DIR)
+DIRT = group
+
+default: $(DIRT)
include $(BUILDRULES)
@@ -7,6 +7,9 @@ include $(TOPDIR)/include/builddefs
GENERIC_DIR = generic
TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(GENERIC_DIR)
+DIRT = group
+
+default: $(DIRT)
include $(BUILDRULES)
@@ -7,6 +7,9 @@ include $(TOPDIR)/include/builddefs
NFS_DIR = nfs
TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(NFS_DIR)
+DIRT = group
+
+default: $(DIRT)
include $(BUILDRULES)
@@ -7,6 +7,9 @@ include $(TOPDIR)/include/builddefs
OCFS2_DIR = ocfs2
TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(OCFS2_DIR)
+DIRT = group
+
+default: $(DIRT)
include $(BUILDRULES)
@@ -7,6 +7,9 @@ include $(TOPDIR)/include/builddefs
TEST_DIR = overlay
TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(TEST_DIR)
+DIRT = group
+
+default: $(DIRT)
include $(BUILDRULES)
@@ -7,6 +7,9 @@ include $(TOPDIR)/include/builddefs
PERF_DIR = perf
TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(PERF_DIR)
+DIRT = group
+
+default: $(DIRT)
include $(BUILDRULES)
@@ -7,6 +7,9 @@ include $(TOPDIR)/include/builddefs
SHARED_DIR = shared
TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(SHARED_DIR)
+DIRT = group
+
+default: $(DIRT)
include $(BUILDRULES)
@@ -7,6 +7,9 @@ include $(TOPDIR)/include/builddefs
UDF_DIR = udf
TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(UDF_DIR)
+DIRT = group
+
+default: $(DIRT)
include $(BUILDRULES)
@@ -7,6 +7,9 @@ include $(TOPDIR)/include/builddefs
XFS_DIR = xfs
TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(XFS_DIR)
+DIRT = group
+
+default: $(DIRT)
include $(BUILDRULES)
new file mode 100755
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+# Generate a group file from the _set_test_seqnum call in each test.
+
+if [ "$1" = "--help" ]; then
+ echo "Usage: (cd tests/XXX/ ; ../../tools/mkgroupfile [output])"
+ exit 1
+fi
+
+test_dir="$PWD"
+groupfile="$1"
+
+generate_groupfile() {
+ cat << ENDL
+# QA groups control file, automatically generated.
+# See _set_seq_and_groups in each test for details.
+
+ENDL
+ cd ../../
+ export GENERATE_GROUPS=yes
+ grep -R -l "^_set_seq_and_groups" "$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"