All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Eryu Guan <eguan@redhat.com>
Cc: Jeff Layton <jlayton@poochiereds.net>,
	"J . Bruce Fields" <bfields@fieldses.org>,
	Miklos Szeredi <miklos@szeredi.hu>,
	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	[thread overview]
Message-ID: <1509617739-15744-7-git-send-email-amir73il@gmail.com> (raw)
In-Reply-To: <1509617739-15744-1-git-send-email-amir73il@gmail.com>

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 <amir73il@gmail.com>
---
 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
-- 
2.7.4

  parent reply	other threads:[~2017-11-02 10:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-02 10:15 [PATCH 0/7] More NFS file handle unit tests Amir Goldstein
2017-11-02 10:15 ` [PATCH 1/7] open_by_handle: add filename to error reports Amir Goldstein
2017-11-02 10:15 ` [PATCH 2/7] open_by_handle: test file handles of renamed files Amir Goldstein
2017-11-08  4:10   ` Eryu Guan
2017-11-08  5:07     ` Eryu Guan
2017-11-08  6:11       ` Amir Goldstein
2017-11-02 10:15 ` [PATCH 3/7] open_by_handle: test content of open file handle Amir Goldstein
2017-11-02 10:15 ` [PATCH 4/7] open_by_handle: test directory " Amir Goldstein
2017-11-02 10:15 ` [PATCH 5/7] open_by_handle: test file handles of open files Amir Goldstein
2017-11-02 10:15 ` Amir Goldstein [this message]
2017-11-02 10:15 ` [PATCH 7/7] fstests: add test with more open by file handle use cases Amir Goldstein
2017-11-03 12:22 ` [PATCH 0/7] More NFS file handle unit tests Jeff Layton
2017-11-04 23:23   ` Jeff Layton
2017-11-07 19:54     ` J . Bruce Fields
2017-11-07 20:05 ` J . Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1509617739-15744-7-git-send-email-amir73il@gmail.com \
    --to=amir73il@gmail.com \
    --cc=bfields@fieldses.org \
    --cc=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=jlayton@poochiereds.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.