This adds support for central fs configs using sections. This allows different FS maintainers to maintain per-fs config file with different sections to test multiple filesystem configurations like 1k, 4k, quota etc. During make we combine all configs/<fs>.config file into configs/all-fs.config which is not tracked by git. check script will by default use configs/all-fs.config file if local.config or configs/$(HOST).config file is not present. This patch also adds configs/devices.config.example which can be used as an example to export default settings for SCRATCH_MNT, TEST_DIR, TEST_DEV, SCRATCH_DEV etc. After defining default device settings say in configs/devices.config, one can use: (. configs/devices.config; ./check -s xfs_4k tests/selftest/001) Note: make clean will clean the configs/all-fs.config file. Co-developed-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@xxxxxxxxx> Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@xxxxxxxxx> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@xxxxxxxxx> --- Makefile | 3 ++- common/config | 1 + configs/Makefile | 26 ++++++++++++++++++++++++++ configs/btrfs.config | 4 ++++ configs/devices.config.example | 9 +++++++++ configs/ext4.config | 9 +++++++++ configs/xfs.config | 9 +++++++++ 7 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 configs/Makefile create mode 100644 configs/btrfs.config create mode 100644 configs/devices.config.example create mode 100644 configs/ext4.config create mode 100644 configs/xfs.config diff --git a/Makefile b/Makefile index f955f0d3..490bb59a 100644 --- a/Makefile +++ b/Makefile @@ -41,8 +41,9 @@ endif LIB_SUBDIRS = include lib TOOL_SUBDIRS = ltp src m4 common tools +CONFIGS_SUBDIRS = configs -SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS) $(TESTS_DIR) +SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS) $(TESTS_DIR) $(CONFIGS_SUBDIRS) default: include/builddefs ifeq ($(HAVE_BUILDDEFS), no) diff --git a/common/config b/common/config index 2afbda14..b4470951 100644 --- a/common/config +++ b/common/config @@ -554,6 +554,7 @@ known_hosts() { [ "$HOST_CONFIG_DIR" ] || HOST_CONFIG_DIR=`pwd`/configs + [ -f $HOST_CONFIG_DIR/all-fs.config ] && export HOST_OPTIONS=$HOST_CONFIG_DIR/all-fs.config [ -f /etc/xfsqa.config ] && export HOST_OPTIONS=/etc/xfsqa.config [ -f $HOST_CONFIG_DIR/$HOST ] && export HOST_OPTIONS=$HOST_CONFIG_DIR/$HOST [ -f $HOST_CONFIG_DIR/$HOST.config ] && export HOST_OPTIONS=$HOST_CONFIG_DIR/$HOST.config diff --git a/configs/Makefile b/configs/Makefile new file mode 100644 index 00000000..e91bcca1 --- /dev/null +++ b/configs/Makefile @@ -0,0 +1,26 @@ +TOPDIR = .. +include $(TOPDIR)/include/builddefs + +CONFIGS_DIR = $(TOPDIR)/configs +ALL_FS_CONFIG = $(CONFIGS_DIR)/all-fs.config +EXT4_CONFIG = $(CONFIGS_DIR)/ext4.config +XFS_CONFIG = $(CONFIGS_DIR)/xfs.config +BTRFS_CONFIG = $(CONFIGS_DIR)/btrfs.config + +DIRT = $(ALL_FS_CONFIG) +default: $(ALL_FS_CONFIG) + +include $(BUILDRULES) + +# Generate all-fs.config by concatenating required configs/.config files +$(ALL_FS_CONFIG): $(EXT4_CONFIG) $(XFS_CONFIG) $(BTRFS_CONFIG) + @echo "Generating $@" + echo "# all-fs sections" > $@ + echo "[default]" >> $@ + @echo "" >> $@ + @cat $(EXT4_CONFIG) >> $@ + @echo "" >> $@ + @cat $(XFS_CONFIG) >> $@ + @echo "" >> $@ + @cat $(BTRFS_CONFIG) >> $@ + @echo "" >> $@ diff --git a/configs/btrfs.config b/configs/btrfs.config new file mode 100644 index 00000000..1d85e13d --- /dev/null +++ b/configs/btrfs.config @@ -0,0 +1,4 @@ +[btrfs] + FSTYP=btrfs + MKFS_OPTIONS="-f " + MOUNT_OPTIONS="" diff --git a/configs/devices.config.example b/configs/devices.config.example new file mode 100644 index 00000000..48598a4b --- /dev/null +++ b/configs/devices.config.example @@ -0,0 +1,9 @@ +export TEST_DIR=/mnt1/test +export SCRATCH_MNT=/mnt1/scratch +export TEST_DEV=/dev/loop0 +export SCRATCH_DEV=/dev/loop1 +export TEST_LOGDEV=/dev/loop2 +export SCRATCH_LOGDEV=/dev/loop3 +export TEST_RTDEV=/dev/loop4 +export SCRATCH_RTDEV=/dev/loop5 +export LOGWRITES_DEV=/dev/loop6 diff --git a/configs/ext4.config b/configs/ext4.config new file mode 100644 index 00000000..d5ceba3c --- /dev/null +++ b/configs/ext4.config @@ -0,0 +1,9 @@ +[ext4_1k] + FSTYP=ext4 + MKFS_OPTIONS="-F -b 1024" + MOUNT_OPTIONS="" + +[ext4_4k] + FSTYP=ext4 + MKFS_OPTIONS="-F -b 4096" + MOUNT_OPTIONS="" diff --git a/configs/xfs.config b/configs/xfs.config new file mode 100644 index 00000000..516f35f7 --- /dev/null +++ b/configs/xfs.config @@ -0,0 +1,9 @@ +[xfs_1k] + FSTYP=xfs + MKFS_OPTIONS="-f -bsize=1024" + MOUNT_OPTIONS="" + +[xfs_4k] + FSTYP=xfs + MKFS_OPTIONS="-f -bsize=4096" + MOUNT_OPTIONS="" -- 2.39.5