From patchwork Tue Jan 30 06:12:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10191359 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 D080A60388 for ; Tue, 30 Jan 2018 06:11:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0401286E2 for ; Tue, 30 Jan 2018 06:11:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B52F52891E; Tue, 30 Jan 2018 06:11:25 +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 5B415286E2 for ; Tue, 30 Jan 2018 06:11:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752385AbeA3GLY (ORCPT ); Tue, 30 Jan 2018 01:11:24 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:40479 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752506AbeA3GLX (ORCPT ); Tue, 30 Jan 2018 01:11:23 -0500 Received: by mail-wm0-f67.google.com with SMTP id v123so38033425wmd.5; Mon, 29 Jan 2018 22:11:23 -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=0bWWlUV7RUc3PJfbD96Es1mvBXEhuJfiW7K9bDpyKvs=; b=Zh05hYkf5froXFYk818perhpHK81wIGa4gbRjfavoyZj88lxpajGtCA+ZAY8K1jyTG NGroyiaggHNFIhRXRno4I/3Kkjmy/2TVQ8ZrYHoDwVfzXFQh2qvbGT6kWScNPv0AISpC DIlQtMOiS1G1pHPETik7HkLyka75yRjtnUP6pCaD5+qSs43lxslRsXeA7CTD6R5p6cs2 g+0aK5rQVxRal3l2rdDUeRKotedKytafh3WwJyK+Oivx/yWvc5g746CMlOlN+m3/O3vG QC2paz+Ao47c64S6FZQ5MgQJYv88DNQJsQmbaUTTfMpIPbdGdlq5077CGQ/Y7Mx6/Ey7 c/HQ== 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=0bWWlUV7RUc3PJfbD96Es1mvBXEhuJfiW7K9bDpyKvs=; b=DRxV/bHmHRy7uJeCAOG1vU+K7HKXzazJb2TSNvgZNCw1nQgf9oD//3FZcf9W7lOfyA GOkekrALnVAAkBb+08+VXLzalWBt8tS4gEC5kCYOq+yXAsJe0wilj4338qqvgqGk838M K3UeSU2DT5EzOtJdRHXgWCnNzNo6C+Oa8ddW4gFU71imXyJbhKeJGfkbiO3wTLfLZyKc 85KYyII1vlSwKmadHebfjXcKfEvV7vTesidDJK8TsgfznTMXAhTjvwh8eyUZ0E9IlE4R tDffuf8HpwSFOZ84Rw9v39NLGxWsjqh5HEescaIIk3O4YC/Xb7xk/XtHm51FlsNvxVBn yYNA== X-Gm-Message-State: AKwxytezVk2uDoajM9ZZ/R9lI1IL5LygYmhIcy4V9BfxjiWaGQdHbQns D+sLapwvkCOJj8WBhvHCMnY= X-Google-Smtp-Source: AH8x226W84k7fE8wque+8Y/Viev2G28Efp36imDN0e/E1HNuGpXGt7g+2XMtpdkjTrAwO4bdYWPqYw== X-Received: by 10.28.159.7 with SMTP id i7mr21330790wme.57.1517292682393; Mon, 29 Jan 2018 22:11:22 -0800 (PST) Received: from localhost.localdomain ([141.226.172.80]) by smtp.gmail.com with ESMTPSA id 62sm11384075wrg.57.2018.01.29.22.11.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 29 Jan 2018 22:11:21 -0800 (PST) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH v4 1/5] fstests: implement require of multiple overlayfs features Date: Tue, 30 Jan 2018 08:12:18 +0200 Message-Id: <1517292742-15624-2-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517292742-15624-1-git-send-email-amir73il@gmail.com> References: <1517292742-15624-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 | 27 ++++++++++++++++++++++----- common/rc | 2 +- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/common/overlay b/common/overlay index 1da4ab1..ad2f3be 100644 --- a/common/overlay +++ b/common/overlay @@ -122,8 +122,8 @@ _overlay_scratch_unmount() _overlay_base_unmount "$OVL_BASE_SCRATCH_DEV" "$OVL_BASE_SCRATCH_MNT" } -# Require a specific overlayfs feature -_require_scratch_overlay_feature() +# Check that a specific overlayfs feature is supported +__check_scratch_overlay_feature() { local feature=$1 @@ -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 + __check_scratch_overlay_feature ${feature} + done + _scratch_unmount } diff --git a/common/rc b/common/rc index 2e3a83a..4ad59b1 100644 --- a/common/rc +++ b/common/rc @@ -3726,7 +3726,7 @@ _require_scratch_feature() case "$FSTYP" in overlay) - _require_scratch_overlay_feature ${feature} + _require_scratch_overlay_features ${feature} ;; *) _fail "Test for feature '${feature}' of ${FSTYP} is not implemented"