From patchwork Sun Jan 28 09:22:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10187757 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 8030E602C8 for ; Sun, 28 Jan 2018 09:21:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FCEA28A15 for ; Sun, 28 Jan 2018 09:21:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 710A228A28; Sun, 28 Jan 2018 09:21:43 +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 E4CF028A15 for ; Sun, 28 Jan 2018 09:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751524AbeA1JVm (ORCPT ); Sun, 28 Jan 2018 04:21:42 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:38559 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751363AbeA1JVi (ORCPT ); Sun, 28 Jan 2018 04:21:38 -0500 Received: by mail-wm0-f67.google.com with SMTP id 141so28118687wme.3; Sun, 28 Jan 2018 01:21:38 -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=BR7ZGBMzZ4/EL/ON4jI8mnjsDs8Cjh5N7NLG2z/oshQ=; b=QaeEGDEriR+GxumjW81iFewNWrXQYscB7DuEWTA5ylUlvii3ctc8l6qFv7QpE6sz87 YZPeCor4U8htePo5FWWHi4b9A6vN+4l15vcXeFUJwO09fvMuEtRRQimTtIZzMPpZpp05 ggKmGvTx1ymNsUb1YX17D3QL0zMtlu4/BpuF9SDIQDn2qnWKgBgMaRP/RF24EVceGLOo pOWg/fvaLojCUv2w8ASgNsfBh0hV0fi52DsvsyxhWnKzwOqvuVC9ZAIJAopqbbb78Rmq NYF+nwZFnFcqPJ/RFYIziKjozBu/F8e5o1AyetwkP75KdEEqYO+not4kjeHzgIofEFI7 qtXg== 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=BR7ZGBMzZ4/EL/ON4jI8mnjsDs8Cjh5N7NLG2z/oshQ=; b=LT20pdyFK4uFxX8yjq5lTODHlbN1EsLC7fZKeC0IE36B3M4sOl6vXkWLqPASWdSZ78 qjez1RjcLGv4anTFdN+hX0dgFy5OM2NMhXBaHVLFikM97rarSisoApYtjpj8Hh+cvdNJ sJc4lhkTCW3HKAxkF7SCwjMj4/YAmsy35fEwNLZYrT69Be+YyQ/A5VDYxANU5dyOBwj9 awfgpTNocA0N9uoWayZyywYrjxbmwmmYrtoFltHVZIWbkDSisL7mSvprwh3oExFD0T+5 9JNF8HxuOxt5cby7rWw2lOw5K+JiH1FvDsnOQfG5dte34fFpbJ/dnNK1qck1jukRhuzR XJDw== X-Gm-Message-State: AKwxyteMwrbcriONr3obiqlDrhYCFTBWnSumfltNB6y3FrM5mWEzU4Ji lEJWhqBUuF8HSNKadgr+jj8= X-Google-Smtp-Source: AH8x2272W2+J2wD4ZNk0FIFdlBMOgw+2FxTGaNjbWRnoLTS1gDchUrpKRSgrVwprtZEdQa1DFvZA/A== X-Received: by 10.28.213.77 with SMTP id m74mr15866092wmg.137.1517131297363; Sun, 28 Jan 2018 01:21:37 -0800 (PST) Received: from amir-VirtualBox.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id l41sm20676260wrl.1.2018.01.28.01.21.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 28 Jan 2018 01:21:36 -0800 (PST) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH v3 1/5] fstests: implement require of multiple overlayfs features Date: Sun, 28 Jan 2018 11:22:32 +0200 Message-Id: <1517131356-8048-2-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517131356-8048-1-git-send-email-amir73il@gmail.com> References: <1517131356-8048-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 Some overlayfs features must be checked together, because they cannot be enabled without a dependent feature (e.g. nfs_export and index). Signed-off-by: Amir Goldstein --- common/overlay | 23 ++++++++++++++++++++--- common/rc | 15 +++++++++------ 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/common/overlay b/common/overlay index 1da4ab1..38fe994 100644 --- a/common/overlay +++ b/common/overlay @@ -138,9 +138,6 @@ _require_scratch_overlay_feature() [ "$default" = Y ] || [ "$default" = N ] || \ _notrun "feature '${feature}' not supported by ${FSTYP}" - _scratch_mkfs > /dev/null 2>&1 - _scratch_mount -o ${feature}=on || \ - _notrun "${FSTYP} feature '${feature}' cannot be enabled on ${SCRATCH_DEV}" # Check options to be sure. For example, Overlayfs will fallback to # index=off if underlying fs does not support file handles. # Overlayfs only displays mount option if it differs from the default. @@ -149,5 +146,25 @@ _require_scratch_overlay_feature() ( [ "$default" = Y ] && ! _fs_options $SCRATCH_DEV | grep -q "${feature}=off" )) && \ touch $SCRATCH_MNT/foo 2>/dev/null ) || \ _notrun "${FSTYP} feature '${feature}' cannot be enabled on ${SCRATCH_DEV}" +} + +# Require a set of overlayfs features +_require_scratch_overlay_features() +{ + local features=( $* ) + local opts="rw" + + for feature in ${features[*]}; do + opts+=",${feature}=on" + done + + _scratch_mkfs > /dev/null 2>&1 + _scratch_mount -o $opts || \ + _notrun "overlay options '$opts' cannot be enabled on ${SCRATCH_DEV}" + + for feature in ${features[*]}; do + _require_scratch_overlay_feature ${feature} + done + _scratch_unmount } diff --git a/common/rc b/common/rc index 77a4eb4..3b81061 100644 --- a/common/rc +++ b/common/rc @@ -3658,22 +3658,25 @@ _get_fs_sysfs_attr() cat /sys/fs/${FSTYP}/${dname}/${attr} } -# Generic test for specific filesystem feature. +# Generic test for specific filesystem features. # Currently only implemented to test overlayfs features. -_require_scratch_feature() +_require_scratch_features() { - local feature=$1 - case "$FSTYP" in overlay) - _require_scratch_overlay_feature ${feature} + _require_scratch_overlay_features $* ;; *) - _fail "Test for feature '${feature}' of ${FSTYP} is not implemented" + _fail "Test for features '$*' of ${FSTYP} is not implemented" ;; esac } +_require_scratch_feature() +{ + _require_scratch_features $1 +} + init_rc ################################################################################