btrfs-progs/tests/common.local
Lu Fengqi a0e44021ab btrfs-progs: check: Fix lowmem mode override to allow it skip repair work
Current common.local doesn't handle lowmem mode well.
It passes "--mode=lowmem" alone with "--repair", making it unable to
check lowmem mode.

It's caused by the following bugs:

1) Wrong variable in test/common.local
   We should check TEST_ARGS_CHECK, not TEST_CHECK, which is not defined
   so we never return 1.

2) Wrong parameter passed to _cmd_spec() in test/common
   This prevents us from grepping the correct parameters.

Fix it.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:49 +01:00

26 lines
537 B
Bash

#!/bin/bash
#
# additional arguments to various commands
# already defined, eg. via make argument
if [ -n "$TEST_ENABLE_OVERRIDE" ]; then
return
fi
# set to 'true'
TEST_ENABLE_OVERRIDE=false
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
# break tests
_skip_spec()
{
if echo "$TEST_ARGS_CHECK" | grep -q 'mode=lowmem' &&
echo "$@" | grep -q -- '--repair'; then
return 0
fi
return 1
}