From patchwork Tue Feb 28 12:18:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9595333 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 33F2960429 for ; Tue, 28 Feb 2017 12:20:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25CF228452 for ; Tue, 28 Feb 2017 12:20:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A5D1284EC; Tue, 28 Feb 2017 12:20:33 +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 B0160284DC for ; Tue, 28 Feb 2017 12:20:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752307AbdB1MUT (ORCPT ); Tue, 28 Feb 2017 07:20:19 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36388 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751625AbdB1MUQ (ORCPT ); Tue, 28 Feb 2017 07:20:16 -0500 Received: by mail-wm0-f68.google.com with SMTP id r18so2067095wmd.3; Tue, 28 Feb 2017 04:18:46 -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=zleEnjHvEh3Unwt9HNE+NokkQz/4fMwZPtuSZs5Mt3U=; b=Kg0vACOqn+rGRUrxigcvmlaz8uF4fkt3iuh8ZuXYXwcp8DbfBVWQimPWABupdlzcQN lnDOQ8JHu+Odv0VRWGwf9a779uZ4yRww4rq4Atxn9XbF0flEbd7cAVTrbD4gEglbCLWt u6X2cS9Rq8U2W5m/r5+6cD73IHIGiAFoakgVOjo4krftkZdDtfSivTyQaWyjun6kJII4 BzEohPfRqmXLtIpJElt7r59lIqEM1fty+NgsV8+1cSuZbLwS7OUkyajyAoTIz36signu K0pnQK/SrLnOLGUT8974vHRcfmRT0U4/Qm8Iz7jExIoGhVqA6Ecq58nI+naz1V4IU/9v aNaw== 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=zleEnjHvEh3Unwt9HNE+NokkQz/4fMwZPtuSZs5Mt3U=; b=dBfcbtH0fiT6e3Rinpmx7gSQlHOt7IHx+OXrVxLHL/wU9+hOIP2xI8FQ5SOy90IbEI 02vBKlxdVI/2af1AS4iRNnBgAC65jVXkCyJruBMqi1KL2RikISes3YqrgFfj6LwTNh3+ QW2UqqLVXrpOYYby+DfiEIUJZpHhLuNJrtGcGzkBFkebJY69Fx/cnB4vMx4Z43FEhwNF Xv1l/ZooXckDyyEvhM16sFcZAUohPCBfHzEqNjdSv9t2tjph7s/cXrPf0rSgAiuIPmEg 4HVUfEToNJ1Bpd64PeLuYfWlx8NIbwNUhxAes9Ak8FVb9f8Z3o4ivWo6E/24X6MFpbZg MBcw== X-Gm-Message-State: AMke39lkIEfoF3CfAGazZwPmdFEfvTzhdwmrUKX8b+JdObPcBY5an9v0GojIrr2R/Vvx3Q== X-Received: by 10.28.91.196 with SMTP id p187mr713621wmb.132.1488284325558; Tue, 28 Feb 2017 04:18:45 -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 b58sm2105796wra.47.2017.02.28.04.18.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Feb 2017 04:18:45 -0800 (PST) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , Xiong Zhou , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH v5 02/10] fstests: use _test_mount() consistently Date: Tue, 28 Feb 2017 14:18:29 +0200 Message-Id: <1488284317-3119-3-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488284317-3119-1-git-send-email-amir73il@gmail.com> References: <1488284317-3119-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 5d7f75c..fbd12e9 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 dab3cb2..4fa211a 100644 --- a/common/rc +++ b/common/rc @@ -1526,9 +1526,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