From patchwork Thu Feb 16 19:57:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9578279 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 2376860244 for ; Thu, 16 Feb 2017 19:57:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4B4827C05 for ; Thu, 16 Feb 2017 19:57:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99C2828471; Thu, 16 Feb 2017 19:57:24 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 3E96B27C05 for ; Thu, 16 Feb 2017 19:57:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933135AbdBPT5X (ORCPT ); Thu, 16 Feb 2017 14:57:23 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:35974 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933083AbdBPT5X (ORCPT ); Thu, 16 Feb 2017 14:57:23 -0500 Received: by mail-wr0-f193.google.com with SMTP id z61so2495439wrc.3; Thu, 16 Feb 2017 11:57:22 -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=Qn+Xf8PlG8umj+vL4U6+gjFPRu8ql6gjB3epxcQCllM=; b=FXjvRP600tLrno+RZ7kZ4lf8vSS3xuKkTolq3no4zwhUP3/+C+L5N60EiLYdfFbRgz /+2j1kb25cDSWHMRa+hl430DMEXCwDt5iyagvUJHGsu5cSxceuuPysvIj9YJgJtjqOkV Cb/05DX93ASe1Et6zAwWjsqmNfRsGFRWCH4YnFQvu2+EHaXsork/5PpFEaiVrLo4qvkJ 5JecPfW+LA1f12uLDWJcT6d3llwexIDQgJH5Cc2bzy/Ie82BQib8awnv/nHyEu84TItk vPeSQpHzNLm/GpP1ItuSh03d3KaKrWo+JWjFLoGaMQXju7ByMtnbJH2X71iiMpiETtRo P3lg== 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=Qn+Xf8PlG8umj+vL4U6+gjFPRu8ql6gjB3epxcQCllM=; b=s24H9LPHdTnuBTfn0yrDqq6d5361s03aYrVIBj6nKc+PhEfxhJ7B5ZaILDD8toOdEo Tipv7z3jCU7uGwr/Lba8JDEd7k9BZFmr+j+TMPkmrG6jXkXyrqgYykhZPes1ffOsvR8S undUyzC5Xavo+GkCs3FL8gJUkYQ4tZg6PaKdMGz4jjjk1uss9K8ecppzmzoa87L39aaO 8Jve93PjPaK7EOQQYPtYa0LiWPKXEKA/VCnmpr8CQ9nf52tVr8BBRXUv3A+Q6zZTQNIL W4CiBtNy3kRCN8ml5/hSGpOpnqKY3amsRHx9HJZHdfdKWOeQh4CBFEu6OGPpFAw1NvCd O0UQ== X-Gm-Message-State: AMke39kqeg/8ZDJhBIJm1zN6e/IebhhsoSOi9s9SGIbrdQmjpgkR1qZLn8+cEFlz232G8Q== X-Received: by 10.223.169.114 with SMTP id u105mr3805104wrc.173.1487275041625; Thu, 16 Feb 2017 11:57:21 -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 c9sm1437210wmf.18.2017.02.16.11.57.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Feb 2017 11:57:21 -0800 (PST) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH v4 02/10] fstests: use _test_mount() consistently Date: Thu, 16 Feb 2017 21:57:00 +0200 Message-Id: <1487275028-29885-3-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487275028-29885-1-git-send-email-amir73il@gmail.com> References: <1487275028-29885-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 | 16 ++++++++-------- common/rc | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/check b/check index 5a93c94..68f070b 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,18 +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 + if ! _test_mount + then + echo "check: failed to mount $TEST_DEV on $TEST_DIR" status=1 exit 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 + if ! _test_mount + then + echo "check: failed to mount $TEST_DEV on $TEST_DIR" status=1 exit fi diff --git a/common/rc b/common/rc index b9c5541..debef5e 100644 --- a/common/rc +++ b/common/rc @@ -1491,9 +1491,9 @@ _require_test() [ $err -le 1 ] || exit 1 if [ $err -ne 0 ] 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