From patchwork Sun Feb 12 20:43:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9568507 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 B19DC60476 for ; Sun, 12 Feb 2017 20:43:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A28F1281C3 for ; Sun, 12 Feb 2017 20:43:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 975B028249; Sun, 12 Feb 2017 20:43:58 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 3B68E281C3 for ; Sun, 12 Feb 2017 20:43:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751000AbdBLUn5 (ORCPT ); Sun, 12 Feb 2017 15:43:57 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:34952 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750999AbdBLUn5 (ORCPT ); Sun, 12 Feb 2017 15:43:57 -0500 Received: by mail-wr0-f196.google.com with SMTP id o16so21473685wra.2; Sun, 12 Feb 2017 12:43:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mXOupHZa1VhoJauarFnwdvdKFWTHBL7roSUsJOXGzdw=; b=LG81olBGqNz7DC7SJqMmmrjbvqRjyzjDYt3AoQbaHg5vD9tCYYxkRdVXtsfGxkRTi3 kEbbM4EcKu1CsRJAJzuLD4C9S8wQ9BGMEk/eGdfNoeVrTX4ydoso6GRliVQRkyxG1z6p jDxjpAnJBAFGPFbG5qO5REtAE37amG/lPdrwXZwaIrdTzqBeL5oFdxQpA5kdBYgJob2I o9BbrIVGrbfZTnk9kSEVHVtbm0PvupKNJLtQJxaterNtKyvoFTnrGbLWMxgfmk5wiV9d WKWtKJ+KmdVELCEsoi/8dZB4Vr/J2jeaiYbEiolzJ5Ie4ZtG3Jo5Um/oV0uMghT57GTb uvoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mXOupHZa1VhoJauarFnwdvdKFWTHBL7roSUsJOXGzdw=; b=S81UedtTyeLdG0ywpB8tXpozoge+y8WQyy2ra3oatGi8WqIX3hZVUpcND4A1G0sHPa B5fQvX/XbJrHqBJ7pEbfBYBsB6mYxQqP0jxuiVHN84ztbSnO8o9upVXsZPhPLgGA9gDG /fCuqnAIaN1O7d3eaNtHV/+wria6h+VGtOLNQ4javE9+X+kmgRkfUbR5z9gSaAaGt8Il VITnV4HOEsV2F6coBYOUpf7qTIp07TNFyGJS5w2SSVCC+tbHolPmJUbTqAzStueVo/2O pI8owsZYXwJN/Ra7Puu/OydDKuH+ifgLd/oGTji6AWVlijfXIXvO1RVHasEyxCADK1o8 D8mw== X-Gm-Message-State: AMke39mxCHmncgflGZsLgHrVQHYa3LBLz5z83LgtCUu/qVs3bnwMG5k31eJ+eQDcRMV9Og== X-Received: by 10.223.140.145 with SMTP id a17mr18314445wrb.1.1486932235611; Sun, 12 Feb 2017 12:43:55 -0800 (PST) Received: from localhost.localdomain (bzq-79-176-143-83.red.bezeqint.net. [79.176.143.83]) by smtp.gmail.com with ESMTPSA id o59sm8040404wrc.56.2017.02.12.12.43.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 12 Feb 2017 12:43:55 -0800 (PST) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH v3 2/9] fstests: use _test_mount() consistently Date: Sun, 12 Feb 2017 22:43:37 +0200 Message-Id: <1486932224-17075-3-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486932224-17075-1-git-send-email-amir73il@gmail.com> References: <1486932224-17075-1-git-send-email-amir73il@gmail.com> Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On start of every test run and on every test, in init_rc() helper, the test partition is verified to be mounted, or is mounted by the helper _test_mount(). _test_mount() uses mount options $TEST_FS_MOUNT_OPTS and not $MOUNT_OPTIONS like _scratch_mount() does. _test_cycle_mount(), which is called by some tests uses the _test_mount() helper as well. Contrary to those cases, in _require_test() helper, if test partition is not mounted, the helper _mount_or_remount_rw() is called to mount the test partition with $MOUNT_OPTIONS. Although this should never happen, because of the test in init_rc(), this case is inconsistent with the rest of the code, so it has been changed to use _test_mount() as it should. When running tests with a multi section configuration, and either FSTYP or MOUNT_OPTIONS change between sections, the helper _test_unmount() is called to unmount the old test mount and then _mount_or_remount_rw() is called to mount it again with new FSTYP and/or MOUNT_OPTIONS. This is again inconsistent with the rest of the code, so was changed to use _test_mount() and instead of checking if MOUNT_OPTIONS have changed between sections, we check if TEST_FS_MOUNT_OPTS were changed between sections. Otherwise, we can leave the test partition mounted. This change is needed to support overlay base fs mount and for multi section config files which include overlay FSTYP. Signed-off-by: Amir Goldstein --- check | 22 ++++++++++------------ common/rc | 6 +++--- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/check b/check index 5a93c94..ec9798a 100755 --- a/check +++ b/check @@ -474,7 +474,7 @@ fi for section in $HOST_OPTIONS_SECTIONS; do OLD_FSTYP=$FSTYP - OLD_MOUNT_OPTIONS=$MOUNT_OPTIONS + OLD_TEST_FS_MOUNT_OPTS=$TEST_FS_MOUNT_OPTS get_next_config $section # Do we need to run only some sections ? @@ -527,20 +527,18 @@ for section in $HOST_OPTIONS_SECTIONS; do status=1 exit fi - out=`_mount_or_remount_rw "$MOUNT_OPTIONS" $TEST_DEV $TEST_DIR` - if [ $? -ne 1 ]; then - echo $out - status=1 - exit + if ! _test_mount + then + echo "check: failed to mount $TEST_DEV on $TEST_DIR" + exit 1 fi _prepare_test_list - elif [ "$OLD_MOUNT_OPTIONS" != "$MOUNT_OPTIONS" ]; then + elif [ "$OLD_TEST_FS_MOUNT_OPTS" != "$TEST_FS_MOUNT_OPTS" ]; then _test_unmount 2> /dev/null - out=`_mount_or_remount_rw "$MOUNT_OPTIONS" $TEST_DEV $TEST_DIR` - if [ $? -ne 1 ]; then - echo $out - status=1 - exit + if ! _test_mount + then + echo "check: failed to mount $TEST_DEV on $TEST_DIR" + exit 1 fi fi diff --git a/common/rc b/common/rc index d831b17..00afb31 100644 --- a/common/rc +++ b/common/rc @@ -1485,9 +1485,9 @@ _require_test() if ! _check_mounted_on TEST_DEV $TEST_DEV TEST_DIR $TEST_DIR then - out=`_mount_or_remount_rw "$MOUNT_OPTIONS" $TEST_DEV $TEST_DIR` - if [ $? -ne 1 ]; then - echo $out + if ! _test_mount + then + echo "!!! failed to mount $TEST_DEV on $TEST_DIR" exit 1 fi fi