diff mbox

btrfs-progs: tests: arg override in command line

Message ID 20170928072919.13610-1-suy.fnst@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Su Yue Sept. 28, 2017, 7:29 a.m. UTC
Lowmem mode only repairs few cases which has a beacon file
".lowmem_repairable" in the case' directory.

However, defining TEST_ENABLE_OVERRIDE=true in command line does work
in above strategy.
Because _skip_spec() in tests/common.local isn't interpreted by shell
in that case.

Solve it by making _skip_spec() always be defined in common.local.

Reported-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
---
 tests/common       |  8 ++------
 tests/common.local | 11 +++++------
 2 files changed, 7 insertions(+), 12 deletions(-)

Comments

David Sterba Oct. 5, 2017, 4:53 p.m. UTC | #1
On Thu, Sep 28, 2017 at 03:29:19PM +0800, Su Yue wrote:
> Lowmem mode only repairs few cases which has a beacon file
> ".lowmem_repairable" in the case' directory.
> 
> However, defining TEST_ENABLE_OVERRIDE=true in command line does work
> in above strategy.
> Because _skip_spec() in tests/common.local isn't interpreted by shell
> in that case.

Given that we don't have other major user of the overriding
functionality, I think we can let the _skip_spec do the lowmem + repair
workaround, but otherwise I'd like to keep the _skip_spec function
check. Just in case, as is't supposed to be user-defined. I'll drop the
first hunk and commit the patch. Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tests/common b/tests/common
index eb525a4d..690fee93 100644
--- a/tests/common
+++ b/tests/common
@@ -97,12 +97,8 @@  _get_spec_ins()
 _cmd_spec()
 {
 	if [ "$TEST_ENABLE_OVERRIDE" = 'true' ]; then
-		# if defined via common.local, use it, otherwise pass make
-		# arguments
-		if [ "$(type -t _skip_spec)" = 'function' ]; then
-			if _skip_spec "$@"; then
-				return
-			fi
+		if _skip_spec "$@"; then
+			return
 		fi
 		case "$1" in
 	  		check) echo -n "$TEST_ARGS_CHECK" ;;
diff --git a/tests/common.local b/tests/common.local
index 4864e391..f5e96f5b 100644
--- a/tests/common.local
+++ b/tests/common.local
@@ -3,14 +3,13 @@ 
 # additional arguments to various commands
 
 # already defined, eg. via make argument
-if [ -n "$TEST_ENABLE_OVERRIDE" ]; then
-	return
-fi
+if [ -z "$TEST_ENABLE_OVERRIDE" ]; then
+    # set to 'true'
+    TEST_ENABLE_OVERRIDE=false
 
-# set to 'true'
-TEST_ENABLE_OVERRIDE=false
+    TEST_ARGS_CHECK=--mode=lowmem
+fi
 
-TEST_ARGS_CHECK=--mode=lowmem
 
 # gets arguments of a current command and can decide if the argument insertion
 # should happen, eg. if some option combination does not make sense or would