network/nfs: fix/cleanup tests
cover network/nfs: fix/cleanup tests
Alexey Kodanev (8):
lib: add safe_gethostname()
network/nfs05: rewrite the test, make use of new library network/nfs_lib.sh: add options, socket type and NFS ver network/nfs/fsx: cleanup test, use test_net library network/nfs/nfsstat: cleanup test, use test_net.sh library network/nfs/nfsflock: clenaup & use test_net library network/nfs/nfs_fsstress: remove fsstress test network/nfs: remove README
include/safe_net_fn.h | 3 + include/tst_safe_net.h | 3 + lib/safe_net.c | 14 + runtest/net.nfs | 83 +- testcases/network/.gitignore | 1 - testcases/network/nfs/README | 28 - testcases/network/nfs/fsx-linux/fsx.sh | 204 +-- testcases/network/nfs/nfs_fsstress/Makefile | 7 - testcases/network/nfs/nfs_fsstress/fsstress.c | 2591 -------------------- testcases/network/nfs/nfs_fsstress/global.h | 66 - testcases/network/nfs/nfs_fsstress/xfscompat.h | 7 - testcases/network/nfs/nfs_stress/Makefile | 2 +- testcases/network/nfs/nfs_stress/nfs05 | 8 +- testcases/network/nfs/nfs_stress/nfs05_make_tree.c | 911 ++------ testcases/network/nfs/nfs_stress/nfs_lib.sh | 32 +- testcases/network/nfs/nfslock01/nfs_flock_frk.c | 39 - testcases/network/nfs/nfslock01/nfslock01 | 155 +- testcases/network/nfs/nfsstat01/nfsstat01 | 343 +-- 18 files changed, 433 insertions(+), 4064 deletions(-) delete mode 100644 testcases/network/nfs/README delete mode 100644 testcases/network/nfs/nfs_fsstress/fsstress.c delete mode 100644 testcases/network/nfs/nfs_fsstress/global.h delete mode 100644 testcases/network/nfs/nfs_fsstress/xfscompat.h delete mode 100644 testcases/network/nfs/nfslock01/nfs_flock_frk.c
PATCH RESEND 1/8 lib: add safe_gethostname()
--- include/safe_net_fn.h | 3 +++ include/tst_safe_net.h | 3 +++ lib/safe_net.c | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 0 deletions(-)
include/safe_net_fn.h +3 -0
@@ -45,4 +45,7 @@ int safe_getsockname(const char *file, const int lineno, void (cleanup_fn)(void), int sockfd, struct sockaddr *addr, socklen_t *addrlen); +int safe_gethostname (const char *file,const int lineno, +void (cleanup_fn )(void ),char *name,size_t size); +#endif /* SAFE_NET_FN_H__ */
include/tst_safe_net.h +3 -0
@@ -43,4 +43,7 @@safe_getsockname (__FILE__, __LINE__,NULL , sockfd, addr, \ addrlen) +#define SAFE_GETHOSTNAME (name, size) \ + safe_gethostname(__FILE__, __LINE__, NULL, name, size) +#endif /* TST_SAFE_NET_H__ */
lib/safe_net.c +14 -0
@@ -183,3 +183,17 @@ int safe_getsockname(const char *file, const int lineno,return rval; } + +int safe_gethostname (const char *file,const int lineno, +void (cleanup_fn )(void ),char *name,size_t size) +{ +int rval =gethostname (name, size); + +if (rval <0 ) { +tst_brkm (TBROK |TERRNO , cleanup_fn, +"%s:%d: gethostname(%p, %zu) failed" , + file, lineno, name, size); + } + +return rval; +}
Signature · 1 line
1.7.1
PATCH RESEND 2/8 network/nfs05: rewrite the test, make use of new library
In reply to Alexey Kodanev* remove dynamic allocation of memory, use asprintf in few places;
* run tst_run_cmd() to call make/make clean;
* clean directories with tst_rmdir library.
--- testcases/network/nfs/nfs_stress/Makefile | 2 +- testcases/network/nfs/nfs_stress/nfs05 | 8 +- testcases/network/nfs/nfs_stress/nfs05_make_tree.c | 911 ++++---------------- 3 files changed, 160 insertions(+), 761 deletions(-)
testcases/network/nfs/nfs_stress/Makefile +1 -1
@@ -19,7 +19,7 @@ top_srcdir ?= ../../../.. include $(top_srcdir)/include/mk/env_pre.mk nfs04_create_file: CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -nfs05_make_tree: LDLIBS += -lpthread +nfs05_make_tree: LDLIBS += -I../../../kernel/include -lltp -lpthread INSTALL_TARGETS := nfs_lib.sh \ nfs01 \
testcases/network/nfs/nfs_stress/nfs05 +6 -2
@@ -34,8 +34,12 @@ THREAD_NUM=${THREAD_NUM:-"8"} nfs_setup tst_resm TINFO "start nfs05_make_tree -d $DIR_NUM -f $FILE_NUM -t $THREAD_NUM" -ROD nfs05_make_tree -d $DIR_NUM -f $FILE_NUM -t $THREAD_NUM +TMPDIR=$(pwd) nfs05_make_tree -d $DIR_NUM -f $FILE_NUM -t $THREAD_NUM -tst_resm TPASS "test finished" +if [ $? -ne 0 ]; then + tst_resm TFAIL "'make' test failed" +else + tst_resm TPASS "'make' test finished" +fi tst_exit
testcases/network/nfs/nfs_stress/nfs05_make_tree.c +153 -758
941 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 3/8 network/nfs_lib.sh: add options, socket type and NFS ver
In reply to Alexey KodanevAdditionally, add more configurations including NFSv4.2.
--- runtest/net.nfs | 62 ++++++++++++++++++--------- testcases/network/nfs/nfs_stress/nfs_lib.sh | 32 ++++++++++++-- 2 files changed, 68 insertions(+), 26 deletions(-)
runtest/net.nfs +41 -21
@@ -1,31 +1,51 @@ #DESCRIPTION:Network filesystem stress # -# PLEASE READ THE README FILE IN /nfs BEFORE RUNNING THESE. +# PLEASE READ THE README FILE network/README.md BEFORE RUNNING THESE. # -nfs3_01 export VERSION=3 SOCKET_TYPE=udp; nfs01 -nfs4_01 export VERSION=4 SOCKET_TYPE=tcp; nfs01 -nfs3_ipv6_01 export VERSION=3 SOCKET_TYPE=udp; nfs01 -6 -nfs4_ipv6_01 export VERSION=4 SOCKET_TYPE=tcp; nfs01 -6 +nfs3_01 nfs01 -v 3 -t udp +nfs4_01 nfs01 -v 3 -t tcp +nfs41_01 nfs01 -v 4.1 -t tcp +nfs42_01 nfs01 -v 4.2 -t tcp +nfs3_ipv6_01 nfs01 -6 -v 3 -t udp +nfs4_ipv6_01 nfs01 -6 -v 4 -t tcp +nfs41_ipv6_01 nfs01 -6 -v 4.1 -t tcp +nfs42_ipv6_01 nfs01 -6 -v 4.2 -t tcp -nfs3_02 export VERSION=3 SOCKET_TYPE=udp; nfs02 -nfs4_02 export VERSION=4 SOCKET_TYPE=tcp; nfs02 -nfs3_ipv6_02 export VERSION=3 SOCKET_TYPE=udp; nfs02 -6 -nfs4_ipv6_02 export VERSION=4 SOCKET_TYPE=tcp; nfs02 -6 +nfs3_02 nfs02 -v 3 -t udp +nfs4_02 nfs02 -v 3 -t tcp +nfs41_02 nfs02 -v 4.1 -t tcp +nfs42_02 nfs02 -v 4.2 -t tcp +nfs3_ipv6_02 nfs02 -6 -v 3 -t udp +nfs4_ipv6_02 nfs02 -6 -v 4 -t tcp +nfs41_ipv6_02 nfs02 -6 -v 4.1 -t tcp +nfs42_ipv6_02 nfs02 -6 -v 4.2 -t tcp -nfs3_03 export VERSION=3 SOCKET_TYPE=udp; nfs03 -nfs4_03 export VERSION=4 SOCKET_TYPE=tcp; nfs03 -nfs3_ipv6_03 export VERSION=3 SOCKET_TYPE=udp; nfs03 -6 -nfs4_ipv6_03 export VERSION=4 SOCKET_TYPE=tcp; nfs03 -6 +nfs3_03 nfs03 -v 3 -t udp +nfs4_03 nfs03 -v 3 -t tcp +nfs41_03 nfs03 -v 4.1 -t tcp +nfs42_03 nfs03 -v 4.2 -t tcp +nfs3_ipv6_03 nfs03 -6 -v 3 -t udp +nfs4_ipv6_03 nfs03 -6 -v 4 -t tcp +nfs41_ipv6_03 nfs03 -6 -v 4.1 -t tcp +nfs42_ipv6_03 nfs03 -6 -v 4.2 -t tcp -nfs3_04 export VERSION=3 SOCKET_TYPE=udp; nfs04 -nfs4_04 export VERSION=4 SOCKET_TYPE=tcp; nfs04 -nfs3_ipv6_04 export VERSION=3 SOCKET_TYPE=udp; nfs04 -6 -nfs4_ipv6_04 export VERSION=4 SOCKET_TYPE=tcp; nfs04 -6 +nfs3_04 nfs04 -v 3 -t udp +nfs4_04 nfs04 -v 3 -t tcp +nfs41_04 nfs04 -v 4.1 -t tcp +nfs42_04 nfs04 -v 4.2 -t tcp +nfs3_ipv6_04 nfs04 -6 -v 3 -t udp +nfs4_ipv6_04 nfs04 -6 -v 4 -t tcp +nfs41_ipv6_04 nfs04 -6 -v 4.1 -t tcp +nfs42_ipv6_04 nfs04 -6 -v 4.2 -t tcp -nfs3_05 export VERSION=3 SOCKET_TYPE=udp; nfs05 -nfs4_05 export VERSION=4 SOCKET_TYPE=tcp; nfs05 -nfs3_ipv6_05 export VERSION=3 SOCKET_TYPE=udp; nfs05 -6 -nfs4_ipv6_05 export VERSION=4 SOCKET_TYPE=tcp; nfs05 -6 +nfs3_05 nfs05 -v 3 -t udp +nfs4_05 nfs05 -v 4 -t tcp +nfs41_05 nfs05 -v 4.1 -t tcp +nfs42_05 nfs05 -v 4.2 -t tcp +nfs3_ipv6_05 nfs05 -6 -v 3 -t udp +nfs4_ipv6_05 nfs05 -6 -v 4 -t tcp +nfs41_ipv6_05 nfs05 -6 -v 4.1 -t tcp +nfs42_ipv6_05 nfs05 -6 -v 4.2 -t tcp nfslock01 export VERSION; TCbin=$LTPROOT/testcases/bin nfslock01
testcases/network/nfs/nfs_stress/nfs_lib.sh +27 -5
@@ -1,4 +1,4 @@ -# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved. +# Copyright (c) 2015-2016 Oracle and/or its affiliates. All Rights Reserved. # Copyright (c) International Business Machines Corp., 2001 # # This program is free software; you can redistribute it and/or
@@ -14,12 +14,34 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +VERSION=${VERSION:=3} +NFILES=${NFILES:=1000} +SOCKET_TYPE="${SOCKET_TYPE:-udp}" +NFS_TYPE=${NFS_TYPE:=nfs} + +while getopts :ht:v:6 opt; do + case "$opt" in + h) + echo "Usage:" + echo "h help" + echo "t x socket type, tcp or udp, default is udp" + echo "v x NFS version, default is '3'" + echo "6 run over IPv6" + exit 0 + ;; + v) VERSION=$OPTARG ;; + t) SOCKET_TYPE=$OPTARG ;; + 6) # skip, test_net library already processed it + ;; + *) + tst_brkm TBROK "unknown option: $opt" + ;; + esac +done + nfs_setup() { - VERSION=${VERSION:=3} - NFILES=${NFILES:=1000} - SOCKET_TYPE="${SOCKET_TYPE:=udp}${TST_IPV6}" - NFS_TYPE=${NFS_TYPE:=nfs} + SOCKET_TYPE="${SOCKET_TYPE}${TST_IPV6}" tst_check_cmds mount exportfs
Signature · 1 line
1.7.1
PATCH 4/8 network/nfs/fsx: cleanup test, use test_net library
In reply to Alexey KodanevWith nfs_lib.sh we can test several versions of NFS, so changing test-cases in runtest/net.nfs as well.
--- runtest/net.nfs | 10 ++- testcases/network/nfs/fsx-linux/fsx.sh | 204 +++++--------------------------- 2 files changed, 38 insertions(+), 176 deletions(-)
runtest/net.nfs +9 -1
@@ -50,4 +50,12 @@ nfs42_ipv6_05 nfs05 -6 -v 4.2 -t tcp nfslock01 export VERSION; TCbin=$LTPROOT/testcases/bin nfslock01 nfsstat01 export VERSION; TCbin=$LTPROOT/testcases/bin nfsstat01 -nfsx-linux export VERSION SOCKET_TYPE; TCbin=$LTPROOT/testcases/bin fsx.sh + +nfsx3 fsx.sh -v 3 -t udp +nfsx4 fsx.sh -v 4 -t tcp +nfsx41 fsx.sh -v 4.1 -t tcp +nfsx42 fsx.sh -v 4.2 -t tcp +nfsx3_ipv6 fsx.sh -6 -v 3 -t udp +nfsx4_ipv6 fsx.sh -6 -v 4 -t tcp +nfsx41_ipv6 fsx.sh -6 -v 4.1 -t tcp +nfsx42_ipv6 fsx.sh -6 -v 4.2 -t tcp
testcases/network/nfs/fsx-linux/fsx.sh +29 -175
223 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 5/8 network/nfs/nfsstat: cleanup test, use test_net.sh library
In reply to Alexey Kodanev--- runtest/net.nfs | 2 +- testcases/network/nfs/nfsstat01/nfsstat01 | 343 +++++++++-------------------- 2 files changed, 103 insertions(+), 242 deletions(-)
runtest/net.nfs +1 -1
@@ -49,7 +49,7 @@ nfs42_ipv6_05 nfs05 -6 -v 4.2 -t tcp nfslock01 export VERSION; TCbin=$LTPROOT/testcases/bin nfslock01 -nfsstat01 export VERSION; TCbin=$LTPROOT/testcases/bin nfsstat01 +nfsstat3_01 nfsstat01 nfsx3 fsx.sh -v 3 -t udp nfsx4 fsx.sh -v 4 -t tcp
testcases/network/nfs/nfsstat01/nfsstat01 +102 -241
363 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 6/8 network/nfs/nfsflock: clenaup & use test_net library
In reply to Alexey KodanevAdd new test configurations and remove not used nfs_flock_frk.
--- runtest/net.nfs | 9 ++- testcases/network/.gitignore | 1 - testcases/network/nfs/nfslock01/nfs_flock_frk.c | 39 ------ testcases/network/nfs/nfslock01/nfslock01 | 155 ++++++----------------- 4 files changed, 44 insertions(+), 160 deletions(-) delete mode 100644 testcases/network/nfs/nfslock01/nfs_flock_frk.c
runtest/net.nfs +8 -1
@@ -47,7 +47,14 @@ nfs4_ipv6_05 nfs05 -6 -v 4 -t tcp nfs41_ipv6_05 nfs05 -6 -v 4.1 -t tcp nfs42_ipv6_05 nfs05 -6 -v 4.2 -t tcp -nfslock01 export VERSION; TCbin=$LTPROOT/testcases/bin nfslock01 +nfslock3_01 nfslock01 -v 3 -t udp +nfslock4_01 nfslock01 -v 4 -t tcp +nfslock41_01 nfslock01 -v 4.1 -t tcp +nfslock42_01 nfslock01 -v 4.2 -t tcp +nfslock3_ipv6_01 nfslock01 -6 -v 3 -t udp +nfslock4_ipv6_01 nfslock01 -6 -v 4 -t tcp +nfslock41_ipv6_01 nfslock01 -6 -v 4.1 -t tcp +nfslock42_ipv6_01 nfslock01 -6 -v 4.2 -t tcp nfsstat3_01 nfsstat01
testcases/network/.gitignore +0 -1
@@ -19,7 +19,6 @@ /nfs/nfs_fsstress/fsstress /nfs/nfslock01/nfs_flock /nfs/nfslock01/nfs_flock_dgen -/nfs/nfslock01/nfs_flock_frk /nfsv4/acl/acl1 /nfsv4/locks/locktests /rpc/basic_tests/rpc01/rpc1
testcases/network/nfs/nfslock01/nfs_flock_frk.c deleted +0 -39
@@ -1,39 +0,0 @@ -/* -* This program starts processes one and two simultaneously. -*/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> -#include <sys/types.h> -#include <sys/wait.h> - -int main (int argc,char **argv) -{ -pid_t pid; -char *Prog; - -if (argc !=3 ) { -fprintf (stderr,"Usage: %s <process> <datafile>\n" , argv[0 ]); -exit (2 ); - } - - Prog =strrchr (argv[1 ],'/' ); - Prog++; - -if ((pid =fork ()) <0 ) { -printf ("Failed in forking, Errno = %d" , errno); -exit (2 ); - }else if (pid ==0 ) {/* child */ -execl (argv[1 ], Prog,"0" , argv[2 ],NULL ); - }else {/* parent */ -execl (argv[1 ], Prog,"1" , argv[2 ],NULL ); - } - -/*if (waitpid(pid, NULL, 0) != pid) -printf("Failed in waitpid, Errno = %d", errno); -*/ -exit (0 ); -}
testcases/network/nfs/nfslock01/nfslock01 +36 -119
188 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 7/8 network/nfs/nfs_fsstress: remove fsstress test
In reply to Alexey KodanevThe most recent version resides in testcases/fs/fsstress/. There is no resone to keep both versions.
--- testcases/network/nfs/nfs_fsstress/Makefile | 7 - testcases/network/nfs/nfs_fsstress/fsstress.c | 2591 ------------------------ testcases/network/nfs/nfs_fsstress/global.h | 66 - testcases/network/nfs/nfs_fsstress/xfscompat.h | 7 - 4 files changed, 0 insertions(+), 2671 deletions(-) delete mode 100644 testcases/network/nfs/nfs_fsstress/fsstress.c delete mode 100644 testcases/network/nfs/nfs_fsstress/global.h delete mode 100644 testcases/network/nfs/nfs_fsstress/xfscompat.h
testcases/network/nfs/nfs_fsstress/Makefile +0 -7
@@ -24,13 +24,6 @@ top_srcdir ?= ../../../.. include $(top_srcdir)/include/mk/env_pre.mk -CPPFLAGS += -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -DNO_XFS \ - -I$(abs_srcdir) - -# XXX (garrcoop): this copy of fsstress has issues with -Wuninitialized that -# aren't as easy to resolve as I would like. -CPPFLAGS += -Wno-error - INSTALL_TARGETS := nfs_fsstress.sh include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/network/nfs/nfs_fsstress/fsstress.c deleted +0 -2591
2,591 lines not on this page · raw message
testcases/network/nfs/nfs_fsstress/global.h deleted +0 -66
66 lines not on this page · raw message
testcases/network/nfs/nfs_fsstress/xfscompat.h deleted +0 -7
@@ -1,7 +0,0 @@ -#define MAXNAMELEN 1024 -struct dioattr { -int d_miniosz, d_maxiosz, d_mem; -}; - -#define MIN (a,b) ((a)<(b) ? @:(b)) -#define MAX (a,b) ((a)>(b) ? (a):(b))
Signature · 1 line
1.7.1
PATCH 8/8 network/nfs: remove README
In reply to Alexey KodanevThe more detailed description can be found in network/README.md.
--- testcases/network/nfs/README | 28 ---------------------------- 1 files changed, 0 insertions(+), 28 deletions(-) delete mode 100644 testcases/network/nfs/README
testcases/network/nfs/README deleted +0 -28
@@ -1,28 +0,0 @@ - -NOTE: - - These tests ALL assume that the "RHOST" variable is set to the hostname -of the remote machine, i.e. - - # export RHOST=<hostname here>. - - -These tests also assume an identical path tree for their location on the remote -machine. So if pan's root path is "/home/ltptests" on the test machine, then -it must also be located in "/home/ltptests" on the remote machine (RHOST). You -also need to do a make and make install on both the local and remote machines -before you run the test. - - You will also need to setup a ".rhosts" file in root's home directory on the -remote machine, with the name of the local machine listed. For example, if -machineA is running the tests, with machineB set as RHOST, then machineB's -root home directory will need an ".rhosts" file with machineA's hostname -listed. After you create the .rhost file you must also set the proper -permissions on the .rhost file. chmod 600 .rhosts - -I apologize for the lengthy setup, but I tried to make it as minimal as -possible. - - --Robbie Williamson -([email protected])
Signature · 1 line
1.7.1
cover network/nfs: fix/cleanup tests
In reply to Alexey KodanevHi,
Quoted 9 lines · Alexey Kodanev
Alexey Kodanev (8):
lib: addsafe_gethostname()
network/nfs05: rewrite the test, make use of new librarynetwork/nfs_lib.sh: add options, socket type and NFS ver network/nfs/fsx: cleanup test, usetest_netlibrary network/nfs/nfsstat: cleanup test, usetest_net.shlibrary network/nfs/nfsflock: clenaup & usetest_netlibrary network/nfs/nfs_fsstress: remove fsstress test network/nfs: remove README
Patch-set applied except first two patches that were sent separately as v2.
Thanks,
Alexey