nfs_lib.sh: Add nfs_get_remote_path()
PATCH v2 1/3 nfs_lib.sh: Add nfs_get_remote_path()
Sometimes it's necessary to manipulate remote NFS directory directly e.g. to simulate external server activity. nfs_get_remote_path() will print the remote path so that it can then be used by tst_rhost_run().
---
Changes since v1: None
testcases/network/nfs/nfs_stress/nfs_lib.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+)
testcases/network/nfs/nfs_stress/nfs_lib.sh +13 -0
@@ -52,6 +52,19 @@ get_socket_type() done } +nfs_get_remote_path() +{ + local v + local type=$(get_socket_type ${2:-0}) + + for v in $VERSION; do + break; + done + + v=${1:-$v} + echo "$TST_TMPDIR/$v/$type" +} + nfs_server_udp_enabled() { local config f
Signature · 5 lines
2.33.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 2/3 nfs_lib.sh: Add support for test-specific parameters
---
Changes since v1: None
testcases/network/nfs/nfs_stress/nfs_lib.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
testcases/network/nfs/nfs_stress/nfs_lib.sh +3 -1
@@ -19,10 +19,12 @@ nfs_parse_args() case "$1" in v) VERSION="$(echo $2 | tr ',' ' ')";; t) SOCKET_TYPE="$(echo $2 | tr ',' ' ')";; + *) [ "$NFS_PARSE_ARGS_CALLER" ] && $NFS_PARSE_ARGS_CALLER "$@";; esac } -TST_OPTS="v:t:" +NFS_PARSE_ARGS_CALLER="$TST_PARSE_ARGS" +TST_OPTS="v:t:$TST_OPTS" TST_PARSE_ARGS=nfs_parse_args TST_USAGE=nfs_usage TST_NEEDS_TMPDIR=1
Signature · 5 lines
2.33.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 2/3] nfs_lib.sh: Add support for test-specific parameters
Hi Martin,
Quoted 4 lines
Signed-off-by Martin Doucha <[email protected]>---
Changes since v1: None
Kind regards,
Petr
Quoted 21 lines
testcases/network/nfs/nfs_stress/nfs_lib.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)testcases/network/nfs/nfs_stress/nfs_lib.sh +3
-1@@ -19,10 +19,12 @@ nfs_parse_args() case "$1" in v) VERSION="$(echo $2 | tr ',' ' ')";; t) SOCKET_TYPE="$(echo $2 | tr ',' ' ')";; + *) [ "$NFS_PARSE_ARGS_CALLER" ] && $NFS_PARSE_ARGS_CALLER "$@";; esac } -TST_OPTS="v:t:" +NFS_PARSE_ARGS_CALLER="$TST_PARSE_ARGS" +TST_OPTS="v:t:$TST_OPTS" TST_PARSE_ARGS=nfs_parse_args TST_USAGE=nfs_usage TST_NEEDS_TMPDIR=1
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 3/3 Add test for NFS directory listing regression
In reply to Martin Doucha---
Changes since v1:
- Replace Bash-style brace expansion with $(seq ...)
- Document command line parameter in usage info
runtest/net.nfs | 11 ++++ testcases/network/nfs/nfs_stress/Makefile | 3 +- testcases/network/nfs/nfs_stress/nfs07.sh | 67 +++++++++++++++++++++++ 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100755 testcases/network/nfs/nfs_stress/nfs07.sh
runtest/net.nfs +11 -0
@@ -61,6 +61,17 @@ nfs01_06 nfs06 -v "3,3,3,4,4,4" -t "udp,udp,tcp,tcp,tcp,tcp" nfs02_06 nfs06 -v "3,4,4.1,4.2,4.2,4.2" -t "udp,tcp,tcp,tcp,tcp,tcp" nfs03_ipv6_06 nfs06 -6 -v "4,4.1,4.1,4.2,4.2,4.2" -t "tcp,tcp,tcp,tcp,tcp,tcp" +nfs3_07 nfs07.sh -v 3 -t udp +nfs3t_07 nfs07.sh -v 3 -t tcp +nfs4_07 nfs07.sh -v 4 -t tcp +nfs41_07 nfs07.sh -v 4.1 -t tcp +nfs42_07 nfs07.sh -v 4.2 -t tcp +nfs3_ipv6_07 nfs07.sh -6 -v 3 -t udp +nfs3t_ipv6_07 nfs07.sh -6 -v 3 -t tcp +nfs4_ipv6_07 nfs07.sh -6 -v 4 -t tcp +nfs41_ipv6_07 nfs07.sh -6 -v 4.1 -t tcp +nfs42_ipv6_07 nfs07.sh -6 -v 4.2 -t tcp + nfslock3_01 nfslock01 -v 3 -t udp nfslock3t_01 nfslock01 -v 3 -t tcp nfslock4_01 nfslock01 -v 4 -t tcp
testcases/network/nfs/nfs_stress/Makefile +2 -1
@@ -15,6 +15,7 @@ INSTALL_TARGETS := nfs_lib.sh \ nfs03 \ nfs04 \ nfs05 \ - nfs06 + nfs06 \ + nfs07.sh include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/network/nfs/nfs_stress/nfs07.sh new file +67 -0
67 lines not on this page · raw message
Signature · 5 lines
2.33.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 3/3] Add test for NFS directory listing regression
Hi Martin,
Quoted 70 lines
Changes since v1:
- Replace Bash-style brace expansion with $(seq ...)
- Document command line parameter in usage inforuntest/net.nfs | 11 ++++ testcases/network/nfs/nfs_stress/Makefile | 3 +- testcases/network/nfs/nfs_stress/nfs07.sh | 67 +++++++++++++++++++++++ 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100755 testcases/network/nfs/nfs_stress/nfs07.shruntest/net.nfs +11
-0@@ -61,6 +61,17 @@ nfs01_06 nfs06 -v "3,3,3,4,4,4" -t "udp,udp,tcp,tcp,tcp,tcp" nfs02_06 nfs06 -v "3,4,4.1,4.2,4.2,4.2" -t "udp,tcp,tcp,tcp,tcp,tcp" nfs03_ipv6_06 nfs06 -6 -v "4,4.1,4.1,4.2,4.2,4.2" -t "tcp,tcp,tcp,tcp,tcp,tcp" +nfs3_07 nfs07.sh -v 3 -t udp +nfs3t_07 nfs07.sh -v 3 -t tcp +nfs4_07 nfs07.sh -v 4 -t tcp +nfs41_07 nfs07.sh -v 4.1 -t tcp +nfs42_07 nfs07.sh -v 4.2 -t tcp +nfs3_ipv6_07 nfs07.sh -6 -v 3 -t udp +nfs3t_ipv6_07 nfs07.sh -6 -v 3 -t tcp +nfs4_ipv6_07 nfs07.sh -6 -v 4 -t tcp +nfs41_ipv6_07 nfs07.sh -6 -v 4.1 -t tcp +nfs42_ipv6_07 nfs07.sh -6 -v 4.2 -t tcp + nfslock3_01 nfslock01 -v 3 -t udp nfslock3t_01 nfslock01 -v 3 -t tcp nfslock4_01 nfslock01 -v 4 -t tcptestcases/network/nfs/nfs_stress/Makefile +2
-1@@ -15,6 +15,7 @@ INSTALL_TARGETS := nfs_lib.sh \ nfs03 \ nfs04 \ nfs05 \ - nfs06 + nfs06 \ + nfs07.sh include $(top_srcdir)/include/mk/generic_leaf_target.mktestcases/network/nfs/nfs_stress/nfs07.sh new file +19
-0@@ -0,0 +1,67 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2021 SUSE LLC <[email protected]> +# +# 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
testcases/network/nfs/nfs_stress/nfs07.sh line 29
Quoted 10 lines
testcases/network/nfs/nfs_stress/nfs07.sh new file +10
-0+} + +. nfs_lib.sh + +TST_USAGE="show_usage" + +show_usage() +{ + nfs_usage + echo "-n x Create x files and x directories, default is 5000"
I'd use $FILE_COUNT (safe to use as help is run before setup, thus -n is not processed).
testcases/network/nfs/nfs_stress/nfs07.sh line 41
Quoted 12 lines
testcases/network/nfs/nfs_stress/nfs07.sh new file +12
-0+} + +do_setup() +{ + nfs_setup + + local rpath=$(nfs_get_remote_path | sed -e 's/%/%%/g') + local file_fmt="$rpath/file%1.0f" + local dir_fmt="$rpath/dir%1.0f" + + tst_rhost_run -s -c "touch \$(seq -f \"$file_fmt\" -s ' ' $FILE_COUNT)" + tst_rhost_run -s -c "mkdir \$(seq -f \"$dir_fmt\" -s ' ' $FILE_COUNT)"
+1, very nice
testcases/network/nfs/nfs_stress/nfs07.sh line 48
Quoted 7 lines
testcases/network/nfs/nfs_stress/nfs07.sh new file +7
-0+} + +do_test() +{ + local count + + # Pass the list of files through `sort -u` in case `ls` doesn't fitler
typo: s/fitler/filter/
Quoted 6 lines
testcases/network/nfs/nfs_stress/nfs07.sh new file +6
-0+ # 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
testcases/network/nfs/nfs_stress/nfs07.sh line 64
Quoted 10 lines
testcases/network/nfs/nfs_stress/nfs07.sh new file +10
-0+ 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"
maybe mention $FILE_COUNT?
testcases/network/nfs/nfs_stress/nfs07.sh line 67
Quoted 3 lines
testcases/network/nfs/nfs_stress/nfs07.sh new file +3
-0+} + +tst_run
If you agree, I suggest to merge it with these changes:
network/nfs/nfs_stress/nfs07.sh +3 -3
@@ -26,7 +26,7 @@ TST_USAGE="show_usage" show_usage() { nfs_usage - echo "-n x Create x files and x directories, default is 5000" + echo "-n x Create x files and x directories, default is $FILE_COUNT" } do_setup()
@@ -45,7 +45,7 @@ do_test() { local count - # Pass the list of files through `sort -u` in case `ls` doesn't fitler + # Pass the list of files through `sort -u` in case `ls` doesn't filter # out potential duplicate filenames returned by buggy NFS count=`ls | grep '^file' | sort -u | wc -l`
@@ -61,7 +61,7 @@ do_test() return fi - tst_res TPASS "All files and directories were correctly listed" + tst_res TPASS "All $FILE_COUNT files and directories were correctly listed" } tst_run
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 3/3] Add test for NFS directory listing regression
network/nfs/nfs_stress/nfs07.sh TST_USAGE="show_usage" · line 30
Quoted 13 lines · Petr Vorel
If you agree, I suggest to merge it with these changes:
network/nfs/nfs_stress/nfs07.sh +1
-1@@ -26,7 +26,7 @@ TST_USAGE="show_usage" show_usage() { nfs_usage - echo "-n x Create x files and x directories, default is 5000" + echo "-n x Create x files and x directories, default is $FILE_COUNT" }
If you run nfs07.sh -hn 123, your version will print that the default is 123.
Quoted 12 lines
network/nfs/nfs_stress/nfs07.sh +1
-1do_setup()@@ -45,7 +45,7 @@ do_test() { local count - # Pass the list of files through `sort -u` in case `ls` doesn't fitler + # Pass the list of files through `sort -u` in case `ls` doesn't filter # out potential duplicate filenames returned by buggy NFS count=`ls | grep '^file' | sort -u | wc -l`
network/nfs/nfs_stress/nfs07.sh do_test() · line 65
Quoted 6 lines
network/nfs/nfs_stress/nfs07.sh +1
-1@@ -61,7 +61,7 @@ do_test() return fi - tst_res TPASS "All files and directories were correctly listed" + tst_res TPASS "All $FILE_COUNT files and directories were correctly listed" }
That would make the line over 80 characters and the number isn't that important. Let's fix just the "fitler" typo.
Signature · 10 lines
Martin Doucha [email protected] QA Engineer for Software Maintenance SUSE LINUX, s.r.o. CORSO IIa Krizikova 148/34 186 00 Prague 8 Czech Republic -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 3/3] Add test for NFS directory listing regression
Hi Martin,
Quoted 6 lines
network/nfs/nfs_stress/nfs07.sh TST_USAGE="show_usage" · line 30
Quoted 3 lines
network/nfs/nfs_stress/nfs07.sh +1
-1- echo "-n x Create x files and x directories, default is 5000" + echo "-n x Create x files and x directories, default is $FILE_COUNT" }If you run
nfs07.sh -hn 123, your version will print that the default is 123.
Out of curiosity (as it's not anything important) not sure what's wrong on my side (I tested it before I suggested it, I also reinstalled LTP to make sure it's updated), but it works as expected:
# PATH="/opt/ltp/testcases/bin:$PATH" ./nfs07.sh -hn 123 nfs07 1 TINFO: initialize 'lhost' 'ltp_ns_veth2' interface nfs07 1 TINFO: add local addr 10.0.0.2/24
nfs07 1 TINFO: add local addr fd00:1:1:1::2/64 nfs07 1 TINFO: initialize 'rhost' 'ltp_ns_veth1' interface nfs07 1 TINFO: add remote addr 10.0.0.1/24
nfs07 1 TINFO: add remote addr fd00:1:1:1::1/64 nfs07 1 TINFO: Network config (local -- remote):
nfs07 1 TINFO: ltp_ns_veth2 -- ltp_ns_veth1
nfs07 1 TINFO: 10.0.0.2/24 -- 10.0.0.1/24
nfs07 1 TINFO: fd00:1:1:1::2/64 -- fd00:1:1:1::1/64
-t x Socket type, tcp or udp, default is udp -v x NFS version, default is '3' -n x Create x files and x directories, default is 5000 -h Prints this help -i n Execute test n times
Quoted 14 lines
Quoted 13 lines
do_setup()network/nfs/nfs_stress/nfs07.sh +1
-1@@ -45,7 +45,7 @@ do_test() { local count - # Pass the list of files through `sort -u` in case `ls` doesn't fitler + # Pass the list of files through `sort -u` in case `ls` doesn't filter # out potential duplicate filenames returned by buggy NFS count=`ls | grep '^file' | sort -u | wc -l`@@ -61,7 +61,7 @@ do_test() return fi
Quoted 6 lines
network/nfs/nfs_stress/nfs07.sh do_test() · line 65
Quoted 3 lines
network/nfs/nfs_stress/nfs07.sh +1
-1- tst_res TPASS "All files and directories were correctly listed" + tst_res TPASS "All $FILE_COUNT files and directories were correctly listed" }That would make the line over 80 characters and the number isn't that important. Let's fix just the "fitler" typo.
I don't consider 80 as an issue as long as it's not over 100 chars (barier increased also in mainline checkpatch.pl), but sure, these are really minor issues, thus agree to fix just the typo.
Waiting little longer if Alexey has any comments and then merge.
Thanks a lot for very useful test case!
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 3/3] Add test for NFS directory listing regression
Quoted 9 lines · Petr Vorel
Hi Martin,
Quoted 6 lines
network/nfs/nfs_stress/nfs07.sh TST_USAGE="show_usage" · line 30
Quoted 3 lines
network/nfs/nfs_stress/nfs07.sh +1
-1- echo "-n x Create x files and x directories, default is 5000" + echo "-n x Create x files and x directories, default is $FILE_COUNT" }If you run
nfs07.sh -hn 123, your version will print that the default is 123.
Quoted 3 lines
Out of curiosity (as it's not anything important) not sure what's wrong on my side (I tested it before I suggested it, I also reinstalled LTP to make sure it's updated), but it works as expected:
Ah, sorry, I've put the arguments in the wrong order.nfs07.sh -n 123 -h will overwrite $FILE_COUNT before printing usage info.
Signature · 10 lines
Martin Doucha [email protected] QA Engineer for Software Maintenance SUSE LINUX, s.r.o. CORSO IIa Krizikova 148/34 186 00 Prague 8 Czech Republic -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 3/3] Add test for NFS directory listing regression
Quoted 10 lines · Petr Vorel
Quoted 8 lines
Hi Martin,
Quoted 6 lines
network/nfs/nfs_stress/nfs07.sh TST_USAGE="show_usage" · line 30
Quoted 3 lines
network/nfs/nfs_stress/nfs07.sh +1
-1- echo "-n x Create x files and x directories, default is 5000" + echo "-n x Create x files and x directories, default is $FILE_COUNT" }If you run
nfs07.sh -hn 123, your version will print that the default is 123.
Quoted 6 lines
Quoted 3 lines
Out of curiosity (as it's not anything important) not sure what's wrong on my side (I tested it before I suggested it, I also reinstalled LTP to make sure it's updated), but it works as expected:
Ah, sorry, I've put the arguments in the wrong order.
nfs07.sh -n 123 -hwill overwrite $FILE_COUNT before printing usage info.
Ah, correct, thanks! I should have figured this out myself.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 3/3] Add test for NFS directory listing regression
In reply to Petr VorelQuoted 50 lines · Petr Vorel
Hi Martin,
Quoted 6 lines
network/nfs/nfs_stress/nfs07.sh TST_USAGE="show_usage" · line 30
Quoted 3 lines
network/nfs/nfs_stress/nfs07.sh +1
-1- echo "-n x Create x files and x directories, default is 5000" + echo "-n x Create x files and x directories, default is $FILE_COUNT" }If you run
nfs07.sh -hn 123, your version will print that the default is 123.Out of curiosity (as it's not anything important) not sure what's wrong on my side (I tested it before I suggested it, I also reinstalled LTP to make sure it's updated), but it works as expected:
# PATH="/opt/ltp/testcases/bin:$PATH" ./nfs07.sh -hn 123 nfs07 1 TINFO: initialize 'lhost' '
ltp_ns_veth2' interface nfs07 1 TINFO: add local addr 10.0.0.2/24
nfs07 1 TINFO: add local addr fd00:1:1:1::2/64 nfs07 1 TINFO: initialize 'rhost' 'ltp_ns_veth1' interface nfs07 1 TINFO: add remote addr 10.0.0.1/24
nfs07 1 TINFO: add remote addr fd00:1:1:1::1/64 nfs07 1 TINFO: Network config (local -- remote):
nfs07 1 TINFO:ltp_ns_veth2--ltp_ns_veth1
nfs07 1 TINFO: 10.0.0.2/24 -- 10.0.0.1/24
nfs07 1 TINFO: fd00:1:1:1::2/64 -- fd00:1:1:1::1/64(quoted diff) +0
-5-t x Socket type, tcp or udp, default is udp -v x NFS version, default is '3' -n x Create x files and x directories, default is 5000 -h Prints this help -i n Execute test n timesQuoted 15 lines
Quoted 14 lines
do_setup()network/nfs/nfs_stress/nfs07.sh +1
-1@@ -45,7 +45,7 @@ do_test() { local count - # Pass the list of files through `sort -u` in case `ls` doesn't fitler + # Pass the list of files through `sort -u` in case `ls` doesn't filter # out potential duplicate filenames returned by buggy NFS count=`ls | grep '^file' | sort -u | wc -l`@@ -61,7 +61,7 @@ do_test() return fiQuoted 6 lines
network/nfs/nfs_stress/nfs07.sh do_test() · line 65
Quoted 3 lines
network/nfs/nfs_stress/nfs07.sh +1
-1- tst_res TPASS "All files and directories were correctly listed" + tst_res TPASS "All $FILE_COUNT files and directories were correctly listed" }That would make the line over 80 characters and the number isn't that important. Let's fix just the "fitler" typo.
Quoted 5 lines
I don't consider 80 as an issue as long as it's not over 100 chars (barier increased also in mainline checkpatch.pl), but sure, these are really minor issues, thus agree to fix just the typo.
Waiting little longer if Alexey has any comments and then merge.
Hi Petr, Martin
Overall the new test looks good, and I would only replace the old style command substitution count=ls ... with count=$(ls ...).
Thanks,
Alexey
Quoted 6 lines
Thanks a lot for very useful test case!
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 3/3] Add test for NFS directory listing regression
Quoted 4 lines · Alexey Kodanev
Hi Petr, Martin
Overall the new test looks good, and I would only replace the old style command substitution count=
ls ...with count=$(ls ...).
Good idea.
Signature · 10 lines
Martin Doucha [email protected] QA Engineer for Software Maintenance SUSE LINUX, s.r.o. CORSO IIa Krizikova 148/34 186 00 Prague 8 Czech Republic -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 3/3] Add test for NFS directory listing regression
Hi Martin, Alexey,
Quoted 5 lines · Alexey Kodanev
Quoted 4 lines
Hi Petr, Martin
Overall the new test looks good, and I would only replace the old style command substitution count=
ls ...with count=$(ls ...).
+1, thanks for a review.
Quoted 1 line
Good idea.
I'll do that before merging this (later today).
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 3/3] Add test for NFS directory listing regression
In reply to Alexey KodanevHi Martin, Alexey,
FYI merged. Thanks!
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Martin,
Quoted 3 lines
Sometimes it's necessary to manipulate remote NFS directory directly e.g. to simulate external server activity.
nfs_get_remote_path()will print the remote path so that it can then be used bytst_rhost_run().
Kind regards,
Petr
Quoted 32 lines
Signed-off-by Martin Doucha <[email protected]>---
Changes since v1: None
testcases/network/nfs/nfs_stress/nfs_lib.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+)testcases/network/nfs/nfs_stress/nfs_lib.sh +13
-0@@ -52,6 +52,19 @@ get_socket_type() done } +nfs_get_remote_path() +{ + local v + local type=$(get_socket_type ${2:-0}) + + for v in $VERSION; do + break; + done + + v=${1:-$v} + echo "$TST_TMPDIR/$v/$type" +} + nfs_server_udp_enabled() { local config f
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp