From patchwork Wed Apr 5 10:47:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9663751 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 5B017602B5 for ; Wed, 5 Apr 2017 10:50:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63B4B2859A for ; Wed, 5 Apr 2017 10:50:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54CAB285AE; Wed, 5 Apr 2017 10:50:14 +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 D448F2859A for ; Wed, 5 Apr 2017 10:50:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933295AbdDEKsg (ORCPT ); Wed, 5 Apr 2017 06:48:36 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:34688 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933219AbdDEKrr (ORCPT ); Wed, 5 Apr 2017 06:47:47 -0400 Received: by mail-wr0-f193.google.com with SMTP id w43so1506841wrb.1; Wed, 05 Apr 2017 03:47:46 -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=pSOzdvop4j0GGqtcBK61GpUD0aauBcto+CvCBGfW8S0=; b=LVEaMZZZkf6tLVLtxwQXNGflC9fHlQE3EMjiZ1tSX4g3yrkAoqCQZiivmvb2nMDQF6 nRsn3VyOttey5Bdjd0J+viz4esB2X0o/jumaXNHbEZDAoGvH56DVZnbCroQOBeEEnH9b SxIgfO8fAEvNALvu/rXnB49NXvEuo5gAZChRUnNmFvT8fNnzGGkV4lWpYNy5uCvWRcfD fo7h5upY5U1ozZ5DKGEWEewSJltC2j+ZJa9B2vFr5jF5fOwcSyPuZJ4ZPmLdKjTOoFC4 /bSBr0pv6XitT6+qIrNg0pE/4UB/mH6Poc+C/MwyJQk+ttqxgQl6hF7XUhLTbhS/nc6J 2LdQ== 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=pSOzdvop4j0GGqtcBK61GpUD0aauBcto+CvCBGfW8S0=; b=CAx12DIOhibEW2hddveEsLqEcabQFh8ZBYVMFh9A7OQjG+AyZvCUxlw0PZw45PAtvF JQv6Dnh67nR+40yJNvXHwDQ3Hi3LVC5RXo+ROZqWFnYEwx11kKUVkJcUbtBnH8wSOhbY ivs9mw6u2rPV5oboqQWX8SwmIBpgmuBJHDAhlHNe1PnYb35yFGfcrhfQaeuvqbxvtKud l5OoployFKte+6FByeETaZEtP0ciFtA/BANsHU2BQpPz6s48f6frlf2V1SLOubpJkORV LJABo4PfQtY0xOv33aadMVei6W4qKEKdZMQ61QmPeGGGETxxKyiib88tXKjp9c0u0XFW HNfA== X-Gm-Message-State: AFeK/H1Xvq9X+XFfFWMWqEQQ+6KugKaikYpVGn16YMo0+RwVNInRyVT65uFAuM1me4QfKg== X-Received: by 10.223.139.221 with SMTP id w29mr25604772wra.18.1491389265896; Wed, 05 Apr 2017 03:47:45 -0700 (PDT) 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 v7sm13610512wrd.0.2017.04.05.03.47.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 05 Apr 2017 03:47:45 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , Xiong Zhou , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH 1/2] fstests: _require_chattr() must get an input arg Date: Wed, 5 Apr 2017 13:47:50 +0300 Message-Id: <1491389271-24726-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 (specifying 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