From patchwork Tue Apr 8 15:42:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Czerner X-Patchwork-Id: 3949681 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 54E389F3E2 for ; Tue, 8 Apr 2014 15:43:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 84FA5203B8 for ; Tue, 8 Apr 2014 15:43:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A9389203B7 for ; Tue, 8 Apr 2014 15:43:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757477AbaDHPnD (ORCPT ); Tue, 8 Apr 2014 11:43:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35807 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756885AbaDHPnB (ORCPT ); Tue, 8 Apr 2014 11:43:01 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s38FgtoZ009542 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 8 Apr 2014 11:42:56 -0400 Received: from localhost.localdomain.com (dhcp-1-245.brq.redhat.com [10.34.1.245]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s38FgrQ6022692; Tue, 8 Apr 2014 11:42:54 -0400 From: Lukas Czerner To: xfs@oss.sgi.com Cc: linux-btrfs@vger.kernel.org, fdmanana@gmail.com, david@fromorbit.com, Lukas Czerner Subject: [PATCH 1/3] xfstests: Fix SCRATCH_DEV_POOL handling Date: Tue, 8 Apr 2014 17:42:48 +0200 Message-Id: <1396971770-23553-1-git-send-email-lczerner@redhat.com> In-Reply-To: <20140404211224.GX17603@dastard> References: <20140404211224.GX17603@dastard> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With changes introduced in 667308dd97bf41382d4ab299fa5b56c235cfeb27 it is no longer possible to use SCRATCH_DEV_POOL variable because of error: common/config: Error: $SCRATCH_DEV should be unset when $SCRATCH_DEV_POOL is set This was because get_next_config() would get called twice and hence it would complain on the second run that SCRATCH_DEV is already set. Fix it by making sure that we call get_next_config() only once if there are no sections in the config file. Also make sure that we export SCRATCH_DEV in the case we're deducing it from SCRATCH_DEV_POOL. Signed-off-by: Lukas Czerner Reported-by: Filipe David Manana Tested-by: Filipe David Manana --- common/config | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/config b/common/config index 4178c27..6fa18e2 100644 --- a/common/config +++ b/common/config @@ -360,6 +360,10 @@ parse_config_section() { } get_next_config() { + if [ ! -z "$CONFIG_INCLUDED" ] && ! $OPTIONS_HAVE_SECTIONS; then + return 0 + fi + local OLD_FSTYP=$FSTYP local OLD_MOUNT_OPTIONS=$MOUNT_OPTIONS local OLD_MKFS_OPTIONS=$MKFS_OPTIONS @@ -414,10 +418,11 @@ get_next_config() { # to SCRATCH_DEV and rest to SCRATCH_DEV_POOL to maintain the backward compatibility if [ ! -z "$SCRATCH_DEV_POOL" ]; then if [ ! -z "$SCRATCH_DEV" ]; then - echo "common/config: Error: \$SCRATCH_DEV should be unset when \$SCRATCH_DEV_POOL is set" + echo "common/config: Error: \$SCRATCH_DEV ($SCRATCH_DEV) should be unset when \$SCRATCH_DEV_POOL ($SCRATCH_DEV_POOL) is set" exit 1 fi SCRATCH_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $1}'` + export SCRATCH_DEV fi echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1