All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: tests: arg override in command line
@ 2017-09-28  7:29 Su Yue
  2017-10-05 16:53 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Su Yue @ 2017-09-28  7:29 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba

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(-)

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
-- 
2.14.1




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] btrfs-progs: tests: arg override in command line
  2017-09-28  7:29 [PATCH] btrfs-progs: tests: arg override in command line Su Yue
@ 2017-10-05 16:53 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2017-10-05 16:53 UTC (permalink / raw)
  To: Su Yue; +Cc: linux-btrfs, dsterba

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-05 16:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-28  7:29 [PATCH] btrfs-progs: tests: arg override in command line Su Yue
2017-10-05 16:53 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.