public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Martin Doucha <mdoucha@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 3/3] Add test for NFS directory listing regression
Date: Tue, 23 Nov 2021 10:49:16 +0100	[thread overview]
Message-ID: <YZy5HNteJmoicTtJ@pevik> (raw)
In-Reply-To: <20211118172313.20159-3-mdoucha@suse.cz>

Hi Martin,

Cc: Alexey
...
> +++ b/testcases/network/nfs/nfs_stress/Makefile
> @@ -15,6 +15,7 @@ INSTALL_TARGETS		:= nfs_lib.sh \
>  			   nfs03 \
>  			   nfs04 \
>  			   nfs05 \
> -			   nfs06
> +			   nfs06 \
> +			   nfs07.sh
+ 1 for .sh name, we should later add it to the rest of NFS shell scripts.

>  include $(top_srcdir)/include/mk/generic_leaf_target.mk
> diff --git a/testcases/network/nfs/nfs_stress/nfs07.sh b/testcases/network/nfs/nfs_stress/nfs07.sh
> new file mode 100755
> index 000000000..d8e482751
> --- /dev/null
> +++ b/testcases/network/nfs/nfs_stress/nfs07.sh
> @@ -0,0 +1,56 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2021 SUSE LLC <mdoucha@suse.cz>
> +#
> +#  DESCRIPTION: Create a large number of files and directories on NFS volume.
> +#  Then check whether they can be listed via NFS.
> +
> +FILE_COUNT=5000
> +
> +TST_OPTS="n:"
> +TST_PARSE_ARGS=do_parse_args
> +TST_TESTFUNC="do_test"
> +TST_SETUP="do_setup"
> +
> +do_parse_args()
> +{
> +	case "$1" in
> +	n) FILE_COUNT="$2";;
> +	esac
nit: nfs07.sh -h does not list this, would you care to add TST_USAGE?

> +}
> +
> +. nfs_lib.sh
> +
> +do_setup()
> +{
> +	nfs_setup
> +
> +	local rpath=$(nfs_get_remote_path)
> +	tst_rhost_run -s -c "touch $rpath/file{1..$FILE_COUNT}"
> +	tst_rhost_run -s -c "mkdir $rpath/dir{1..$FILE_COUNT}"
Unfortunately {1..$FILE_COUNT} is bashism (not work at least on dash).
Could you please rewrite it to using for cycle and seq?
It might be reasonably slower on bash, but working everywhere.

The rest LGTM, good idea to add this test.

Kind regards,
Petr

> +}
> +
> +do_test()
> +{
> +	local count
> +
> +	# Pass the list of files through `sort -u` in case `ls` doesn't fitler
> +	# out potential duplicate filenames returned by buggy NFS
> +	count=`ls | grep '^file' | sort -u | wc -l`
> +
> +	if [ $count -ne $FILE_COUNT ]; then
> +		tst_res TFAIL "Listing files failed: $count != $FILE_COUNT"
> +		return
> +	fi
> +
> +	count=`ls | grep '^dir' | sort -u | wc -l`
> +
> +	if [ $count -ne $FILE_COUNT ]; then
> +		tst_res TFAIL "Listing dirs failed: $count != $FILE_COUNT"
> +		return
> +	fi
> +
> +	tst_res TPASS "All files and directories were correctly listed"
> +}
> +
> +tst_run

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      reply	other threads:[~2021-11-23  9:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18 17:23 [LTP] [PATCH 1/3] nfs_lib.sh: Add nfs_get_remote_path() Martin Doucha
2021-11-18 17:23 ` [LTP] [PATCH 2/3] nfs_lib.sh: Add support for test-specific parameters Martin Doucha
2021-11-18 17:23 ` [LTP] [PATCH 3/3] Add test for NFS directory listing regression Martin Doucha
2021-11-23  9:49   ` Petr Vorel [this message]

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=YZy5HNteJmoicTtJ@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=mdoucha@suse.cz \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox