[RFC,v5,7/7] btrfs-progs: add test override for mkfs to use different checksums
diff mbox series

Message ID 20190925133728.18027-8-jthumshirn@suse.de
State New
Headers show
Series
  • btrfs-progs: support xxhash64 checksums
Related show

Commit Message

Johannes Thumshirn Sept. 25, 2019, 1:37 p.m. UTC
Similar to check's test overrides add an override for mkfs tests so we can
specify different mkfs flags.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 tests/common                                | 10 ++++++++--
 tests/mkfs-tests/001-basic-profiles/test.sh |  8 +++++++-
 2 files changed, 15 insertions(+), 3 deletions(-)

Comments

David Sterba Sept. 25, 2019, 5:20 p.m. UTC | #1
On Wed, Sep 25, 2019 at 03:37:28PM +0200, Johannes Thumshirn wrote:
> Similar to check's test overrides add an override for mkfs tests so we can
> specify different mkfs flags.
> 
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
>  tests/common                                | 10 ++++++++--
>  tests/mkfs-tests/001-basic-profiles/test.sh |  8 +++++++-
>  2 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/common b/tests/common
> index 75e5540155cc..5148820bef58 100644
> --- a/tests/common
> +++ b/tests/common
> @@ -473,16 +473,22 @@ prepare_test_dev()
>  # $1-$n: optional, default is -f
>  run_check_mkfs_test_dev()
>  {
> +	MKFS_ARGS="$@"
> +
>  	setup_root_helper
>  
>  	# check accidental files/devices passed
> -	for opt in "$@"; do
> +	for opt in "$MKFS_ARGS"; do
>  		if [ -f "$opt" -o -b "$opt" ]; then
>  			_fail "ERROR: unexpected option for run_check_mkfs_test_dev: device"
>  		fi
>  	done
>  
> -	run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$@" "$TEST_DEV"
> +	if [ "$TEST_ENABLE_OVERRIDE" = 'true' ]; then
> +		MKFS_ARGS="$TEST_ARGS_MKFS $MKFS_ARGS"
> +	fi
> +
> +	run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$MKFS_ARGS" "$TEST_DEV"
>  }
>  
>  run_check_mount_test_dev()
> diff --git a/tests/mkfs-tests/001-basic-profiles/test.sh b/tests/mkfs-tests/001-basic-profiles/test.sh
> index 6e295274119d..e0110c722555 100755
> --- a/tests/mkfs-tests/001-basic-profiles/test.sh
> +++ b/tests/mkfs-tests/001-basic-profiles/test.sh
> @@ -21,7 +21,13 @@ test_get_info()
>  }
>  test_do_mkfs()
>  {
> -	run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$@"
> +	MKFS_ARGS="$@"
> +
> +	if [ "$TEST_ENABLE_OVERRIDE" = 'true' ]; then
> +		MKFS_ARGS="$TEST_ARGS_MKFS $MKFS_ARGS"
> +	fi
> +
> +	run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$MKFS_ARGS"

This is supposed to be transparent for all tests, so all the override
happens inside tests/common in _cmd_spec, so all what's needed is to add
a line to the 'case'.

Patch
diff mbox series

diff --git a/tests/common b/tests/common
index 75e5540155cc..5148820bef58 100644
--- a/tests/common
+++ b/tests/common
@@ -473,16 +473,22 @@  prepare_test_dev()
 # $1-$n: optional, default is -f
 run_check_mkfs_test_dev()
 {
+	MKFS_ARGS="$@"
+
 	setup_root_helper
 
 	# check accidental files/devices passed
-	for opt in "$@"; do
+	for opt in "$MKFS_ARGS"; do
 		if [ -f "$opt" -o -b "$opt" ]; then
 			_fail "ERROR: unexpected option for run_check_mkfs_test_dev: device"
 		fi
 	done
 
-	run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$@" "$TEST_DEV"
+	if [ "$TEST_ENABLE_OVERRIDE" = 'true' ]; then
+		MKFS_ARGS="$TEST_ARGS_MKFS $MKFS_ARGS"
+	fi
+
+	run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$MKFS_ARGS" "$TEST_DEV"
 }
 
 run_check_mount_test_dev()
diff --git a/tests/mkfs-tests/001-basic-profiles/test.sh b/tests/mkfs-tests/001-basic-profiles/test.sh
index 6e295274119d..e0110c722555 100755
--- a/tests/mkfs-tests/001-basic-profiles/test.sh
+++ b/tests/mkfs-tests/001-basic-profiles/test.sh
@@ -21,7 +21,13 @@  test_get_info()
 }
 test_do_mkfs()
 {
-	run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$@"
+	MKFS_ARGS="$@"
+
+	if [ "$TEST_ENABLE_OVERRIDE" = 'true' ]; then
+		MKFS_ARGS="$TEST_ARGS_MKFS $MKFS_ARGS"
+	fi
+
+	run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$MKFS_ARGS"
 }
 
 test_mkfs_single()