From patchwork Thu Apr 6 05:43:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9666041 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 4A2A2602B8 for ; Thu, 6 Apr 2017 05:43:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BD08284CF for ; Thu, 6 Apr 2017 05:43:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3033C284FE; Thu, 6 Apr 2017 05:43:51 +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 C6F2B284CF for ; Thu, 6 Apr 2017 05:43:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754911AbdDFFnu (ORCPT ); Thu, 6 Apr 2017 01:43:50 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:33195 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751597AbdDFFnt (ORCPT ); Thu, 6 Apr 2017 01:43:49 -0400 Received: by mail-wr0-f194.google.com with SMTP id g19so8015895wrb.0; Wed, 05 Apr 2017 22:43:48 -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=3CkSO6C23/iaeMb9OMfbNXHvSrwfFx0ktHiWZDIBVNM=; b=Y3WKbL5QjgEfhR1kVBTyuuOc6r8GEhskE8A0e8KR9X0x5f6Rbt3Eg5wKcSlNXqopoU 4CRmLMYQPy+TEtYk1GzyncfewjboZj7eR1mUbjuPAZftHjXre/YyPJI+S6c4CnutkWup NDmoK7zpy2deAME9W7Rs/G7QVLh4hfpckc64rTcqyT3oz+1x3iJDdJhlXVv+qsWQaJLs bRuYCxytybSWJNt9CYX+947noVy0IlrDkEHgyetg5D3bbECoZLaPz8cU3JvwL5MdtIT4 xBw6KPpiv4mzols4RRL9tpVUYSoAn4fZfOwpVTMynwknJ45hYd3kSavqqw3IvTQeWlUU m2ww== 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=3CkSO6C23/iaeMb9OMfbNXHvSrwfFx0ktHiWZDIBVNM=; b=VmzeMfb10uAXmgaax3xcFaJhL0MXQIPImXpaSTvnhzEKVqOAUCPfkzXub7CVkXY+AX tmgWNLMyFiFM4d5NLzwpLAzL+dukBeN7xQ22ddYKaKS2vtipcGAyEOsF5xqHewsKCqFh PwLj28NrdghKnRr7teqco2cu5DgHCKU+DaQsOtC6z65jixmo/hyF9nkY0QpylM0veBwH 2s1dxmw1Yf46NO/k1aoeJ1EbI9xmjR3FPo0c7PUTIlDEjz5ZXQ1rv0lav7+2nF5zbnKR 6hUE8Ri9xv4j0KzHOAwWQANmZKkyNq6OTCubVplB7iysa5BikkfHw9zMK7cYLqMK82Vd iMWw== X-Gm-Message-State: AFeK/H0J5vwo5xlL5tQVtDBO/l/lOW4J4c9B4Czxy9c82/uKMgSmZJ6qTibEP1Ze+ojJ9A== X-Received: by 10.223.135.113 with SMTP id 46mr30235606wrz.95.1491457427773; Wed, 05 Apr 2017 22:43:47 -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 r5sm657181wra.50.2017.04.05.22.43.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 05 Apr 2017 22:43:47 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , Xiong Zhou , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH v3 1/3] fstests: _require_chattr() must get an input arg Date: Thu, 6 Apr 2017 08:43:52 +0300 Message-Id: <1491457434-7359-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/generic/079 | 2 +- tests/overlay/027 | 2 +- 3 files changed, 16 insertions(+), 13 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/generic/079 b/tests/generic/079 index 5cceeba..97b4812 100755 --- a/tests/generic/079 +++ b/tests/generic/079 @@ -48,7 +48,7 @@ _cleanup() _supported_fs generic _supported_os Linux -_require_chattr i +_require_chattr ia _require_scratch [ -x $timmutable ] || _notrun "t_immutable was not built for this platform" 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