From patchwork Thu Sep 28 07:29:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Yue X-Patchwork-Id: 9975413 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 749D8603F2 for ; Thu, 28 Sep 2017 07:26:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6585C29402 for ; Thu, 28 Sep 2017 07:26:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A5C9292B2; Thu, 28 Sep 2017 07:26:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5B75292B2 for ; Thu, 28 Sep 2017 07:26:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751933AbdI1H0Z (ORCPT ); Thu, 28 Sep 2017 03:26:25 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:41402 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751883AbdI1H0Y (ORCPT ); Thu, 28 Sep 2017 03:26:24 -0400 X-IronPort-AV: E=Sophos;i="5.42,449,1500912000"; d="scan'208";a="28509416" Received: from localhost (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 28 Sep 2017 15:26:23 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id 709E546BA7A6; Thu, 28 Sep 2017 15:26:18 +0800 (CST) Received: from archlinux.g08.fujitsu.local (10.167.226.129) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 28 Sep 2017 15:26:18 +0800 From: Su Yue To: CC: Subject: [PATCH] btrfs-progs: tests: arg override in command line Date: Thu, 28 Sep 2017 15:29:19 +0800 Message-ID: <20170928072919.13610-1-suy.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 X-Originating-IP: [10.167.226.129] X-yoursite-MailScanner-ID: 709E546BA7A6.AB7D5 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: suy.fnst@cn.fujitsu.com Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Su Yue --- 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