From patchwork Thu Nov 2 10:15:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10038317 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 263CE603B5 for ; Thu, 2 Nov 2017 10:15:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15C8828EDE for ; Thu, 2 Nov 2017 10:15:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0AB6628EE1; Thu, 2 Nov 2017 10:15:19 +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 B09F828EDE for ; Thu, 2 Nov 2017 10:15:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933353AbdKBKPQ (ORCPT ); Thu, 2 Nov 2017 06:15:16 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:53868 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933301AbdKBKPG (ORCPT ); Thu, 2 Nov 2017 06:15:06 -0400 Received: by mail-wm0-f65.google.com with SMTP id r196so10146240wmf.2; Thu, 02 Nov 2017 03:15:05 -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:in-reply-to:references; bh=Izw/bM94T0ywtDDw5zQl8orp9qtC9d0PE4iWCEUMtrc=; b=HLfH1xZVdfos5NMnqOLu9r4cA6Dbjd5VLy4Ke/KpzyXyheW7NdBV5WvDJrpGhp9gm8 +eRrv+g8DNkr4yF3bBv/upm2SdCcym/C9aIFpIfw/PeiCvn9FDzY/jD/SfsZ/R1dSANJ m4rvdaOpL5iDAymjtYahpAd0HvCdDy2DvhNqYfBqSzOfdBRWHWY0lHnk93X7FpmLwUpv MRmnqTW1u61QMi7owFKpMVr3IAHwZcSVLLv7pRRXWUuyOGCaL4VR3zAN3Zfn4c390wm/ MbMLbd3TAMNRSQL2WJzINRYHD2YIy19fd6gZ0uCJxvA1SGZ4y3VWAJM7/Br8PEQHbSCj s9Cg== 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=Izw/bM94T0ywtDDw5zQl8orp9qtC9d0PE4iWCEUMtrc=; b=snY3JZDkKyARJflgiQUsdUq+IHieufT0AOlVMnIH5LuzH2fGAgBSSmw3PbfwOTxf8t Z6qVydpGuoLvEYUaXkLvePz91J0cypM9c35oRrMfeVf1HKgR5jXNvbetABX0v24WLvr0 TyKE2laBYqg8oi1VT7BmBf8i3eYU7qKfTL1X4o83CTJVxhZSkC1QhuSxEy8inQgWDQxO YUJgbFfIMrB3VHB/PtDXehbYxDgT+cpLpjALIMtMr9wHHehJQaCnWlwvCYVKDW2Tlv/8 mPHxIblY92Fpi51ZMurg74bFHRVW+QieronjlXxuyF5xntLXW7z6WiHLXHeGBZZS4KN6 1wZA== X-Gm-Message-State: AMCzsaVAdMcU+QM8JLsKYiPR0Og3zCQrGPgLJvH6ks9u/88wjIiAr+8x wM8fFM9m5NfOvgfweT80Ec4= X-Google-Smtp-Source: ABhQp+T72rxymiegBDAycsIx2/hSaAjNE7srxmEhYc//J0JGg6RsD6P6LqbZYUCbkgQ8HqxYX2ADeQ== X-Received: by 10.28.96.130 with SMTP id u124mr1147660wmb.121.1509617704305; Thu, 02 Nov 2017 03:15:04 -0700 (PDT) Received: from localhost.localdomain ([31.210.182.123]) by smtp.gmail.com with ESMTPSA id e6sm7190026wrg.53.2017.11.02.03.15.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Nov 2017 03:15:03 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Jeff Layton , "J . Bruce Fields" , Miklos Szeredi , fstests@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-unionfs@vger.kernel.org Subject: [PATCH 6/7] generic/426: factor out helper functions Date: Thu, 2 Nov 2017 12:15:38 +0200 Message-Id: <1509617739-15744-7-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509617739-15744-1-git-send-email-amir73il@gmail.com> References: <1509617739-15744-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 Helper test_file_handles() outputs the sub-test command to output, so if errors are detected in one of the sub-tests, it is easier to know which sub-tests have failed. Signed-off-by: Amir Goldstein --- tests/generic/426 | 40 +++++++++++++++++++++++++++++----------- tests/generic/426.out | 4 ++++ 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/tests/generic/426 b/tests/generic/426 index 2d96c1d..68ff169 100755 --- a/tests/generic/426 +++ b/tests/generic/426 @@ -52,25 +52,43 @@ _require_test _require_test_program "open_by_handle" _require_exportfs -numfiles=1024 +NUMFILES=1024 testdir=$TEST_DIR/$seq-dir mkdir -p $testdir +# Create empty test files in test dir +create_test_files() +{ + local dir=$1 + local opt=$2 + + mkdir -p $dir + rm -f $dir/* + src/open_by_handle -c $dir $NUMFILES +} + +# Test encode/decode file handles +test_file_handles() +{ + local dir=$1 + local opt=$2 + + echo test_file_handles $* | _filter_test_dir + src/open_by_handle $opt $dir $NUMFILES +} + # Check stale handles to deleted files -rm -f $testdir/* -src/open_by_handle -c $testdir $numfiles -src/open_by_handle -d $testdir $numfiles +create_test_files $testdir +test_file_handles $testdir -d # Check non-stale handles to linked files -rm -f $testdir/* -src/open_by_handle -c $testdir $numfiles -src/open_by_handle $testdir $numfiles +create_test_files $testdir +test_file_handles $testdir # Check non-stale handles to files that were hardlinked and original deleted -rm -f $testdir/* -src/open_by_handle -c $testdir $numfiles -src/open_by_handle -l $testdir $numfiles -src/open_by_handle -u $testdir $numfiles +create_test_files $testdir +test_file_handles $testdir -l +test_file_handles $testdir -u echo "Silence is golden" status=0 diff --git a/tests/generic/426.out b/tests/generic/426.out index 777cbcd..9a25123 100644 --- a/tests/generic/426.out +++ b/tests/generic/426.out @@ -1,2 +1,6 @@ QA output created by 426 +test_file_handles TEST_DIR/426-dir -d +test_file_handles TEST_DIR/426-dir +test_file_handles TEST_DIR/426-dir -l +test_file_handles TEST_DIR/426-dir -u Silence is golden