From patchwork Thu Apr 6 05:49:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9666047 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 5D35B602B8 for ; Thu, 6 Apr 2017 05:49:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D9DD284FF for ; Thu, 6 Apr 2017 05:49:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4271528573; Thu, 6 Apr 2017 05:49:17 +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 D6EF3284FF for ; Thu, 6 Apr 2017 05:49:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753041AbdDFFtQ (ORCPT ); Thu, 6 Apr 2017 01:49:16 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:36338 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752298AbdDFFtP (ORCPT ); Thu, 6 Apr 2017 01:49:15 -0400 Received: by mail-wr0-f195.google.com with SMTP id o21so2924945wrb.3; Wed, 05 Apr 2017 22:49:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=+eL43pmYKX5JowQ4L6byPhwpSFzMi2rpBTQxcHc/8bM=; b=AYnhnz3teE3ToS3g2J2FTP6/kc093iUVudKhKmLXlQ+3er2qTLIW3AowDDcHrDE/Nu DzNg1uJQt2Qba/4GRk3AFKiH2YdiHwbhVw8YprhvakbyGCr320KF58cAzzGhKVq51KEk 8QqribVBkK4K8lXOF28K2LYVTzB33H58Y46D5oXhjXHGLkFT0TmkBZ4R3sLB5urDJzZw zcJcfpdkqF9GA5qMBuCCIESeTGRSqoo2L036s3YCwnbVgUJvleVysLU+IQ6lGrhS9dgE t1NMVZyXGqh9MIK1Zm4sUEq7fb+b8d7CnD3WEKgrCrOd67oc8ZPM28SyikGrPKb4UB1M 1FvA== 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; bh=+eL43pmYKX5JowQ4L6byPhwpSFzMi2rpBTQxcHc/8bM=; b=Yv3iC1QOaMsXDGjfxnYKsNHkz1WMcgXkUbNTB0RqXrhq+OKon4ObkJp5vvacPUIvh8 ASmsqbw9lhGUAgAYUSOzz80c1Huuv6m59NvISfyuApLu6S3HI5+SZrfxSqU5UXpDw4/H o+6DFaM8U1X3KETE5oPkGp9xUwDDta+MT+vlemYvCfE0rTy7D6cODx8mMIOVsAf3Eq5T Famn9fDVaYF9AyC4v4QjnVWfPL7x5Pxu966ChC0S0OxZ8u6na8XPDQXnlbaovXkcqzWB 9xE3CMRpeGqvPwu96VtWLvFK3D+jtR0C4lWw9HH3Dh2kIsgteYfDFhADBE03FIkNE+3v T49w== X-Gm-Message-State: AFeK/H1N5FJPPzLIHlx5FFdRHNE0v/72WcKf6ifo3zy8a4YpkzXHye3PeYmZhrOpxEr62A== X-Received: by 10.223.135.13 with SMTP id a13mr28837284wra.87.1491457754084; Wed, 05 Apr 2017 22:49:14 -0700 (PDT) Received: from amir-VirtualBox.lan (bzq-79-176-107-16.red.bezeqint.net. [79.176.107.16]) by smtp.gmail.com with ESMTPSA id l90sm24983968wmi.25.2017.04.05.22.49.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 05 Apr 2017 22:49:13 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , Xiong Zhou , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH v4 1/3] fstests: _require_chattr() must get an input arg Date: Thu, 6 Apr 2017 08:49:18 +0300 Message-Id: <1491457760-9240-1-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP _require_chattr() was never intended to be called without an input argument (specifiying the required attribute to set). However, calling it without input arguments did work and error was silently discarded into full test output. Fix the function to abort on missing input argument and fix the only test that called _require_chattr() with no input argument. Signed-off-by: Amir Goldstein --- common/rc | 25 ++++++++++++++----------- tests/overlay/027 | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/common/rc b/common/rc index e1ab2c6..ae3add3 100644 --- a/common/rc +++ b/common/rc @@ -3134,18 +3134,21 @@ _require_test_lsattr() _require_chattr() { - attribute=$1 - - touch $TEST_DIR/syscalltest - chattr "+$attribute" $TEST_DIR/syscalltest > $TEST_DIR/syscalltest.out 2>&1 - status=$? - chattr "-$attribute" $TEST_DIR/syscalltest > $TEST_DIR/syscalltest.out 2>&1 - if [ "$status" -ne 0 ]; then - _notrun "file system doesn't support chattr +$attribute" - fi - cat $TEST_DIR/syscalltest.out >> $seqres.full + if [ -z "$1" ]; then + echo "Usage: _require_chattr " + exit 1 + fi + local attribute=$1 - rm -f $TEST_DIR/syscalltest.out + touch $TEST_DIR/syscalltest + chattr "+$attribute" $TEST_DIR/syscalltest > $TEST_DIR/syscalltest.out 2>&1 + status=$? + chattr "-$attribute" $TEST_DIR/syscalltest > $TEST_DIR/syscalltest.out 2>&1 + if [ "$status" -ne 0 ]; then + _notrun "file system doesn't support chattr +$attribute" + fi + cat $TEST_DIR/syscalltest.out >> $seqres.full + rm -f $TEST_DIR/syscalltest.out } _get_total_inode() diff --git a/tests/overlay/027 b/tests/overlay/027 index 10111b7..90da4e7 100755 --- a/tests/overlay/027 +++ b/tests/overlay/027 @@ -57,7 +57,7 @@ rm -f $seqres.full _supported_fs overlay _supported_os Linux _require_scratch -_require_chattr +_require_chattr i # Remove all files from previous tests _scratch_mkfs