* [LTP] [PATCH 01/10 resend] network/nfs01: add IPv6 test-cases
@ 2015-09-30 13:09 Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 02/10] network/nfs: rename nfs dir to nfs_stress Alexey Kodanev
` (8 more replies)
0 siblings, 9 replies; 13+ messages in thread
From: Alexey Kodanev @ 2015-09-30 13:09 UTC (permalink / raw)
To: ltp
* cleanup test, apply test_net.sh library
* don't use loop for test binaries because there is only one
right now, 'open_files'
* use tst_tmpdir()
* update test-cases in runtest, add NFS over IPv6
* make four test-cases with NFS v3 and v4.
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
runtest/nfs | 6 +-
runtest/stress.part1 | 8 +-
testcases/network/nfs/nfs01/nfs01 | 245 ++++++++++--------------------------
3 files changed, 77 insertions(+), 182 deletions(-)
diff --git a/runtest/nfs b/runtest/nfs
index 19f2344..7bee16f 100644
--- a/runtest/nfs
+++ b/runtest/nfs
@@ -2,7 +2,11 @@
#
# PLEASE READ THE README FILE IN /nfs BEFORE RUNNING THESE.
#
-nfs01 export VERSION SOCKET_TYPE; TCbin=$LTPROOT/testcases/bin nfs01
+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
+
nfs02 export VERSION SOCKET_TYPE; TCbin=$LTPROOT/testcases/bin nfs02
nfs03 export VERSION SOCKET_TYPE; TCbin=$LTPROOT/testcases/bin nfs03
nfs04 export VERSION SOCKET_TYPE; TCbin=$LTPROOT/testcases/bin nfs04
diff --git a/runtest/stress.part1 b/runtest/stress.part1
index fc8363d..9ad21d9 100644
--- a/runtest/stress.part1
+++ b/runtest/stress.part1
@@ -176,10 +176,10 @@ ftest06 ftest06
ftest07 ftest07
ftest08 ftest08
-nfs01 export VERSION=2 SOCKET_TYPE=udp; export TCbin=$LTPROOT/testcases/bin; nfs01
-nfs01 export VERSION=2 SOCKET_TYPE=tcp; export TCbin=$LTPROOT/testcases/bin; nfs01
-nfs01 export VERSION=3 SOCKET_TYPE=udp; export TCbin=$LTPROOT/testcases/bin; nfs01
-nfs01 export VERSION=3 SOCKET_TYPE=tcp; export TCbin=$LTPROOT/testcases/bin; nfs01
+nfs01 export VERSION=2 SOCKET_TYPE=udp; nfs01
+nfs01 export VERSION=2 SOCKET_TYPE=tcp; nfs01
+nfs01 export VERSION=3 SOCKET_TYPE=udp; nfs01
+nfs01 export VERSION=3 SOCKET_TYPE=tcp; nfs01
nfs02 export VERSION=2 SOCKET_TYPE=udp; export TCbin=$LTPROOT/testcases/bin; nfs02
nfs02 export VERSION=2 SOCKET_TYPE=tcp; export TCbin=$LTPROOT/testcases/bin; nfs02
diff --git a/testcases/network/nfs/nfs01/nfs01 b/testcases/network/nfs/nfs01/nfs01
index 77d2775..eab2e74 100755
--- a/testcases/network/nfs/nfs01/nfs01
+++ b/testcases/network/nfs/nfs01/nfs01
@@ -1,24 +1,19 @@
-#! /bin/sh
+#!/bin/sh
+# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines Corp., 2001
#
-# Copyright (c) International Business Machines Corp., 2001
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implie; warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
-# the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-#
-#
-# FILE : nfs01
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# PURPOSE: Stresses NFS by opening a large number of files on a nfs
# mounted filesystem.
@@ -28,185 +23,81 @@
# where the test is executed.
#
#
-# HISTORY:
-# 04/27/01 Robbie Williamson (robbiew@us.ibm.com)
-# -Ported
-#
-#***********************************************************************
+# Ported by Robbie Williamson (robbiew@us.ibm.com)
-#Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-$trace_logic
+TCID="nfs01"
+TST_TOTAL=1
+TST_CLEANUP="cleanup"
-#-----------------------------------------------------------------------
-# Initialize local variables
-#-----------------------------------------------------------------------
-TC=${TC:=nfs01}
-TCbin=${TCbin:=`pwd`}
-TCdat=${TCdat:=$TCbin}
-TCsrc=${TCsrc:=$TCbin}
-TCtmp=${TCtmp:=$TCbin/$TC$$}
-TCdump=${TCdump:=$TCbin}
-export TCID=$TC
-export TST_TOTAL=1
-export TST_COUNT=1
+. test_net.sh
-# If CLEANUP is not set; set it to "ON"
-CLEANUP=${CLEANUP:="ON"}
+setup_testcase()
+{
+ VERSION=${VERSION:=3}
+ NFILES=${NFILES:=1000}
+ SOCKET_TYPE="${SOCKET_TYPE:=udp}${TST_IPV6}"
+ NFS_TYPE=${NFS_TYPE:=nfs}
-# If EXECUTABLES is not set; set it to default executables
-EXECUTABLES=${EXECUTABLES:="open_files"}
+ tst_check_cmds mount exportfs
+ tst_tmpdir
-#=============================================================================
-# FUNCTION NAME: setup_testcase
-#
-# FUNCTION DESCRIPTION: Perform the setup function for the testcase.
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
+ tst_resm TINFO "NFS_TYPE: $NFS_TYPE, NFS VERSION: $VERSION"
+ tst_resm TINFO "NFILES: $NFILES, SOCKET_TYPE: $SOCKET_TYPE"
-setup_testcase()
-{
-$trace_logic
-
- PID=$$
-
- VERSION=${VERSION:=3}
- RHOST=${RHOST:=`hostname`}
- NFILES=${NFILES:=1000}
- SOCKET_TYPE=${SOCKET_TYPE:=udp}
- TESTDIR=${TESTDIR:=/tmp/$TC$PID.testdir}
- NFS_TYPE=${NFS_TYPE:=nfs}
-
- echo ""
- echo "Test Options:"
- echo " VERSION: $VERSION"
- echo " RHOST: $RHOST"
- echo " NFILES: $NFILES"
- echo " SOCKET_TYPE: $SOCKET_TYPE"
- echo " NFS_TYPE: $NFS_TYPE"
- echo " TESTDIR: $TESTDIR"
-
- if [ "x$NFS_TYPE" != "xnfs4" ]; then
- OPTS=${OPTS:="-o proto=$SOCKET_TYPE,vers=$VERSION "}
- fi
-
- REMOTE_DIR=${RHOST}:${TESTDIR}
- LOCAL_DIR=$TCtmp/${RHOST}.${LUSER}
- LUSER=${LUSER:=root}
- mkdir -p $TCtmp || end_testcase "Could not create $TCtmp"
- chmod 777 $TCtmp
-
- echo "Setting up remote machine: $RHOST"
- rsh -n $RHOST "mkdir -p $TESTDIR"
- [ $? = 0 ] || end_testcase "Could not create remote directory"
-
- if [ "x$NFS_TYPE" = "xnfs4" ]; then
- rsh -n $RHOST "mkdir -p /export$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not create /export$TESTDIR on server"
- rsh -n $RHOST "mount --bind $TESTDIR /export$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not bind $TESTDIR to export on server"
- rsh -n $RHOST "/usr/sbin/exportfs -o no_root_squash,rw,nohide,insecure,no_subtree_check *:$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not export remote directory"
- else
- rsh -n $RHOST "/usr/sbin/exportfs -i -o no_root_squash,rw *:$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not export remote directory"
- fi
-
- echo "Mounting NFS filesystem $REMOTE_DIR on $TCtmp with options '$OPTS'"
- mount -t $NFS_TYPE $OPTS $REMOTE_DIR $TCtmp || end_testcase "Cannot mount $TCtmp"
- [ $? = 0 ] || end_testcase "Could not mount $REMOTE_DIR"
-
- cd $TCtmp
- echo "Removing old and create new directories"
- [ -d $LOCAL_DIR ] && rm -rf $LOCAL_DIR
- [ -d $LOCAL_DIR ] || { \
- mkdir -p $LOCAL_DIR || end_testcase "Could not create $LOCAL_DIR"
- chmod 777 $LOCAL_DIR
- cp $TCsrc/$EXECUTABLES $LOCAL_DIR || end_testcase "Could not write to mount point"
- }
-}
+ if [ "$NFS_TYPE" != "nfs4" ]; then
+ OPTS=${OPTS:="-o proto=$SOCKET_TYPE,vers=$VERSION "}
+ fi
+ tst_rhost_run -s -c "mkdir -p $TST_TMPDIR"
-#=============================================================================
-# FUNCTION NAME: do_test
-#
-# FUNCTION DESCRIPTION: Perform the test
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-do_test()
-{
-$trace_logic
- for executable in $EXECUTABLES
- do
-
- cd $LOCAL_DIR
- echo "${LOCAL_DIR}/${executable} $NFILES Starting"
- ./${executable} $NFILES 2>&1
- retval=$?
- echo "${LOCAL_DIR}/${executable} $NFILES Finished"
-
- if [ "$retval" != 0 ]; then
- end_testcase "Errors have resulted from this test"
+ if [ $TST_IPV6 ]; then
+ REMOTE_DIR="[$(tst_ipaddr rhost)]:$TST_TMPDIR"
+ else
+ REMOTE_DIR="$(tst_ipaddr rhost):$TST_TMPDIR"
fi
- cd $HOME
- echo "Unmounting $TCtmp"
- sleep 2
- umount $TCtmp || error "Cannot umount $TCtmp"
- done
-}
+ if [ "$NFS_TYPE" = "nfs4" ]; then
+ tst_rhost_run -s -c "mkdir -p /export$TST_TMPDIR"
+ tst_rhost_run -s -c "mount --bind $TST_TMPDIR /export$TST_TMPDIR"
+ tst_rhost_run -s -c "exportfs -o no_root_squash,rw,nohide,\
+ insecure,no_subtree_check *:$TST_TMPDIR"
+ else
+ tst_rhost_run -s -c "exportfs -i -o no_root_squash,rw \
+ *:$TST_TMPDIR"
+ fi
+ tst_resm TINFO "Mounting NFS '$REMOTE_DIR' with options '$OPTS'"
+ ROD mount -t $NFS_TYPE $OPTS $REMOTE_DIR $TST_TMPDIR
+}
-#=============================================================================
-# FUNCTION NAME: end_testcase
-#
-# FUNCTION DESCRIPTION: Clean up
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-end_testcase()
+do_test()
{
-$trace_logic
- if [ "$CLEANUP" = "ON" ]; then
- cd \
-
- echo "Cleaning up testcase"
-
- mount -t $NFS_TYPE $OPTS $REMOTE_DIR $TCtmp || echo "Cannot mount $TCtmp"
- rm -rf $LOCAL_DIR || echo "Cannot remove $LOCAL_DIR"
- /bin/umount $TCtmp || echo "Cannot umount $TCtmp"
- rm -rf $TCtmp || echo "Cannot remove $TCtmp"
- rsh -n $RHOST "/usr/sbin/exportfs -u *:$TESTDIR"
- rsh -n $RHOST "rm -rf $TESTDIR"
- fi
-
- [ $# = 0 ] && { tst_resm TPASS "Test Successful"; exit 0; }
- tst_resm TFAIL "Test Failed: $@"
- exit 1
+ tst_resm TINFO "starting 'open_files $NFILES'"
+ ROD open_files $NFILES
+
+ cd $LTPROOT
+ ROD umount $TST_TMPDIR
+ tst_resm TPASS "test finished successfully"
}
-#=============================================================================
-# MAIN PROCEDURE
-#=============================================================================
+cleanup()
+{
+ tst_resm TINFO "Cleaning up testcase"
+ cd $LTPROOT
+ grep -q "$TST_TMPDIR" /proc/mounts && umount $TST_TMPDIR
+
+ tst_rhost_run -c "exportfs -u *:$TST_TMPDIR"
+ tst_rhost_run -c "rm -rf $TST_TMPDIR"
+}
# Check if current filesystem is NFS
-
-STR=`stat -f . | grep "Type: nfs"`
-if [ -n "$STR" ]; then
- test_resm TCONF "Cannot run nfs stress test on an NFS mounted filesystem"
- exit 0
+if [ "$(stat -f . | grep "Type: nfs")" ]; then
+ tst_resm TCONF "Cannot run nfs-stress test on mounted NFS"
fi
setup_testcase
do_test
-end_testcase
+
+tst_exit
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [LTP] [PATCH 02/10] network/nfs: rename nfs dir to nfs_stress
2015-09-30 13:09 [LTP] [PATCH 01/10 resend] network/nfs01: add IPv6 test-cases Alexey Kodanev
@ 2015-09-30 13:09 ` Alexey Kodanev
2015-10-06 13:21 ` Cyril Hrubis
2015-09-30 13:09 ` [LTP] [PATCH 03/10] network/nfs_stress: move common code from nfs01 to library Alexey Kodanev
` (7 subsequent siblings)
8 siblings, 1 reply; 13+ messages in thread
From: Alexey Kodanev @ 2015-09-30 13:09 UTC (permalink / raw)
To: ltp
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
testcases/network/.gitignore | 2 +-
testcases/network/nfs/nfs01/Makefile | 29 ------
testcases/network/nfs/nfs01/nfs01 | 103 --------------------
testcases/network/nfs/nfs01/open_files.c | 126 -------------------------
testcases/network/nfs/nfs_stress/Makefile | 29 ++++++
testcases/network/nfs/nfs_stress/nfs01 | 103 ++++++++++++++++++++
testcases/network/nfs/nfs_stress/open_files.c | 126 +++++++++++++++++++++++++
7 files changed, 259 insertions(+), 259 deletions(-)
delete mode 100644 testcases/network/nfs/nfs01/Makefile
delete mode 100755 testcases/network/nfs/nfs01/nfs01
delete mode 100644 testcases/network/nfs/nfs01/open_files.c
create mode 100644 testcases/network/nfs/nfs_stress/Makefile
create mode 100755 testcases/network/nfs/nfs_stress/nfs01
create mode 100644 testcases/network/nfs/nfs_stress/open_files.c
diff --git a/testcases/network/.gitignore b/testcases/network/.gitignore
index aa6d4da..eae306a 100644
--- a/testcases/network/.gitignore
+++ b/testcases/network/.gitignore
@@ -17,7 +17,7 @@
/multicast/mc_member/mc_member_test
/multicast/mc_opts/mc_verify_opts
/multicast/mc_opts/mc_verify_opts_error
-/nfs/nfs01/open_files
+/nfs/nfs_stress/open_files
/nfs/nfs04/nfs04_create_file
/nfs/nfs_fsstress/fsstress
/nfs/nfslock01/nfs_flock
diff --git a/testcases/network/nfs/nfs01/Makefile b/testcases/network/nfs/nfs01/Makefile
deleted file mode 100644
index 64d9819..0000000
--- a/testcases/network/nfs/nfs01/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# network/nfs/nfs01 testcases Makefile.
-#
-# Copyright (C) 2009, Cisco Systems Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Garrett Cooper, July 2009
-#
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INSTALL_TARGETS := nfs01
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/nfs/nfs01/nfs01 b/testcases/network/nfs/nfs01/nfs01
deleted file mode 100755
index eab2e74..0000000
--- a/testcases/network/nfs/nfs01/nfs01
+++ /dev/null
@@ -1,103 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2015 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
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# PURPOSE: Stresses NFS by opening a large number of files on a nfs
-# mounted filesystem.
-#
-# SETUP: The home directory of root on the machine exported as "RHOST"
-# MUST have a ".rhosts" file with the hostname of the machine
-# where the test is executed.
-#
-#
-# Ported by Robbie Williamson (robbiew@us.ibm.com)
-
-
-TCID="nfs01"
-TST_TOTAL=1
-TST_CLEANUP="cleanup"
-
-. test_net.sh
-
-setup_testcase()
-{
- VERSION=${VERSION:=3}
- NFILES=${NFILES:=1000}
- SOCKET_TYPE="${SOCKET_TYPE:=udp}${TST_IPV6}"
- NFS_TYPE=${NFS_TYPE:=nfs}
-
- tst_check_cmds mount exportfs
-
- tst_tmpdir
-
- tst_resm TINFO "NFS_TYPE: $NFS_TYPE, NFS VERSION: $VERSION"
- tst_resm TINFO "NFILES: $NFILES, SOCKET_TYPE: $SOCKET_TYPE"
-
- if [ "$NFS_TYPE" != "nfs4" ]; then
- OPTS=${OPTS:="-o proto=$SOCKET_TYPE,vers=$VERSION "}
- fi
-
- tst_rhost_run -s -c "mkdir -p $TST_TMPDIR"
-
- if [ $TST_IPV6 ]; then
- REMOTE_DIR="[$(tst_ipaddr rhost)]:$TST_TMPDIR"
- else
- REMOTE_DIR="$(tst_ipaddr rhost):$TST_TMPDIR"
- fi
-
- if [ "$NFS_TYPE" = "nfs4" ]; then
- tst_rhost_run -s -c "mkdir -p /export$TST_TMPDIR"
- tst_rhost_run -s -c "mount --bind $TST_TMPDIR /export$TST_TMPDIR"
- tst_rhost_run -s -c "exportfs -o no_root_squash,rw,nohide,\
- insecure,no_subtree_check *:$TST_TMPDIR"
- else
- tst_rhost_run -s -c "exportfs -i -o no_root_squash,rw \
- *:$TST_TMPDIR"
- fi
-
- tst_resm TINFO "Mounting NFS '$REMOTE_DIR' with options '$OPTS'"
- ROD mount -t $NFS_TYPE $OPTS $REMOTE_DIR $TST_TMPDIR
-}
-
-do_test()
-{
- tst_resm TINFO "starting 'open_files $NFILES'"
- ROD open_files $NFILES
-
- cd $LTPROOT
- ROD umount $TST_TMPDIR
- tst_resm TPASS "test finished successfully"
-}
-
-cleanup()
-{
- tst_resm TINFO "Cleaning up testcase"
- cd $LTPROOT
- grep -q "$TST_TMPDIR" /proc/mounts && umount $TST_TMPDIR
-
- tst_rhost_run -c "exportfs -u *:$TST_TMPDIR"
- tst_rhost_run -c "rm -rf $TST_TMPDIR"
-}
-
-# Check if current filesystem is NFS
-if [ "$(stat -f . | grep "Type: nfs")" ]; then
- tst_resm TCONF "Cannot run nfs-stress test on mounted NFS"
-fi
-
-setup_testcase
-do_test
-
-tst_exit
diff --git a/testcases/network/nfs/nfs01/open_files.c b/testcases/network/nfs/nfs01/open_files.c
deleted file mode 100644
index 9342f11..0000000
--- a/testcases/network/nfs/nfs01/open_files.c
+++ /dev/null
@@ -1,126 +0,0 @@
-#include <stdio.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/param.h>
-#include <sys/wait.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#define TEMPLATE "ltpXXXXXX"
-
-int write_something(int);
-void delete_files(void);
-void abortx(char *fmt, ...);
-
-int main(int argc, char *argv[])
-{
- int filedes[25500];
- int i, n, first, n_files;
- int cid, fork_number;
- int status;
- char filename[PATH_MAX];
-
- if (argc != 2) {
- fprintf(stderr, "Usage: %s <number of files>\n", argv[0]);
- exit(1);
- }
-
- n = sscanf(argv[1], "%d", &n_files);
- if (n != 1) {
- fprintf(stderr, "Usage: %s <number of files>\n", argv[0]);
- exit(1);
- }
-
- first = 0;
- fork_number = 0;
- for (n = 0; n < n_files; n++) {
- strcpy(filename, TEMPLATE);
- filedes[n] = mkstemp(filename);
- if (filedes[n] == -1) {
- if (errno != EMFILE)
- abortx
- ("open() error: file = \"%s\", errno = %d",
- filename, errno);
- else {
- if ((cid = fork())) {
- if (cid == -1)
- abortx("Error forking child");
- else {
- waitpid(cid, &status, 0);
- for (i = first; i < n; i++)
- if (!write_something
- (filedes[i]))
- abortx
- ("Error writing to files");
- if (fork_number == 0)
- delete_files();
- exit(WEXITSTATUS(status));
- }
- } else {
- fork_number++;
- for (i = first; i < n; i++)
- close(filedes[i]);
- first = n;
- n--;
- }
- }
- }
- }
-
- for (i = first; i < n; i++)
- if (!write_something(filedes[i]))
- abortx("Error writing to files");
- if (fork_number == 0)
- delete_files();
- exit(0);
-}
-
-int write_something(int fd)
-{
- int rc;
- const char msg[] = "I Love Linux!!!\n";
- int msg_len = strlen(msg);
-
- rc = write(fd, msg, msg_len);
- if (rc != msg_len)
- return (0);
- if (close(fd))
- return (0);
- return (1);
-}
-
-void delete_files(void)
-{
- DIR *dirp;
- struct dirent *entp;
- struct stat stat_buffer;
-
- dirp = opendir(".");
- for (entp = readdir(dirp); entp; entp = readdir(dirp))
- if (!strncmp(entp->d_name, "apt", 3)) {
- if (stat(entp->d_name, &stat_buffer))
- abortx("stat() failed for \"%s\", errno = %d",
- entp->d_name, errno);
- if (stat_buffer.st_size != 23)
- abortx("wrong file size for \"%s\"",
- entp->d_name);
- if (unlink(entp->d_name))
- abortx("unlink failed for \"%s\"",
- entp->d_name);
- }
-}
-
-void abortx(char *fmt, ...)
-{
- va_list args;
-
- va_start(args, fmt);
- vfprintf(stderr, fmt, args);
- va_end(args);
- fprintf(stderr, "\n");
- exit(1);
-}
diff --git a/testcases/network/nfs/nfs_stress/Makefile b/testcases/network/nfs/nfs_stress/Makefile
new file mode 100644
index 0000000..64d9819
--- /dev/null
+++ b/testcases/network/nfs/nfs_stress/Makefile
@@ -0,0 +1,29 @@
+#
+# network/nfs/nfs01 testcases Makefile.
+#
+# Copyright (C) 2009, Cisco Systems Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Garrett Cooper, July 2009
+#
+
+top_srcdir ?= ../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+INSTALL_TARGETS := nfs01
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/nfs/nfs_stress/nfs01 b/testcases/network/nfs/nfs_stress/nfs01
new file mode 100755
index 0000000..eab2e74
--- /dev/null
+++ b/testcases/network/nfs/nfs_stress/nfs01
@@ -0,0 +1,103 @@
+#!/bin/sh
+# Copyright (c) 2015 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
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# PURPOSE: Stresses NFS by opening a large number of files on a nfs
+# mounted filesystem.
+#
+# SETUP: The home directory of root on the machine exported as "RHOST"
+# MUST have a ".rhosts" file with the hostname of the machine
+# where the test is executed.
+#
+#
+# Ported by Robbie Williamson (robbiew@us.ibm.com)
+
+
+TCID="nfs01"
+TST_TOTAL=1
+TST_CLEANUP="cleanup"
+
+. test_net.sh
+
+setup_testcase()
+{
+ VERSION=${VERSION:=3}
+ NFILES=${NFILES:=1000}
+ SOCKET_TYPE="${SOCKET_TYPE:=udp}${TST_IPV6}"
+ NFS_TYPE=${NFS_TYPE:=nfs}
+
+ tst_check_cmds mount exportfs
+
+ tst_tmpdir
+
+ tst_resm TINFO "NFS_TYPE: $NFS_TYPE, NFS VERSION: $VERSION"
+ tst_resm TINFO "NFILES: $NFILES, SOCKET_TYPE: $SOCKET_TYPE"
+
+ if [ "$NFS_TYPE" != "nfs4" ]; then
+ OPTS=${OPTS:="-o proto=$SOCKET_TYPE,vers=$VERSION "}
+ fi
+
+ tst_rhost_run -s -c "mkdir -p $TST_TMPDIR"
+
+ if [ $TST_IPV6 ]; then
+ REMOTE_DIR="[$(tst_ipaddr rhost)]:$TST_TMPDIR"
+ else
+ REMOTE_DIR="$(tst_ipaddr rhost):$TST_TMPDIR"
+ fi
+
+ if [ "$NFS_TYPE" = "nfs4" ]; then
+ tst_rhost_run -s -c "mkdir -p /export$TST_TMPDIR"
+ tst_rhost_run -s -c "mount --bind $TST_TMPDIR /export$TST_TMPDIR"
+ tst_rhost_run -s -c "exportfs -o no_root_squash,rw,nohide,\
+ insecure,no_subtree_check *:$TST_TMPDIR"
+ else
+ tst_rhost_run -s -c "exportfs -i -o no_root_squash,rw \
+ *:$TST_TMPDIR"
+ fi
+
+ tst_resm TINFO "Mounting NFS '$REMOTE_DIR' with options '$OPTS'"
+ ROD mount -t $NFS_TYPE $OPTS $REMOTE_DIR $TST_TMPDIR
+}
+
+do_test()
+{
+ tst_resm TINFO "starting 'open_files $NFILES'"
+ ROD open_files $NFILES
+
+ cd $LTPROOT
+ ROD umount $TST_TMPDIR
+ tst_resm TPASS "test finished successfully"
+}
+
+cleanup()
+{
+ tst_resm TINFO "Cleaning up testcase"
+ cd $LTPROOT
+ grep -q "$TST_TMPDIR" /proc/mounts && umount $TST_TMPDIR
+
+ tst_rhost_run -c "exportfs -u *:$TST_TMPDIR"
+ tst_rhost_run -c "rm -rf $TST_TMPDIR"
+}
+
+# Check if current filesystem is NFS
+if [ "$(stat -f . | grep "Type: nfs")" ]; then
+ tst_resm TCONF "Cannot run nfs-stress test on mounted NFS"
+fi
+
+setup_testcase
+do_test
+
+tst_exit
diff --git a/testcases/network/nfs/nfs_stress/open_files.c b/testcases/network/nfs/nfs_stress/open_files.c
new file mode 100644
index 0000000..9342f11
--- /dev/null
+++ b/testcases/network/nfs/nfs_stress/open_files.c
@@ -0,0 +1,126 @@
+#include <stdio.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/param.h>
+#include <sys/wait.h>
+#include <dirent.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#define TEMPLATE "ltpXXXXXX"
+
+int write_something(int);
+void delete_files(void);
+void abortx(char *fmt, ...);
+
+int main(int argc, char *argv[])
+{
+ int filedes[25500];
+ int i, n, first, n_files;
+ int cid, fork_number;
+ int status;
+ char filename[PATH_MAX];
+
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s <number of files>\n", argv[0]);
+ exit(1);
+ }
+
+ n = sscanf(argv[1], "%d", &n_files);
+ if (n != 1) {
+ fprintf(stderr, "Usage: %s <number of files>\n", argv[0]);
+ exit(1);
+ }
+
+ first = 0;
+ fork_number = 0;
+ for (n = 0; n < n_files; n++) {
+ strcpy(filename, TEMPLATE);
+ filedes[n] = mkstemp(filename);
+ if (filedes[n] == -1) {
+ if (errno != EMFILE)
+ abortx
+ ("open() error: file = \"%s\", errno = %d",
+ filename, errno);
+ else {
+ if ((cid = fork())) {
+ if (cid == -1)
+ abortx("Error forking child");
+ else {
+ waitpid(cid, &status, 0);
+ for (i = first; i < n; i++)
+ if (!write_something
+ (filedes[i]))
+ abortx
+ ("Error writing to files");
+ if (fork_number == 0)
+ delete_files();
+ exit(WEXITSTATUS(status));
+ }
+ } else {
+ fork_number++;
+ for (i = first; i < n; i++)
+ close(filedes[i]);
+ first = n;
+ n--;
+ }
+ }
+ }
+ }
+
+ for (i = first; i < n; i++)
+ if (!write_something(filedes[i]))
+ abortx("Error writing to files");
+ if (fork_number == 0)
+ delete_files();
+ exit(0);
+}
+
+int write_something(int fd)
+{
+ int rc;
+ const char msg[] = "I Love Linux!!!\n";
+ int msg_len = strlen(msg);
+
+ rc = write(fd, msg, msg_len);
+ if (rc != msg_len)
+ return (0);
+ if (close(fd))
+ return (0);
+ return (1);
+}
+
+void delete_files(void)
+{
+ DIR *dirp;
+ struct dirent *entp;
+ struct stat stat_buffer;
+
+ dirp = opendir(".");
+ for (entp = readdir(dirp); entp; entp = readdir(dirp))
+ if (!strncmp(entp->d_name, "apt", 3)) {
+ if (stat(entp->d_name, &stat_buffer))
+ abortx("stat() failed for \"%s\", errno = %d",
+ entp->d_name, errno);
+ if (stat_buffer.st_size != 23)
+ abortx("wrong file size for \"%s\"",
+ entp->d_name);
+ if (unlink(entp->d_name))
+ abortx("unlink failed for \"%s\"",
+ entp->d_name);
+ }
+}
+
+void abortx(char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+ fprintf(stderr, "\n");
+ exit(1);
+}
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [LTP] [PATCH 03/10] network/nfs_stress: move common code from nfs01 to library
2015-09-30 13:09 [LTP] [PATCH 01/10 resend] network/nfs01: add IPv6 test-cases Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 02/10] network/nfs: rename nfs dir to nfs_stress Alexey Kodanev
@ 2015-09-30 13:09 ` Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 04/10] network/nfs02: move to nfs_stress Alexey Kodanev
` (6 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Alexey Kodanev @ 2015-09-30 13:09 UTC (permalink / raw)
To: ltp
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
testcases/network/nfs/nfs_stress/Makefile | 3 +-
testcases/network/nfs/nfs_stress/nfs01 | 62 +-----------------------
testcases/network/nfs/nfs_stress/nfs_lib.sh | 70 +++++++++++++++++++++++++++
3 files changed, 73 insertions(+), 62 deletions(-)
create mode 100644 testcases/network/nfs/nfs_stress/nfs_lib.sh
diff --git a/testcases/network/nfs/nfs_stress/Makefile b/testcases/network/nfs/nfs_stress/Makefile
index 64d9819..58e24d0 100644
--- a/testcases/network/nfs/nfs_stress/Makefile
+++ b/testcases/network/nfs/nfs_stress/Makefile
@@ -24,6 +24,7 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/env_pre.mk
-INSTALL_TARGETS := nfs01
+INSTALL_TARGETS := nfs_lib.sh \
+ nfs01
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/nfs/nfs_stress/nfs01 b/testcases/network/nfs/nfs_stress/nfs01
index eab2e74..986855e 100755
--- a/testcases/network/nfs/nfs_stress/nfs01
+++ b/testcases/network/nfs/nfs_stress/nfs01
@@ -18,60 +18,15 @@
# PURPOSE: Stresses NFS by opening a large number of files on a nfs
# mounted filesystem.
#
-# SETUP: The home directory of root on the machine exported as "RHOST"
-# MUST have a ".rhosts" file with the hostname of the machine
-# where the test is executed.
-#
-#
# Ported by Robbie Williamson (robbiew@us.ibm.com)
-
TCID="nfs01"
TST_TOTAL=1
TST_CLEANUP="cleanup"
+. nfs_lib.sh
. test_net.sh
-setup_testcase()
-{
- VERSION=${VERSION:=3}
- NFILES=${NFILES:=1000}
- SOCKET_TYPE="${SOCKET_TYPE:=udp}${TST_IPV6}"
- NFS_TYPE=${NFS_TYPE:=nfs}
-
- tst_check_cmds mount exportfs
-
- tst_tmpdir
-
- tst_resm TINFO "NFS_TYPE: $NFS_TYPE, NFS VERSION: $VERSION"
- tst_resm TINFO "NFILES: $NFILES, SOCKET_TYPE: $SOCKET_TYPE"
-
- if [ "$NFS_TYPE" != "nfs4" ]; then
- OPTS=${OPTS:="-o proto=$SOCKET_TYPE,vers=$VERSION "}
- fi
-
- tst_rhost_run -s -c "mkdir -p $TST_TMPDIR"
-
- if [ $TST_IPV6 ]; then
- REMOTE_DIR="[$(tst_ipaddr rhost)]:$TST_TMPDIR"
- else
- REMOTE_DIR="$(tst_ipaddr rhost):$TST_TMPDIR"
- fi
-
- if [ "$NFS_TYPE" = "nfs4" ]; then
- tst_rhost_run -s -c "mkdir -p /export$TST_TMPDIR"
- tst_rhost_run -s -c "mount --bind $TST_TMPDIR /export$TST_TMPDIR"
- tst_rhost_run -s -c "exportfs -o no_root_squash,rw,nohide,\
- insecure,no_subtree_check *:$TST_TMPDIR"
- else
- tst_rhost_run -s -c "exportfs -i -o no_root_squash,rw \
- *:$TST_TMPDIR"
- fi
-
- tst_resm TINFO "Mounting NFS '$REMOTE_DIR' with options '$OPTS'"
- ROD mount -t $NFS_TYPE $OPTS $REMOTE_DIR $TST_TMPDIR
-}
-
do_test()
{
tst_resm TINFO "starting 'open_files $NFILES'"
@@ -82,21 +37,6 @@ do_test()
tst_resm TPASS "test finished successfully"
}
-cleanup()
-{
- tst_resm TINFO "Cleaning up testcase"
- cd $LTPROOT
- grep -q "$TST_TMPDIR" /proc/mounts && umount $TST_TMPDIR
-
- tst_rhost_run -c "exportfs -u *:$TST_TMPDIR"
- tst_rhost_run -c "rm -rf $TST_TMPDIR"
-}
-
-# Check if current filesystem is NFS
-if [ "$(stat -f . | grep "Type: nfs")" ]; then
- tst_resm TCONF "Cannot run nfs-stress test on mounted NFS"
-fi
-
setup_testcase
do_test
diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
new file mode 100644
index 0000000..7867b17
--- /dev/null
+++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh
@@ -0,0 +1,70 @@
+# Copyright (c) 2015 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
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+setup_testcase()
+{
+ VERSION=${VERSION:=3}
+ NFILES=${NFILES:=1000}
+ SOCKET_TYPE="${SOCKET_TYPE:=udp}${TST_IPV6}"
+ NFS_TYPE=${NFS_TYPE:=nfs}
+
+ tst_check_cmds mount exportfs
+
+ tst_tmpdir
+
+ # Check if current filesystem is NFS
+ if [ "$(stat -f . | grep "Type: nfs")" ]; then
+ tst_brkm TCONF "Cannot run nfs-stress test on mounted NFS"
+ fi
+
+ tst_resm TINFO "NFS_TYPE: $NFS_TYPE, NFS VERSION: $VERSION"
+ tst_resm TINFO "NFILES: $NFILES, SOCKET_TYPE: $SOCKET_TYPE"
+
+ if [ "$NFS_TYPE" != "nfs4" ]; then
+ OPTS=${OPTS:="-o proto=$SOCKET_TYPE,vers=$VERSION "}
+ fi
+
+ tst_rhost_run -s -c "mkdir -p $TST_TMPDIR"
+
+ if [ $TST_IPV6 ]; then
+ REMOTE_DIR="[$(tst_ipaddr rhost)]:$TST_TMPDIR"
+ else
+ REMOTE_DIR="$(tst_ipaddr rhost):$TST_TMPDIR"
+ fi
+
+ if [ "$NFS_TYPE" = "nfs4" ]; then
+ tst_rhost_run -s -c "mkdir -p /export$TST_TMPDIR"
+ tst_rhost_run -s -c "mount --bind $TST_TMPDIR /export$TST_TMPDIR"
+ tst_rhost_run -s -c "exportfs -o no_root_squash,rw,nohide,\
+ insecure,no_subtree_check *:$TST_TMPDIR"
+ else
+ tst_rhost_run -s -c "exportfs -i -o no_root_squash,rw \
+ *:$TST_TMPDIR"
+ fi
+
+ tst_resm TINFO "Mounting NFS '$REMOTE_DIR' with options '$OPTS'"
+ ROD mount -t $NFS_TYPE $OPTS $REMOTE_DIR $TST_TMPDIR
+}
+
+cleanup()
+{
+ tst_resm TINFO "Cleaning up testcase"
+ cd $LTPROOT
+ grep -q "$TST_TMPDIR" /proc/mounts && umount $TST_TMPDIR
+
+ tst_rhost_run -c "exportfs -u *:$TST_TMPDIR"
+ tst_rhost_run -c "rm -rf $TST_TMPDIR"
+}
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [LTP] [PATCH 04/10] network/nfs02: move to nfs_stress
2015-09-30 13:09 [LTP] [PATCH 01/10 resend] network/nfs01: add IPv6 test-cases Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 02/10] network/nfs: rename nfs dir to nfs_stress Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 03/10] network/nfs_stress: move common code from nfs01 to library Alexey Kodanev
@ 2015-09-30 13:09 ` Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 05/10] network/nfs_stress/nfs02: use nfs_lib.sh Alexey Kodanev
` (5 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Alexey Kodanev @ 2015-09-30 13:09 UTC (permalink / raw)
To: ltp
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
testcases/network/nfs/nfs02/Makefile | 31 ----
testcases/network/nfs/nfs02/nfs02 | 245 -----------------------------
testcases/network/nfs/nfs_stress/Makefile | 33 ++---
testcases/network/nfs/nfs_stress/nfs02 | 245 +++++++++++++++++++++++++++++
4 files changed, 259 insertions(+), 295 deletions(-)
delete mode 100644 testcases/network/nfs/nfs02/Makefile
delete mode 100755 testcases/network/nfs/nfs02/nfs02
create mode 100755 testcases/network/nfs/nfs_stress/nfs02
diff --git a/testcases/network/nfs/nfs02/Makefile b/testcases/network/nfs/nfs02/Makefile
deleted file mode 100644
index 226c481..0000000
--- a/testcases/network/nfs/nfs02/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# network/nfs/nfs02 testcases Makefile.
-#
-# Copyright (C) 2009, Cisco Systems Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Garrett Cooper, July 2009
-#
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INSTALL_TARGETS := nfs02
-
-MAKE_TARGETS :=
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/nfs/nfs02/nfs02 b/testcases/network/nfs/nfs02/nfs02
deleted file mode 100755
index c192d96..0000000
--- a/testcases/network/nfs/nfs02/nfs02
+++ /dev/null
@@ -1,245 +0,0 @@
-#! /bin/sh
-#
-# Copyright (c) International Business Machines Corp., 2001
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implie; warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
-# the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# FILE : nfs02
-#
-# PURPOSE: Tests NFS copy of various filesizes, file consistency between copies
-# and preservation of write/nowrite permissions.
-#
-# SETUP: The home directory of root on the machine exported as "RHOST"
-# MUST have a ".rhosts" file with the hostname of the machine
-# where the test is executed.
-#
-#
-# HISTORY:
-# 05/15/01 Robbie Williamson (robbiew@us.ibm.com)
-# -Ported
-#
-#**********************************************************************
-
-#Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-
-$trace_logic
-
-#-----------------------------------------------------------------------
-# Initialize local variables
-#-----------------------------------------------------------------------
-
-TC=nfs02
-TCbin=${TCbin:=`pwd`}
-TCdat=${TCdat:=$TCbin/datafiles}
-TCsrc=${TCsrc:=$TCbin}
-TCtmp=${TCtmp:=$TCbin/$TC$$}
-export TCID=$TC
-export TST_TOTAL=1
-export TST_COUNT=1
-
-PID=$$
-
-RHOST=${RHOST:=`hostname`}
-VERSION=${VERSION:=3}
-SOCKET_TYPE=${SOCKET_TYPE:=udp}
-TESTDIR=${TESTDIR:=/tmp/$TC$PID.testdir}
-CLEANUP=${CLEANUP:="ON"}
-NFS_TYPE=${NFS_TYPE:=nfs}
-
-#---------------------------------------------------------------------#
-# FUNCTION: do_setup
-# PURPOSE: To create the necessary files to carry out the test
-# INPUT: None.
-# OUTPUT: None.
-#---------------------------------------------------------------------#
-do_setup()
-{
-$trace_logic
-
- echo "do_setup $TC"
-
- echo ""
- echo "Test Options:"
- echo " VERSION: $VERSION"
- echo " RHOST: $RHOST"
- echo " SOCKET_TYPE: $SOCKET_TYPE"
- echo " NFS_TYPE: $NFS_TYPE"
- echo " TESTDIR: $TESTDIR"
-
- if [ "x$NFS_TYPE" != "xnfs4" ]; then
- OPTS="-o vers=$VERSION,proto=$SOCKET_TYPE"
- fi
-
- IAM=${IAM:=`whoami`}
- [ $IAM = "root" ] || end_testcase "Must be root user"
-
- #Setup and Export the data directory on RHOST
- rsh -n $RHOST "mkdir -p $TESTDIR"
- [ $? -eq 0 ] || end_testcase "Could not create $TESTDIR from $RHOST"
-
- if [ "x$NFS_TYPE" = "xnfs4" ]; then
- rsh -n $RHOST "mkdir -p /export$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not create /export$TESTDIR on server"
- rsh -n $RHOST "mount --bind $TESTDIR /export$TESTDIR"
- [ $? = 0 ] || end_testcase "Could notbind $TESTDIR to /export"
- rsh -n $RHOST "/usr/sbin/exportfs -o no_root_squash,rw,nohide,insecure,no_subtree_check *:$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not export remote directory"
- else
- rsh -n $RHOST "/usr/sbin/exportfs -i *:$TESTDIR -o rw,no_root_squash "
- [ $? -eq 0 ] || end_testcase "Could not export $TESTDIR from $RHOST"
- fi
-
- #Verify export
- showmount -e $RHOST | grep $TESTDIR
- [ $? -eq 0 ] || end_testcase "$TESTDIR not exported"
-
- #Create $TCtmp for mount point
- mkdir -p $TCtmp
- [ $? -eq 0 ] || end_testcase "Could not create $TCtmp"
-
- #Mount $TCdat from RHOST.
- mount -t $NFS_TYPE $OPTS $RHOST:$TESTDIR $TCtmp
- [ $? -eq 0 ] || end_testcase "Could not mount from $RHOST"
-
-}
-
-
-#---------------------------------------------------------------------#
-# FUNCTION: do_test1
-# PURPOSE: Perform the necessary steps to complete the test.
-# INPUT: None.
-# OUTPUT: Error messages are logged if any of the tests fail.
-#---------------------------------------------------------------------#
-do_test1()
-{
-$trace_logic
- echo "do_test1 $TC "
- cp $TCdat/ascii.jmb $TCtmp &
- wait $!
- echo "compare both ascii.jmbs"
- diff $TCtmp/ascii.jmb $TCdat/ascii.jmb
- [ $? -eq 0 ] || end_testcase "'diff' of ascii.jmb FAILED"
-
-}
-
-#---------------------------------------------------------------------#
-# FUNCTION: do_test2
-# PURPOSE: Perform the necessary steps to complete the test.
-# INPUT: None.
-# OUTPUT: Error messages are logged if any of the tests fail.
-#---------------------------------------------------------------------#
-do_test2()
-{
-$trace_logic
- echo "do_test2 $TC "
- cp $TCdat/ascii.sm $TCtmp &
- wait $!
- cp $TCdat/ascii.med $TCtmp &
- wait $!
- cp $TCdat/ascii.lg $TCtmp &
- wait $!
-
- #small file
- cp $TCtmp/ascii.sm $TCtmp/ascii.smcp &
- wait $!
- diff $TCtmp/ascii.smcp $TCdat/ascii.sm
- [ $? -eq 0 ] || end_testcase "'diff' of ascii.sm FAILED"
-
- #medium file
- cp $TCtmp/ascii.med $TCtmp/ascii.medcp &
- wait $!
- diff $TCtmp/ascii.medcp $TCdat/ascii.med
- [ $? -eq 0 ] || end_testcase "'diff' of ascii.med FAILED"
-
- #large file
- cp $TCtmp/ascii.lg $TCtmp/ascii.lgcp &
- wait $!
- diff $TCtmp/ascii.lgcp $TCdat/ascii.lg
- [ $? -eq 0 ] || end_testcase "'diff' of ascii.lg FAILED"
-
-}
-
-#---------------------------------------------------------------------#
-# FUNCTION: do_test3
-# PURPOSE: Perform the necessary steps to complete the test.
-# INPUT: None.
-# OUTPUT: Error messages are logged if any of the tests fail.
-#---------------------------------------------------------------------#
-do_test3()
-{
-$trace_logic
- echo "do_test3 $TC "
- chmod a-wx $TCtmp/ascii.sm &
- wait $!
- ls -l $TCtmp/ascii.sm | grep "r--"
- [ $? -eq 0 ] || end_testcase "Removal of write permissions not honored on ascii.sm"
- chmod a+w $TCtmp/ascii.sm
-}
-
-#---------------------------------------------------------------------#
-# FUNCTION: do_cleanup
-# PURPOSE: To delete all the files created to run this test.
-# INPUT: None.
-# OUTPUT: None.
-#---------------------------------------------------------------------#
-do_cleanup()
-{
-$trace_logic
- echo "do_cleanup $TC "
- rm -f $TCtmp/*.fil*
- cd $TCbin
- umount $TCtmp
- sleep 3
- rmdir $TCtmp
- rsh -n $RHOST "/usr/sbin/exportfs -u *:$TESTDIR"
- rsh -n $RHOST "rm -rf $TESTDIR"
-}
-
-#=============================================================================
-# FUNCTION NAME: end_testcase
-#
-# FUNCTION DESCRIPTION: Clean up
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-end_testcase()
-{
-$trace_logic
- if [ "$CLEANUP" = "ON" ]; then
- do_cleanup
- fi
-
- [ $# = 0 ] && { tst_resm TPASS "Test Successful"; exit 0; }
- tst_resm TFAIL "Test Failed: $@"
- exit 1
-}
-
-#=============================================================================
-#---------------------------------------------------------------------#
-# FUNCTION: MAIN
-# PURPOSE: To invoke the functions to perform the tasks described in
-# the prologue.
-# INPUT: None.
-# OUTPUT: A testcase run log with the results of the execution of this
-# test.
-#---------------------------------------------------------------------#
-do_setup
-do_test1
-do_test2
-do_test3
-end_testcase
diff --git a/testcases/network/nfs/nfs_stress/Makefile b/testcases/network/nfs/nfs_stress/Makefile
index 58e24d0..ff61dfb 100644
--- a/testcases/network/nfs/nfs_stress/Makefile
+++ b/testcases/network/nfs/nfs_stress/Makefile
@@ -1,30 +1,25 @@
+# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (C) 2009, Cisco Systems Inc.
#
-# network/nfs/nfs01 testcases Makefile.
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
#
-# Copyright (C) 2009, Cisco Systems Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Garrett Cooper, July 2009
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/env_pre.mk
INSTALL_TARGETS := nfs_lib.sh \
- nfs01
+ nfs01 \
+ nfs02
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/nfs/nfs_stress/nfs02 b/testcases/network/nfs/nfs_stress/nfs02
new file mode 100755
index 0000000..c192d96
--- /dev/null
+++ b/testcases/network/nfs/nfs_stress/nfs02
@@ -0,0 +1,245 @@
+#! /bin/sh
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implie; warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# FILE : nfs02
+#
+# PURPOSE: Tests NFS copy of various filesizes, file consistency between copies
+# and preservation of write/nowrite permissions.
+#
+# SETUP: The home directory of root on the machine exported as "RHOST"
+# MUST have a ".rhosts" file with the hostname of the machine
+# where the test is executed.
+#
+#
+# HISTORY:
+# 05/15/01 Robbie Williamson (robbiew@us.ibm.com)
+# -Ported
+#
+#**********************************************************************
+
+#Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+
+$trace_logic
+
+#-----------------------------------------------------------------------
+# Initialize local variables
+#-----------------------------------------------------------------------
+
+TC=nfs02
+TCbin=${TCbin:=`pwd`}
+TCdat=${TCdat:=$TCbin/datafiles}
+TCsrc=${TCsrc:=$TCbin}
+TCtmp=${TCtmp:=$TCbin/$TC$$}
+export TCID=$TC
+export TST_TOTAL=1
+export TST_COUNT=1
+
+PID=$$
+
+RHOST=${RHOST:=`hostname`}
+VERSION=${VERSION:=3}
+SOCKET_TYPE=${SOCKET_TYPE:=udp}
+TESTDIR=${TESTDIR:=/tmp/$TC$PID.testdir}
+CLEANUP=${CLEANUP:="ON"}
+NFS_TYPE=${NFS_TYPE:=nfs}
+
+#---------------------------------------------------------------------#
+# FUNCTION: do_setup
+# PURPOSE: To create the necessary files to carry out the test
+# INPUT: None.
+# OUTPUT: None.
+#---------------------------------------------------------------------#
+do_setup()
+{
+$trace_logic
+
+ echo "do_setup $TC"
+
+ echo ""
+ echo "Test Options:"
+ echo " VERSION: $VERSION"
+ echo " RHOST: $RHOST"
+ echo " SOCKET_TYPE: $SOCKET_TYPE"
+ echo " NFS_TYPE: $NFS_TYPE"
+ echo " TESTDIR: $TESTDIR"
+
+ if [ "x$NFS_TYPE" != "xnfs4" ]; then
+ OPTS="-o vers=$VERSION,proto=$SOCKET_TYPE"
+ fi
+
+ IAM=${IAM:=`whoami`}
+ [ $IAM = "root" ] || end_testcase "Must be root user"
+
+ #Setup and Export the data directory on RHOST
+ rsh -n $RHOST "mkdir -p $TESTDIR"
+ [ $? -eq 0 ] || end_testcase "Could not create $TESTDIR from $RHOST"
+
+ if [ "x$NFS_TYPE" = "xnfs4" ]; then
+ rsh -n $RHOST "mkdir -p /export$TESTDIR"
+ [ $? = 0 ] || end_testcase "Could not create /export$TESTDIR on server"
+ rsh -n $RHOST "mount --bind $TESTDIR /export$TESTDIR"
+ [ $? = 0 ] || end_testcase "Could notbind $TESTDIR to /export"
+ rsh -n $RHOST "/usr/sbin/exportfs -o no_root_squash,rw,nohide,insecure,no_subtree_check *:$TESTDIR"
+ [ $? = 0 ] || end_testcase "Could not export remote directory"
+ else
+ rsh -n $RHOST "/usr/sbin/exportfs -i *:$TESTDIR -o rw,no_root_squash "
+ [ $? -eq 0 ] || end_testcase "Could not export $TESTDIR from $RHOST"
+ fi
+
+ #Verify export
+ showmount -e $RHOST | grep $TESTDIR
+ [ $? -eq 0 ] || end_testcase "$TESTDIR not exported"
+
+ #Create $TCtmp for mount point
+ mkdir -p $TCtmp
+ [ $? -eq 0 ] || end_testcase "Could not create $TCtmp"
+
+ #Mount $TCdat from RHOST.
+ mount -t $NFS_TYPE $OPTS $RHOST:$TESTDIR $TCtmp
+ [ $? -eq 0 ] || end_testcase "Could not mount from $RHOST"
+
+}
+
+
+#---------------------------------------------------------------------#
+# FUNCTION: do_test1
+# PURPOSE: Perform the necessary steps to complete the test.
+# INPUT: None.
+# OUTPUT: Error messages are logged if any of the tests fail.
+#---------------------------------------------------------------------#
+do_test1()
+{
+$trace_logic
+ echo "do_test1 $TC "
+ cp $TCdat/ascii.jmb $TCtmp &
+ wait $!
+ echo "compare both ascii.jmbs"
+ diff $TCtmp/ascii.jmb $TCdat/ascii.jmb
+ [ $? -eq 0 ] || end_testcase "'diff' of ascii.jmb FAILED"
+
+}
+
+#---------------------------------------------------------------------#
+# FUNCTION: do_test2
+# PURPOSE: Perform the necessary steps to complete the test.
+# INPUT: None.
+# OUTPUT: Error messages are logged if any of the tests fail.
+#---------------------------------------------------------------------#
+do_test2()
+{
+$trace_logic
+ echo "do_test2 $TC "
+ cp $TCdat/ascii.sm $TCtmp &
+ wait $!
+ cp $TCdat/ascii.med $TCtmp &
+ wait $!
+ cp $TCdat/ascii.lg $TCtmp &
+ wait $!
+
+ #small file
+ cp $TCtmp/ascii.sm $TCtmp/ascii.smcp &
+ wait $!
+ diff $TCtmp/ascii.smcp $TCdat/ascii.sm
+ [ $? -eq 0 ] || end_testcase "'diff' of ascii.sm FAILED"
+
+ #medium file
+ cp $TCtmp/ascii.med $TCtmp/ascii.medcp &
+ wait $!
+ diff $TCtmp/ascii.medcp $TCdat/ascii.med
+ [ $? -eq 0 ] || end_testcase "'diff' of ascii.med FAILED"
+
+ #large file
+ cp $TCtmp/ascii.lg $TCtmp/ascii.lgcp &
+ wait $!
+ diff $TCtmp/ascii.lgcp $TCdat/ascii.lg
+ [ $? -eq 0 ] || end_testcase "'diff' of ascii.lg FAILED"
+
+}
+
+#---------------------------------------------------------------------#
+# FUNCTION: do_test3
+# PURPOSE: Perform the necessary steps to complete the test.
+# INPUT: None.
+# OUTPUT: Error messages are logged if any of the tests fail.
+#---------------------------------------------------------------------#
+do_test3()
+{
+$trace_logic
+ echo "do_test3 $TC "
+ chmod a-wx $TCtmp/ascii.sm &
+ wait $!
+ ls -l $TCtmp/ascii.sm | grep "r--"
+ [ $? -eq 0 ] || end_testcase "Removal of write permissions not honored on ascii.sm"
+ chmod a+w $TCtmp/ascii.sm
+}
+
+#---------------------------------------------------------------------#
+# FUNCTION: do_cleanup
+# PURPOSE: To delete all the files created to run this test.
+# INPUT: None.
+# OUTPUT: None.
+#---------------------------------------------------------------------#
+do_cleanup()
+{
+$trace_logic
+ echo "do_cleanup $TC "
+ rm -f $TCtmp/*.fil*
+ cd $TCbin
+ umount $TCtmp
+ sleep 3
+ rmdir $TCtmp
+ rsh -n $RHOST "/usr/sbin/exportfs -u *:$TESTDIR"
+ rsh -n $RHOST "rm -rf $TESTDIR"
+}
+
+#=============================================================================
+# FUNCTION NAME: end_testcase
+#
+# FUNCTION DESCRIPTION: Clean up
+#
+# PARAMETERS: None.
+#
+# RETURNS: None.
+#=============================================================================
+end_testcase()
+{
+$trace_logic
+ if [ "$CLEANUP" = "ON" ]; then
+ do_cleanup
+ fi
+
+ [ $# = 0 ] && { tst_resm TPASS "Test Successful"; exit 0; }
+ tst_resm TFAIL "Test Failed: $@"
+ exit 1
+}
+
+#=============================================================================
+#---------------------------------------------------------------------#
+# FUNCTION: MAIN
+# PURPOSE: To invoke the functions to perform the tasks described in
+# the prologue.
+# INPUT: None.
+# OUTPUT: A testcase run log with the results of the execution of this
+# test.
+#---------------------------------------------------------------------#
+do_setup
+do_test1
+do_test2
+do_test3
+end_testcase
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [LTP] [PATCH 05/10] network/nfs_stress/nfs02: use nfs_lib.sh
2015-09-30 13:09 [LTP] [PATCH 01/10 resend] network/nfs01: add IPv6 test-cases Alexey Kodanev
` (2 preceding siblings ...)
2015-09-30 13:09 ` [LTP] [PATCH 04/10] network/nfs02: move to nfs_stress Alexey Kodanev
@ 2015-09-30 13:09 ` Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 06/10] network/nfs/nfs_stress: rename library functions names Alexey Kodanev
` (4 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Alexey Kodanev @ 2015-09-30 13:09 UTC (permalink / raw)
To: ltp
Also, update runtest/nfs file with new test-cases.
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
runtest/nfs | 6 +-
testcases/network/nfs/nfs_stress/nfs02 | 259 ++++++--------------------------
2 files changed, 48 insertions(+), 217 deletions(-)
diff --git a/runtest/nfs b/runtest/nfs
index 7bee16f..ad0e25f 100644
--- a/runtest/nfs
+++ b/runtest/nfs
@@ -7,7 +7,11 @@ 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
-nfs02 export VERSION SOCKET_TYPE; TCbin=$LTPROOT/testcases/bin nfs02
+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
+
nfs03 export VERSION SOCKET_TYPE; TCbin=$LTPROOT/testcases/bin nfs03
nfs04 export VERSION SOCKET_TYPE; TCbin=$LTPROOT/testcases/bin nfs04
nfslock01 export VERSION; TCbin=$LTPROOT/testcases/bin nfslock01
diff --git a/testcases/network/nfs/nfs_stress/nfs02 b/testcases/network/nfs/nfs_stress/nfs02
index c192d96..a600034 100755
--- a/testcases/network/nfs/nfs_stress/nfs02
+++ b/testcases/network/nfs/nfs_stress/nfs02
@@ -1,245 +1,72 @@
#! /bin/sh
+# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines Corp., 2001
#
-# Copyright (c) International Business Machines Corp., 2001
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implie; warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
-# the GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+# PURPOSE: Tests NFS copy of various filesizes, file consistency
+# between copies and preservation of write/nowrite permissions.
#
-# FILE : nfs02
-#
-# PURPOSE: Tests NFS copy of various filesizes, file consistency between copies
-# and preservation of write/nowrite permissions.
-#
-# SETUP: The home directory of root on the machine exported as "RHOST"
-# MUST have a ".rhosts" file with the hostname of the machine
-# where the test is executed.
-#
-#
-# HISTORY:
-# 05/15/01 Robbie Williamson (robbiew@us.ibm.com)
-# -Ported
-#
-#**********************************************************************
-
-#Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-
-$trace_logic
-
-#-----------------------------------------------------------------------
-# Initialize local variables
-#-----------------------------------------------------------------------
-
-TC=nfs02
-TCbin=${TCbin:=`pwd`}
-TCdat=${TCdat:=$TCbin/datafiles}
-TCsrc=${TCsrc:=$TCbin}
-TCtmp=${TCtmp:=$TCbin/$TC$$}
-export TCID=$TC
-export TST_TOTAL=1
-export TST_COUNT=1
-
-PID=$$
-
-RHOST=${RHOST:=`hostname`}
-VERSION=${VERSION:=3}
-SOCKET_TYPE=${SOCKET_TYPE:=udp}
-TESTDIR=${TESTDIR:=/tmp/$TC$PID.testdir}
-CLEANUP=${CLEANUP:="ON"}
-NFS_TYPE=${NFS_TYPE:=nfs}
-
-#---------------------------------------------------------------------#
-# FUNCTION: do_setup
-# PURPOSE: To create the necessary files to carry out the test
-# INPUT: None.
-# OUTPUT: None.
-#---------------------------------------------------------------------#
-do_setup()
-{
-$trace_logic
-
- echo "do_setup $TC"
-
- echo ""
- echo "Test Options:"
- echo " VERSION: $VERSION"
- echo " RHOST: $RHOST"
- echo " SOCKET_TYPE: $SOCKET_TYPE"
- echo " NFS_TYPE: $NFS_TYPE"
- echo " TESTDIR: $TESTDIR"
-
- if [ "x$NFS_TYPE" != "xnfs4" ]; then
- OPTS="-o vers=$VERSION,proto=$SOCKET_TYPE"
- fi
-
- IAM=${IAM:=`whoami`}
- [ $IAM = "root" ] || end_testcase "Must be root user"
+# Ported by: Robbie Williamson (robbiew@us.ibm.com)
- #Setup and Export the data directory on RHOST
- rsh -n $RHOST "mkdir -p $TESTDIR"
- [ $? -eq 0 ] || end_testcase "Could not create $TESTDIR from $RHOST"
+TCID="nfs02"
+TST_TOTAL=3
+TST_CLEANUP="cleanup"
- if [ "x$NFS_TYPE" = "xnfs4" ]; then
- rsh -n $RHOST "mkdir -p /export$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not create /export$TESTDIR on server"
- rsh -n $RHOST "mount --bind $TESTDIR /export$TESTDIR"
- [ $? = 0 ] || end_testcase "Could notbind $TESTDIR to /export"
- rsh -n $RHOST "/usr/sbin/exportfs -o no_root_squash,rw,nohide,insecure,no_subtree_check *:$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not export remote directory"
- else
- rsh -n $RHOST "/usr/sbin/exportfs -i *:$TESTDIR -o rw,no_root_squash "
- [ $? -eq 0 ] || end_testcase "Could not export $TESTDIR from $RHOST"
- fi
+. nfs_lib.sh
+. test_net.sh
- #Verify export
- showmount -e $RHOST | grep $TESTDIR
- [ $? -eq 0 ] || end_testcase "$TESTDIR not exported"
-
- #Create $TCtmp for mount point
- mkdir -p $TCtmp
- [ $? -eq 0 ] || end_testcase "Could not create $TCtmp"
-
- #Mount $TCdat from RHOST.
- mount -t $NFS_TYPE $OPTS $RHOST:$TESTDIR $TCtmp
- [ $? -eq 0 ] || end_testcase "Could not mount from $RHOST"
-
-}
-
-
-#---------------------------------------------------------------------#
-# FUNCTION: do_test1
-# PURPOSE: Perform the necessary steps to complete the test.
-# INPUT: None.
-# OUTPUT: Error messages are logged if any of the tests fail.
-#---------------------------------------------------------------------#
do_test1()
{
-$trace_logic
- echo "do_test1 $TC "
- cp $TCdat/ascii.jmb $TCtmp &
- wait $!
- echo "compare both ascii.jmbs"
- diff $TCtmp/ascii.jmb $TCdat/ascii.jmb
- [ $? -eq 0 ] || end_testcase "'diff' of ascii.jmb FAILED"
+ tst_resm TINFO "do_test1 $TC"
+ ROD cp $LTP_DATAFILES/ascii.jmb .
+ tst_resm TINFO "compare both ascii.jmbs"
+ ROD diff $LTP_DATAFILES/ascii.jmb ascii.jmb
+ tst_resm TPASS "test1 passed"
}
-#---------------------------------------------------------------------#
-# FUNCTION: do_test2
-# PURPOSE: Perform the necessary steps to complete the test.
-# INPUT: None.
-# OUTPUT: Error messages are logged if any of the tests fail.
-#---------------------------------------------------------------------#
do_test2()
{
-$trace_logic
- echo "do_test2 $TC "
- cp $TCdat/ascii.sm $TCtmp &
- wait $!
- cp $TCdat/ascii.med $TCtmp &
- wait $!
- cp $TCdat/ascii.lg $TCtmp &
- wait $!
-
- #small file
- cp $TCtmp/ascii.sm $TCtmp/ascii.smcp &
- wait $!
- diff $TCtmp/ascii.smcp $TCdat/ascii.sm
- [ $? -eq 0 ] || end_testcase "'diff' of ascii.sm FAILED"
+ tst_resm TINFO "do_test2, copy data files"
+ local files="ascii.sm ascii.med ascii.lg"
- #medium file
- cp $TCtmp/ascii.med $TCtmp/ascii.medcp &
- wait $!
- diff $TCtmp/ascii.medcp $TCdat/ascii.med
- [ $? -eq 0 ] || end_testcase "'diff' of ascii.med FAILED"
-
- #large file
- cp $TCtmp/ascii.lg $TCtmp/ascii.lgcp &
- wait $!
- diff $TCtmp/ascii.lgcp $TCdat/ascii.lg
- [ $? -eq 0 ] || end_testcase "'diff' of ascii.lg FAILED"
+ for f in $files; do
+ tst_resm TINFO "copy '$f' file"
+ ROD cp $LTP_DATAFILES/$f .
+ ROD cp $f ${f}cp
+ ROD diff $LTP_DATAFILES/$f ${f}cp
+ done
+ tst_resm TPASS "test2 passed"
}
-#---------------------------------------------------------------------#
-# FUNCTION: do_test3
-# PURPOSE: Perform the necessary steps to complete the test.
-# INPUT: None.
-# OUTPUT: Error messages are logged if any of the tests fail.
-#---------------------------------------------------------------------#
do_test3()
{
-$trace_logic
- echo "do_test3 $TC "
- chmod a-wx $TCtmp/ascii.sm &
- wait $!
- ls -l $TCtmp/ascii.sm | grep "r--"
- [ $? -eq 0 ] || end_testcase "Removal of write permissions not honored on ascii.sm"
- chmod a+w $TCtmp/ascii.sm
+ tst_resm TINFO "do_test3, test permissions"
+ ROD chmod a-wx ascii.sm
+ ROD ls -l ascii.sm | grep -q "r--"
+ ROD chmod a+w ascii.sm
+ tst_resm TPASS "test3 passed"
}
-#---------------------------------------------------------------------#
-# FUNCTION: do_cleanup
-# PURPOSE: To delete all the files created to run this test.
-# INPUT: None.
-# OUTPUT: None.
-#---------------------------------------------------------------------#
-do_cleanup()
-{
-$trace_logic
- echo "do_cleanup $TC "
- rm -f $TCtmp/*.fil*
- cd $TCbin
- umount $TCtmp
- sleep 3
- rmdir $TCtmp
- rsh -n $RHOST "/usr/sbin/exportfs -u *:$TESTDIR"
- rsh -n $RHOST "rm -rf $TESTDIR"
-}
-
-#=============================================================================
-# FUNCTION NAME: end_testcase
-#
-# FUNCTION DESCRIPTION: Clean up
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-end_testcase()
-{
-$trace_logic
- if [ "$CLEANUP" = "ON" ]; then
- do_cleanup
- fi
+LTP_DATAFILES="$LTPROOT/testcases/bin/datafiles"
- [ $# = 0 ] && { tst_resm TPASS "Test Successful"; exit 0; }
- tst_resm TFAIL "Test Failed: $@"
- exit 1
-}
+setup_testcase
-#=============================================================================
-#---------------------------------------------------------------------#
-# FUNCTION: MAIN
-# PURPOSE: To invoke the functions to perform the tasks described in
-# the prologue.
-# INPUT: None.
-# OUTPUT: A testcase run log with the results of the execution of this
-# test.
-#---------------------------------------------------------------------#
-do_setup
do_test1
do_test2
do_test3
-end_testcase
+
+tst_exit
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [LTP] [PATCH 06/10] network/nfs/nfs_stress: rename library functions names
2015-09-30 13:09 [LTP] [PATCH 01/10 resend] network/nfs01: add IPv6 test-cases Alexey Kodanev
` (3 preceding siblings ...)
2015-09-30 13:09 ` [LTP] [PATCH 05/10] network/nfs_stress/nfs02: use nfs_lib.sh Alexey Kodanev
@ 2015-09-30 13:09 ` Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 07/10] network/nfs03: move to nfs_stress directory Alexey Kodanev
` (3 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Alexey Kodanev @ 2015-09-30 13:09 UTC (permalink / raw)
To: ltp
setup_testcase -> nfs_setup
cleanup -> nfs_cleanup
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
testcases/network/nfs/nfs_stress/nfs01 | 4 ++--
testcases/network/nfs/nfs_stress/nfs02 | 4 ++--
testcases/network/nfs/nfs_stress/nfs_lib.sh | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/testcases/network/nfs/nfs_stress/nfs01 b/testcases/network/nfs/nfs_stress/nfs01
index 986855e..0f6877e 100755
--- a/testcases/network/nfs/nfs_stress/nfs01
+++ b/testcases/network/nfs/nfs_stress/nfs01
@@ -22,7 +22,7 @@
TCID="nfs01"
TST_TOTAL=1
-TST_CLEANUP="cleanup"
+TST_CLEANUP="nfs_cleanup"
. nfs_lib.sh
. test_net.sh
@@ -37,7 +37,7 @@ do_test()
tst_resm TPASS "test finished successfully"
}
-setup_testcase
+nfs_setup
do_test
tst_exit
diff --git a/testcases/network/nfs/nfs_stress/nfs02 b/testcases/network/nfs/nfs_stress/nfs02
index a600034..a73e958 100755
--- a/testcases/network/nfs/nfs_stress/nfs02
+++ b/testcases/network/nfs/nfs_stress/nfs02
@@ -22,7 +22,7 @@
TCID="nfs02"
TST_TOTAL=3
-TST_CLEANUP="cleanup"
+TST_CLEANUP="nfs_cleanup"
. nfs_lib.sh
. test_net.sh
@@ -63,7 +63,7 @@ do_test3()
LTP_DATAFILES="$LTPROOT/testcases/bin/datafiles"
-setup_testcase
+nfs_setup
do_test1
do_test2
diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
index 7867b17..193f8c8 100644
--- a/testcases/network/nfs/nfs_stress/nfs_lib.sh
+++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-setup_testcase()
+nfs_setup()
{
VERSION=${VERSION:=3}
NFILES=${NFILES:=1000}
@@ -59,7 +59,7 @@ setup_testcase()
ROD mount -t $NFS_TYPE $OPTS $REMOTE_DIR $TST_TMPDIR
}
-cleanup()
+nfs_cleanup()
{
tst_resm TINFO "Cleaning up testcase"
cd $LTPROOT
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [LTP] [PATCH 07/10] network/nfs03: move to nfs_stress directory
2015-09-30 13:09 [LTP] [PATCH 01/10 resend] network/nfs01: add IPv6 test-cases Alexey Kodanev
` (4 preceding siblings ...)
2015-09-30 13:09 ` [LTP] [PATCH 06/10] network/nfs/nfs_stress: rename library functions names Alexey Kodanev
@ 2015-09-30 13:09 ` Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 08/10] network/nfs_stress/nfs03: use nfs_lib.sh, run over IPv6 Alexey Kodanev
` (2 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Alexey Kodanev @ 2015-09-30 13:09 UTC (permalink / raw)
To: ltp
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
testcases/network/nfs/nfs03/Makefile | 31 --
testcases/network/nfs/nfs03/nfs03 | 428 -----------------------------
testcases/network/nfs/nfs_stress/Makefile | 3 +-
testcases/network/nfs/nfs_stress/nfs03 | 428 +++++++++++++++++++++++++++++
4 files changed, 430 insertions(+), 460 deletions(-)
delete mode 100644 testcases/network/nfs/nfs03/Makefile
delete mode 100755 testcases/network/nfs/nfs03/nfs03
create mode 100755 testcases/network/nfs/nfs_stress/nfs03
diff --git a/testcases/network/nfs/nfs03/Makefile b/testcases/network/nfs/nfs03/Makefile
deleted file mode 100644
index 33464f5..0000000
--- a/testcases/network/nfs/nfs03/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# network/nfs/nfs03 testcases Makefile.
-#
-# Copyright (C) 2009, Cisco Systems Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Garrett Cooper, July 2009
-#
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INSTALL_TARGETS := nfs03
-
-MAKE_TARGETS :=
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/nfs/nfs03/nfs03 b/testcases/network/nfs/nfs03/nfs03
deleted file mode 100755
index a6c53ab..0000000
--- a/testcases/network/nfs/nfs03/nfs03
+++ /dev/null
@@ -1,428 +0,0 @@
-#! /bin/sh
-#
-# Copyright (c) International Business Machines Corp., 2001
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implie; warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
-# the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-#
-#
-# FILE : nfs03
-#
-# DESCRIPTION: This script sets up the NFS directories in the remote machine
-# and runs the LTP's filesystem test: fs_inod.
-#
-# SETUP: The home directory of root on the machine exported as "RHOST"
-# MUST have a ".rhosts" file with the hostname of the machine
-# where the test is executed.
-#
-#
-# HISTORY:
-# 11/2/01 Robbie Williamson (robbiew@us.ibm.com)
-# -Created
-#
-#***********************************************************************
-
-#Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-
-$trace_logic
-
-#-----------------------------------------------------------------------
-# Initialize local variables
-#-----------------------------------------------------------------------
-TC=${TC:=nfs03}
-TCbin=${TCbin:=`pwd`}
-TCdat=${TCdat:=$TCbin}
-TCsrc=${TCsrc:=$TCbin}
-TCtmp=${TCtmp:=$TCbin/$TC$$}
-TCdump=${TCdump:=$TCbin}
-RHOST=${RHOST:=`hostname | awk {'print $1'}`}
-export TCID=$TC
-export TST_TOTAL=1
-export TST_COUNT=1
-
-PID=$$
-
-# Setting the NFS to version 3 by default
-VERSION=${VERSION:=3}
-SOCKET_TYPE=${SOCKET_TYPE:=udp}
-TESTDIR=${TESTDIR:=/tmp/$TC$PID.testdir}
-NFS_TYPE=${NFS_TYPE:=nfs}
-
-# If CLEANUP is not set; set it to "ON"
-CLEANUP=${CLEANUP:="ON"}
-
-DIR_NUM=$1
-FILE_NUM=$2
-NFSD_NUM=$3
-
-DIR_NUM=${DIR_NUM:=100}
-FILE_NUM=${FILE_NUM:= 100}
-THREAD_NUM=${THREAD_NUM:=1}
-
-#============================================================================
-# FUNCTION NAME: fs_inod
-#
-# FUNCTION DESCRIPTION: Filesystems test from LTP.
-#
-# PARAMETERS: Filesystem, number of directories, number of files,
-# and loops
-#
-# RETURNS: 0 for PASS and Error Code for FAIL.
-#============================================================================
-fs_inod()
-{
-
-#=============================================================================
-# FUNCTION NAME: err_log
-#
-# FUNCTION DESCRIPTION: Log error
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-err_log()
-{
- error "$1"
- : $(($step_errors+=1))
-}
-
-
-#=============================================================================
-# FUNCTION NAME: make_subdirs
-#
-# FUNCTION DESCRIPTION: Creates $numsubdirs subdirectories
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-make_subdirs()
-{
- i=0;
- while [ "$i" -lt "$numsubdirs" ]; do
- [ -d dir$i ] || { \
- echo "$0: mkdir dir$i"
- mkdir -p dir$i || echo "mkdir dir$i FAILED"
- }
- : $(( i += 1 ))
- done;
-}
-
-
-#=============================================================================
-# FUNCTION NAME: touch_files
-#
-# FUNCTION DESCRIPTION: Creates $numfiles in each of $numsubdirs directories
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-touch_files()
-{
- echo "$0: touch files [0-$numsubdirs]/file$numsubdirs[0-$numfiles]"
- j=0;
-
- while [ "$j" -lt "$numsubdirs" ]; do
- cd dir$j
- k=0;
-
- while [ "$k" -lt "$numfiles" ]; do
- >file$j$k || err_log ">file$j$k FAILED"
- : $(( k += 1 ))
- done
-
- : $(( j += 1 ))
- cd ..
- done
-}
-
-
-#=============================================================================
-# FUNCTION NAME: rm_files
-#
-# FUNCTION DESCRIPTION: Removes $numfiles in each $numsubdir directory
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-rm_files()
-{
- echo "$0: rm files [0-$numsubdirs]/file$numsubdirs[0-$numfiles]"
- j=0;
-
- while [ "$j" -lt "$numsubdirs" ]; do
- cd dir$j
- k=0;
-
- while [ "$k" -lt "$numfiles" ]; do
- rm -f file$j$k || err_log "rm -f file$j$k FAILED"
- : $(( k += 1 ))
- done
-
- : $(( j += 1 ))
- cd ..
- done
-}
-
-
-#=============================================================================
-# FUNCTION NAME: step1
-#
-# FUNCTION DESCRIPTION: multiple processes creating and deleting files
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-step1()
-{
- echo "=============================================="
- echo "MULTIPLE PROCESSES CREATING AND DELETING FILES"
- echo "=============================================="
-
- echo "$0: creating dir2 subdirectories"
- [ -d dir2 ] || { \
- mkdir -p dir2 || end_testcase "mkdir dir2 failed"
- }
- cd dir2 || err_log "cd dir2 FAILED"
- make_subdirs || err_log "make_subdirs on dir2 FAILED"
- cd ..
-
- echo "$0: creating dir1 subdirectories & files"
- [ -d dir1 ] || { \
- mkdir dir1 || abort "mkdir dir1 FAILED"
- }
- cd dir1 || err_log "cd dir1 FAILED"
- make_subdirs || err_log "make_subdirs on dir1 FAILED"
- touch_files
- pid1=$!
-
- i=1;
- while [ "$i" -le "$numloops" ]; do
- echo "Executing loop $i of $numloops..."
-
-# Added date stamps to track execution time and duration
-
- echo "$0: cd ../dir1 & creating files"
- cd ../dir1
- wait $pid1
- touch_files &
- pid1=$!
-
- echo "$0: cd ../dir1 & removing files"
- cd ../dir1
- wait $pid1
- rm_files &
- pid1=$!
-
- echo "$0: cd ../dir2 & creating files"
- cd ../dir2
- wait $pid2
- touch_files &
- pid2=$!
-
- echo "$0: cd ../dir2 & removing files"
- cd ../dir2
- wait $pid2
- rm_files &
- pid2=$!
-
- : $(( i += 1 ))
- done
-
- # wait for all background processes to complete execution
- wait
- return $step_errors
-}
-
-
-#=============================================================================
-# MAIN
-# See the description, purpose, and design of this test under TEST
-# in this test's prolog.
-#=============================================================================
- USAGE="Usage: ./fs_inod [volumename] [numsubdirectories] [numfiles] [numloops]"
-
- if [ $# -ne 4 ]
- then
- echo $USAGE
- exit 2
- fi
-
- testvol=$1
- numsubdirs=$2
- numfiles=$3
- numloops=$4
-
- cd $testvol || exit 2
-
- echo "FS_INODE: File system stress - inode allocation/deallocation"
- echo "Volume under test: $testvol"
- echo "Number of subdirectories: $numsubdirs"
- echo "Number of files: $numfiles"
- echo "Number of loops: $numloops"
- echo "Execution begins "
- date
-
- STEPS="1"
- for I in $STEPS
- do
- step_errors=0
- step$I
- if [ $? != 0 ]; then
- error "step$I failed - see above errors"
- fi
- done
-
-# Clean up and timestamp
- rm -rf $testvol/dir*
- echo "Execution completed"
- date
-
- return $ERRORS
-}
-
-#=============================================================================
-# FUNCTION NAME: setup_testcase
-#
-# FUNCTION DESCRIPTION: Perform the setup function for the testcase.
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-
-setup_testcase()
-{
-$trace_logic
-
-
- echo ""
- echo "Test Options:"
- echo " VERSION: $VERSION"
- echo " SOCKET_TYPE: $SOCKET_TYPE"
- echo " TESTDIR: $TESTDIR"
- echo " RHOST: $RHOST"
- echo " NFS_TYPE: $NFS_TYPE"
- echo ""
- echo "Test Parameters:"
- echo " Number of Directories: $DIR_NUM"
- echo " Number of Files per Directory: $FILE_NUM"
- echo " Number of nfsds tested: $THREAD_NUM"
- echo ""
-
- if [ "x$NFS_TYPE" != "xnfs4" ]; then
- OPTS=${OPTS:="-o vers=$VERSION,proto=$SOCKET_TYPE "}
- fi
-
- REMOTE_DIR=${RHOST}:$TESTDIR
- mkdir -p $TCtmp || end_testcase "Could not create $TCtmp"
- chmod 777 $TCtmp
-
- echo "Setting up remote machine: $RHOST"
- rsh -n $RHOST "mkdir -p $TESTDIR"
- [ $? = 0 ] || end_testcase "Could not create remote directory"
-
- if [ "x$NFS_TYPE" = "xnfs4" ]; then
- rsh -n $RHOST "mkdir -p /export$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not create /export$TESTDIR on server"
- echo "rsh -n $RHOST 'mount --bind $TESTDIR /export$TESTDIR'"
- rsh -n $RHOST "mount --bind $TESTDIR /export$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not bind $TESTDIR to /export"
- rsh -n $RHOST "/usr/sbin/exportfs -i -o no_root_squash,rw *:$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not export remote directory"
- else
- rsh -n $RHOST "/usr/sbin/exportfs -i -o no_root_squash,rw *:$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not export remote directory"
- fi
-
- echo "Mounting NFS filesystem $REMOTE_DIR on $TCtmp with options '$OPTS'"
- mount -t $NFS_TYPE $OPTS $REMOTE_DIR $TCtmp || end_testcase "Cannot mount $TCtmp"
- [ $? = 0 ] || end_testcase "Could not mount $REMOTE_DIR"
-
- echo "Setting server side nfsd count to $THREAD_NUM"
- ORIG_NFSD=`rsh -n $RHOST "ps -ef" | grep nfsd | grep -v grep | wc -l`
- rsh -n $RHOST "/usr/sbin/rpc.nfsd $THREAD_NUM"
- [ $? = 0 ] || end_testcase "Could not set the number of nfsds on $RHOST"
-
-}
-
-
-#=============================================================================
-# FUNCTION NAME: do_test
-#
-# FUNCTION DESCRIPTION: Perform the test
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-do_test()
-{
-$trace_logic
- echo "fs_inod starting on $TCtmp."
- fs_inod $TCtmp $DIR_NUM $FILE_NUM 1
- retval=$?
- echo "fs_inod on $TCtmp finished."
-
- if [ "$retval" != 0 ]; then
- end_testcase "Errors have resulted from this test: fs_inod returned $retval."
- fi
-
- cd /
-}
-
-
-#=============================================================================
-# FUNCTION NAME: end_testcase
-#
-# FUNCTION DESCRIPTION: Clean up
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-end_testcase()
-{
-$trace_logic
- if [ "$CLEANUP" = "ON" ]; then
- cd \
-
- echo "Cleaning up testcase"
- /bin/umount $TCtmp || echo "Cannot umount $TCtmp"
- sleep 2
- rmdir $TCtmp || echo "Cannot remove $TCtmp"
- rsh -n $RHOST "/usr/sbin/exportfs -u *:$TESTDIR"
- rsh -n $RHOST "rm -rf $TESTDIR"
- rsh -n $RHOST "/usr/sbin/rpc.nfsd $ORIG_NFSD"
-
- fi
-
- [ $# = 0 ] && { tst_resm TPASS "Test Successful"; exit 0; }
- tst_resm TFAIL "Test Failed: $@"
- exit 1
-}
-
-#=============================================================================
-# MAIN PROCEDURE
-#=============================================================================
-
-setup_testcase
-do_test
-end_testcase
diff --git a/testcases/network/nfs/nfs_stress/Makefile b/testcases/network/nfs/nfs_stress/Makefile
index ff61dfb..69d2c81 100644
--- a/testcases/network/nfs/nfs_stress/Makefile
+++ b/testcases/network/nfs/nfs_stress/Makefile
@@ -20,6 +20,7 @@ include $(top_srcdir)/include/mk/env_pre.mk
INSTALL_TARGETS := nfs_lib.sh \
nfs01 \
- nfs02
+ nfs02 \
+ nfs03
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/nfs/nfs_stress/nfs03 b/testcases/network/nfs/nfs_stress/nfs03
new file mode 100755
index 0000000..a6c53ab
--- /dev/null
+++ b/testcases/network/nfs/nfs_stress/nfs03
@@ -0,0 +1,428 @@
+#! /bin/sh
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implie; warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+#
+# FILE : nfs03
+#
+# DESCRIPTION: This script sets up the NFS directories in the remote machine
+# and runs the LTP's filesystem test: fs_inod.
+#
+# SETUP: The home directory of root on the machine exported as "RHOST"
+# MUST have a ".rhosts" file with the hostname of the machine
+# where the test is executed.
+#
+#
+# HISTORY:
+# 11/2/01 Robbie Williamson (robbiew@us.ibm.com)
+# -Created
+#
+#***********************************************************************
+
+#Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+
+$trace_logic
+
+#-----------------------------------------------------------------------
+# Initialize local variables
+#-----------------------------------------------------------------------
+TC=${TC:=nfs03}
+TCbin=${TCbin:=`pwd`}
+TCdat=${TCdat:=$TCbin}
+TCsrc=${TCsrc:=$TCbin}
+TCtmp=${TCtmp:=$TCbin/$TC$$}
+TCdump=${TCdump:=$TCbin}
+RHOST=${RHOST:=`hostname | awk {'print $1'}`}
+export TCID=$TC
+export TST_TOTAL=1
+export TST_COUNT=1
+
+PID=$$
+
+# Setting the NFS to version 3 by default
+VERSION=${VERSION:=3}
+SOCKET_TYPE=${SOCKET_TYPE:=udp}
+TESTDIR=${TESTDIR:=/tmp/$TC$PID.testdir}
+NFS_TYPE=${NFS_TYPE:=nfs}
+
+# If CLEANUP is not set; set it to "ON"
+CLEANUP=${CLEANUP:="ON"}
+
+DIR_NUM=$1
+FILE_NUM=$2
+NFSD_NUM=$3
+
+DIR_NUM=${DIR_NUM:=100}
+FILE_NUM=${FILE_NUM:= 100}
+THREAD_NUM=${THREAD_NUM:=1}
+
+#============================================================================
+# FUNCTION NAME: fs_inod
+#
+# FUNCTION DESCRIPTION: Filesystems test from LTP.
+#
+# PARAMETERS: Filesystem, number of directories, number of files,
+# and loops
+#
+# RETURNS: 0 for PASS and Error Code for FAIL.
+#============================================================================
+fs_inod()
+{
+
+#=============================================================================
+# FUNCTION NAME: err_log
+#
+# FUNCTION DESCRIPTION: Log error
+#
+# PARAMETERS: None.
+#
+# RETURNS: None.
+#=============================================================================
+err_log()
+{
+ error "$1"
+ : $(($step_errors+=1))
+}
+
+
+#=============================================================================
+# FUNCTION NAME: make_subdirs
+#
+# FUNCTION DESCRIPTION: Creates $numsubdirs subdirectories
+#
+# PARAMETERS: None.
+#
+# RETURNS: None.
+#=============================================================================
+make_subdirs()
+{
+ i=0;
+ while [ "$i" -lt "$numsubdirs" ]; do
+ [ -d dir$i ] || { \
+ echo "$0: mkdir dir$i"
+ mkdir -p dir$i || echo "mkdir dir$i FAILED"
+ }
+ : $(( i += 1 ))
+ done;
+}
+
+
+#=============================================================================
+# FUNCTION NAME: touch_files
+#
+# FUNCTION DESCRIPTION: Creates $numfiles in each of $numsubdirs directories
+#
+# PARAMETERS: None.
+#
+# RETURNS: None.
+#=============================================================================
+touch_files()
+{
+ echo "$0: touch files [0-$numsubdirs]/file$numsubdirs[0-$numfiles]"
+ j=0;
+
+ while [ "$j" -lt "$numsubdirs" ]; do
+ cd dir$j
+ k=0;
+
+ while [ "$k" -lt "$numfiles" ]; do
+ >file$j$k || err_log ">file$j$k FAILED"
+ : $(( k += 1 ))
+ done
+
+ : $(( j += 1 ))
+ cd ..
+ done
+}
+
+
+#=============================================================================
+# FUNCTION NAME: rm_files
+#
+# FUNCTION DESCRIPTION: Removes $numfiles in each $numsubdir directory
+#
+# PARAMETERS: None.
+#
+# RETURNS: None.
+#=============================================================================
+rm_files()
+{
+ echo "$0: rm files [0-$numsubdirs]/file$numsubdirs[0-$numfiles]"
+ j=0;
+
+ while [ "$j" -lt "$numsubdirs" ]; do
+ cd dir$j
+ k=0;
+
+ while [ "$k" -lt "$numfiles" ]; do
+ rm -f file$j$k || err_log "rm -f file$j$k FAILED"
+ : $(( k += 1 ))
+ done
+
+ : $(( j += 1 ))
+ cd ..
+ done
+}
+
+
+#=============================================================================
+# FUNCTION NAME: step1
+#
+# FUNCTION DESCRIPTION: multiple processes creating and deleting files
+#
+# PARAMETERS: None.
+#
+# RETURNS: None.
+#=============================================================================
+step1()
+{
+ echo "=============================================="
+ echo "MULTIPLE PROCESSES CREATING AND DELETING FILES"
+ echo "=============================================="
+
+ echo "$0: creating dir2 subdirectories"
+ [ -d dir2 ] || { \
+ mkdir -p dir2 || end_testcase "mkdir dir2 failed"
+ }
+ cd dir2 || err_log "cd dir2 FAILED"
+ make_subdirs || err_log "make_subdirs on dir2 FAILED"
+ cd ..
+
+ echo "$0: creating dir1 subdirectories & files"
+ [ -d dir1 ] || { \
+ mkdir dir1 || abort "mkdir dir1 FAILED"
+ }
+ cd dir1 || err_log "cd dir1 FAILED"
+ make_subdirs || err_log "make_subdirs on dir1 FAILED"
+ touch_files
+ pid1=$!
+
+ i=1;
+ while [ "$i" -le "$numloops" ]; do
+ echo "Executing loop $i of $numloops..."
+
+# Added date stamps to track execution time and duration
+
+ echo "$0: cd ../dir1 & creating files"
+ cd ../dir1
+ wait $pid1
+ touch_files &
+ pid1=$!
+
+ echo "$0: cd ../dir1 & removing files"
+ cd ../dir1
+ wait $pid1
+ rm_files &
+ pid1=$!
+
+ echo "$0: cd ../dir2 & creating files"
+ cd ../dir2
+ wait $pid2
+ touch_files &
+ pid2=$!
+
+ echo "$0: cd ../dir2 & removing files"
+ cd ../dir2
+ wait $pid2
+ rm_files &
+ pid2=$!
+
+ : $(( i += 1 ))
+ done
+
+ # wait for all background processes to complete execution
+ wait
+ return $step_errors
+}
+
+
+#=============================================================================
+# MAIN
+# See the description, purpose, and design of this test under TEST
+# in this test's prolog.
+#=============================================================================
+ USAGE="Usage: ./fs_inod [volumename] [numsubdirectories] [numfiles] [numloops]"
+
+ if [ $# -ne 4 ]
+ then
+ echo $USAGE
+ exit 2
+ fi
+
+ testvol=$1
+ numsubdirs=$2
+ numfiles=$3
+ numloops=$4
+
+ cd $testvol || exit 2
+
+ echo "FS_INODE: File system stress - inode allocation/deallocation"
+ echo "Volume under test: $testvol"
+ echo "Number of subdirectories: $numsubdirs"
+ echo "Number of files: $numfiles"
+ echo "Number of loops: $numloops"
+ echo "Execution begins "
+ date
+
+ STEPS="1"
+ for I in $STEPS
+ do
+ step_errors=0
+ step$I
+ if [ $? != 0 ]; then
+ error "step$I failed - see above errors"
+ fi
+ done
+
+# Clean up and timestamp
+ rm -rf $testvol/dir*
+ echo "Execution completed"
+ date
+
+ return $ERRORS
+}
+
+#=============================================================================
+# FUNCTION NAME: setup_testcase
+#
+# FUNCTION DESCRIPTION: Perform the setup function for the testcase.
+#
+# PARAMETERS: None.
+#
+# RETURNS: None.
+#=============================================================================
+
+setup_testcase()
+{
+$trace_logic
+
+
+ echo ""
+ echo "Test Options:"
+ echo " VERSION: $VERSION"
+ echo " SOCKET_TYPE: $SOCKET_TYPE"
+ echo " TESTDIR: $TESTDIR"
+ echo " RHOST: $RHOST"
+ echo " NFS_TYPE: $NFS_TYPE"
+ echo ""
+ echo "Test Parameters:"
+ echo " Number of Directories: $DIR_NUM"
+ echo " Number of Files per Directory: $FILE_NUM"
+ echo " Number of nfsds tested: $THREAD_NUM"
+ echo ""
+
+ if [ "x$NFS_TYPE" != "xnfs4" ]; then
+ OPTS=${OPTS:="-o vers=$VERSION,proto=$SOCKET_TYPE "}
+ fi
+
+ REMOTE_DIR=${RHOST}:$TESTDIR
+ mkdir -p $TCtmp || end_testcase "Could not create $TCtmp"
+ chmod 777 $TCtmp
+
+ echo "Setting up remote machine: $RHOST"
+ rsh -n $RHOST "mkdir -p $TESTDIR"
+ [ $? = 0 ] || end_testcase "Could not create remote directory"
+
+ if [ "x$NFS_TYPE" = "xnfs4" ]; then
+ rsh -n $RHOST "mkdir -p /export$TESTDIR"
+ [ $? = 0 ] || end_testcase "Could not create /export$TESTDIR on server"
+ echo "rsh -n $RHOST 'mount --bind $TESTDIR /export$TESTDIR'"
+ rsh -n $RHOST "mount --bind $TESTDIR /export$TESTDIR"
+ [ $? = 0 ] || end_testcase "Could not bind $TESTDIR to /export"
+ rsh -n $RHOST "/usr/sbin/exportfs -i -o no_root_squash,rw *:$TESTDIR"
+ [ $? = 0 ] || end_testcase "Could not export remote directory"
+ else
+ rsh -n $RHOST "/usr/sbin/exportfs -i -o no_root_squash,rw *:$TESTDIR"
+ [ $? = 0 ] || end_testcase "Could not export remote directory"
+ fi
+
+ echo "Mounting NFS filesystem $REMOTE_DIR on $TCtmp with options '$OPTS'"
+ mount -t $NFS_TYPE $OPTS $REMOTE_DIR $TCtmp || end_testcase "Cannot mount $TCtmp"
+ [ $? = 0 ] || end_testcase "Could not mount $REMOTE_DIR"
+
+ echo "Setting server side nfsd count to $THREAD_NUM"
+ ORIG_NFSD=`rsh -n $RHOST "ps -ef" | grep nfsd | grep -v grep | wc -l`
+ rsh -n $RHOST "/usr/sbin/rpc.nfsd $THREAD_NUM"
+ [ $? = 0 ] || end_testcase "Could not set the number of nfsds on $RHOST"
+
+}
+
+
+#=============================================================================
+# FUNCTION NAME: do_test
+#
+# FUNCTION DESCRIPTION: Perform the test
+#
+# PARAMETERS: None.
+#
+# RETURNS: None.
+#=============================================================================
+do_test()
+{
+$trace_logic
+ echo "fs_inod starting on $TCtmp."
+ fs_inod $TCtmp $DIR_NUM $FILE_NUM 1
+ retval=$?
+ echo "fs_inod on $TCtmp finished."
+
+ if [ "$retval" != 0 ]; then
+ end_testcase "Errors have resulted from this test: fs_inod returned $retval."
+ fi
+
+ cd /
+}
+
+
+#=============================================================================
+# FUNCTION NAME: end_testcase
+#
+# FUNCTION DESCRIPTION: Clean up
+#
+# PARAMETERS: None.
+#
+# RETURNS: None.
+#=============================================================================
+end_testcase()
+{
+$trace_logic
+ if [ "$CLEANUP" = "ON" ]; then
+ cd \
+
+ echo "Cleaning up testcase"
+ /bin/umount $TCtmp || echo "Cannot umount $TCtmp"
+ sleep 2
+ rmdir $TCtmp || echo "Cannot remove $TCtmp"
+ rsh -n $RHOST "/usr/sbin/exportfs -u *:$TESTDIR"
+ rsh -n $RHOST "rm -rf $TESTDIR"
+ rsh -n $RHOST "/usr/sbin/rpc.nfsd $ORIG_NFSD"
+
+ fi
+
+ [ $# = 0 ] && { tst_resm TPASS "Test Successful"; exit 0; }
+ tst_resm TFAIL "Test Failed: $@"
+ exit 1
+}
+
+#=============================================================================
+# MAIN PROCEDURE
+#=============================================================================
+
+setup_testcase
+do_test
+end_testcase
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [LTP] [PATCH 08/10] network/nfs_stress/nfs03: use nfs_lib.sh, run over IPv6
2015-09-30 13:09 [LTP] [PATCH 01/10 resend] network/nfs01: add IPv6 test-cases Alexey Kodanev
` (5 preceding siblings ...)
2015-09-30 13:09 ` [LTP] [PATCH 07/10] network/nfs03: move to nfs_stress directory Alexey Kodanev
@ 2015-09-30 13:09 ` Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 09/10] network/nfs04: move to nfs_stress directory Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 10/10] network/nfs04: cleanup and use nfs_lib.sh Alexey Kodanev
8 siblings, 0 replies; 13+ messages in thread
From: Alexey Kodanev @ 2015-09-30 13:09 UTC (permalink / raw)
To: ltp
Also, remove setting LTPROOT directory in stress.part1 runtest file
for nfs02 and nfs03.
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
runtest/nfs | 6 +-
runtest/stress.part1 | 18 +-
testcases/network/nfs/nfs_stress/nfs03 | 479 ++++++--------------------------
3 files changed, 100 insertions(+), 403 deletions(-)
diff --git a/runtest/nfs b/runtest/nfs
index ad0e25f..3ab2eb8 100644
--- a/runtest/nfs
+++ b/runtest/nfs
@@ -12,7 +12,11 @@ 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
-nfs03 export VERSION SOCKET_TYPE; TCbin=$LTPROOT/testcases/bin nfs03
+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
+
nfs04 export VERSION SOCKET_TYPE; TCbin=$LTPROOT/testcases/bin nfs04
nfslock01 export VERSION; TCbin=$LTPROOT/testcases/bin nfslock01
diff --git a/runtest/stress.part1 b/runtest/stress.part1
index 9ad21d9..af5f69d 100644
--- a/runtest/stress.part1
+++ b/runtest/stress.part1
@@ -181,15 +181,15 @@ nfs01 export VERSION=2 SOCKET_TYPE=tcp; nfs01
nfs01 export VERSION=3 SOCKET_TYPE=udp; nfs01
nfs01 export VERSION=3 SOCKET_TYPE=tcp; nfs01
-nfs02 export VERSION=2 SOCKET_TYPE=udp; export TCbin=$LTPROOT/testcases/bin; nfs02
-nfs02 export VERSION=2 SOCKET_TYPE=tcp; export TCbin=$LTPROOT/testcases/bin; nfs02
-nfs02 export VERSION=3 SOCKET_TYPE=udp; export TCbin=$LTPROOT/testcases/bin; nfs02
-nfs02 export VERSION=3 SOCKET_TYPE=tcp; export TCbin=$LTPROOT/testcases/bin; nfs02
-
-nfs03 export VERSION=2 SOCKET_TYPE=udp; export TCbin=$LTPROOT/testcases/bin; nfs03
-nfs03 export VERSION=2 SOCKET_TYPE=tcp; export TCbin=$LTPROOT/testcases/bin; nfs03
-nfs03 export VERSION=3 SOCKET_TYPE=udp; export TCbin=$LTPROOT/testcases/bin; nfs03
-nfs03 export VERSION=3 SOCKET_TYPE=tcp; export TCbin=$LTPROOT/testcases/bin; nfs03
+nfs02 export VERSION=2 SOCKET_TYPE=udp; nfs02
+nfs02 export VERSION=2 SOCKET_TYPE=tcp; nfs02
+nfs02 export VERSION=3 SOCKET_TYPE=udp; nfs02
+nfs02 export VERSION=3 SOCKET_TYPE=tcp; nfs02
+
+nfs03 export VERSION=2 SOCKET_TYPE=udp; nfs03
+nfs03 export VERSION=2 SOCKET_TYPE=tcp; nfs03
+nfs03 export VERSION=3 SOCKET_TYPE=udp; nfs03
+nfs03 export VERSION=3 SOCKET_TYPE=tcp; nfs03
nfs04 export VERSION=2 SOCKET_TYPE=udp; export TCbin=$LTPROOT/testcases/bin; nfs04
nfs03 export VERSION=2 SOCKET_TYPE=tcp; export TCbin=$LTPROOT/testcases/bin; nfs04
diff --git a/testcases/network/nfs/nfs_stress/nfs03 b/testcases/network/nfs/nfs_stress/nfs03
index a6c53ab..952162d 100755
--- a/testcases/network/nfs/nfs_stress/nfs03
+++ b/testcases/network/nfs/nfs_stress/nfs03
@@ -1,428 +1,121 @@
#! /bin/sh
+# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines Corp., 2001
#
-# Copyright (c) International Business Machines Corp., 2001
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implie; warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
-# the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-#
-#
-# FILE : nfs03
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# DESCRIPTION: This script sets up the NFS directories in the remote machine
-# and runs the LTP's filesystem test: fs_inod.
-#
-# SETUP: The home directory of root on the machine exported as "RHOST"
-# MUST have a ".rhosts" file with the hostname of the machine
-# where the test is executed.
-#
+# and runs the LTP's filesystem test: fs_inod.
#
-# HISTORY:
-# 11/2/01 Robbie Williamson (robbiew@us.ibm.com)
-# -Created
-#
-#***********************************************************************
-
-#Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-
-$trace_logic
-
-#-----------------------------------------------------------------------
-# Initialize local variables
-#-----------------------------------------------------------------------
-TC=${TC:=nfs03}
-TCbin=${TCbin:=`pwd`}
-TCdat=${TCdat:=$TCbin}
-TCsrc=${TCsrc:=$TCbin}
-TCtmp=${TCtmp:=$TCbin/$TC$$}
-TCdump=${TCdump:=$TCbin}
-RHOST=${RHOST:=`hostname | awk {'print $1'}`}
-export TCID=$TC
-export TST_TOTAL=1
-export TST_COUNT=1
-
-PID=$$
-
-# Setting the NFS to version 3 by default
-VERSION=${VERSION:=3}
-SOCKET_TYPE=${SOCKET_TYPE:=udp}
-TESTDIR=${TESTDIR:=/tmp/$TC$PID.testdir}
-NFS_TYPE=${NFS_TYPE:=nfs}
+# Created by: Robbie Williamson (robbiew@us.ibm.com)
-# If CLEANUP is not set; set it to "ON"
-CLEANUP=${CLEANUP:="ON"}
+TCID="nfs03"
+TST_TOTAL=1
+TST_CLEANUP="nfs03_cleanup"
-DIR_NUM=$1
-FILE_NUM=$2
-NFSD_NUM=$3
-
-DIR_NUM=${DIR_NUM:=100}
-FILE_NUM=${FILE_NUM:= 100}
-THREAD_NUM=${THREAD_NUM:=1}
-
-#============================================================================
-# FUNCTION NAME: fs_inod
-#
-# FUNCTION DESCRIPTION: Filesystems test from LTP.
-#
-# PARAMETERS: Filesystem, number of directories, number of files,
-# and loops
-#
-# RETURNS: 0 for PASS and Error Code for FAIL.
-#============================================================================
-fs_inod()
-{
-
-#=============================================================================
-# FUNCTION NAME: err_log
-#
-# FUNCTION DESCRIPTION: Log error
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-err_log()
-{
- error "$1"
- : $(($step_errors+=1))
-}
+. nfs_lib.sh
+. test_net.sh
+DIR_NUM=${DIR_NUM:-"100"}
+FILE_NUM=${FILE_NUM:-"100"}
+THREAD_NUM=${THREAD_NUM:-"1"}
+ORIG_NFSD=
-#=============================================================================
-# FUNCTION NAME: make_subdirs
-#
-# FUNCTION DESCRIPTION: Creates $numsubdirs subdirectories
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
make_subdirs()
{
- i=0;
- while [ "$i" -lt "$numsubdirs" ]; do
- [ -d dir$i ] || { \
- echo "$0: mkdir dir$i"
- mkdir -p dir$i || echo "mkdir dir$i FAILED"
- }
- : $(( i += 1 ))
- done;
+ tst_resm TINFO "make '$DIR_NUM' directories"
+ for i in $(seq 0 $DIR_NUM); do
+ ROD mkdir -p dir$i
+ done
}
-
-#=============================================================================
-# FUNCTION NAME: touch_files
-#
-# FUNCTION DESCRIPTION: Creates $numfiles in each of $numsubdirs directories
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
touch_files()
{
- echo "$0: touch files [0-$numsubdirs]/file$numsubdirs[0-$numfiles]"
- j=0;
-
- while [ "$j" -lt "$numsubdirs" ]; do
- cd dir$j
- k=0;
-
- while [ "$k" -lt "$numfiles" ]; do
- >file$j$k || err_log ">file$j$k FAILED"
- : $(( k += 1 ))
- done
-
- : $(( j += 1 ))
- cd ..
- done
+ tst_resm TINFO "create files [0 - $DIR_NUM]/file$DIR_NUM[0 - $FILE_NUM]"
+ for j in $(seq 0 $DIR_NUM); do
+ cd dir$j
+ for k in $(seq 0 $FILE_NUM); do
+ ROD >file$j$k
+ done
+ cd ..
+ done
}
-
-#=============================================================================
-# FUNCTION NAME: rm_files
-#
-# FUNCTION DESCRIPTION: Removes $numfiles in each $numsubdir directory
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
rm_files()
{
- echo "$0: rm files [0-$numsubdirs]/file$numsubdirs[0-$numfiles]"
- j=0;
-
- while [ "$j" -lt "$numsubdirs" ]; do
- cd dir$j
- k=0;
-
- while [ "$k" -lt "$numfiles" ]; do
- rm -f file$j$k || err_log "rm -f file$j$k FAILED"
- : $(( k += 1 ))
- done
-
- : $(( j += 1 ))
- cd ..
- done
-}
-
-
-#=============================================================================
-# FUNCTION NAME: step1
-#
-# FUNCTION DESCRIPTION: multiple processes creating and deleting files
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-step1()
-{
- echo "=============================================="
- echo "MULTIPLE PROCESSES CREATING AND DELETING FILES"
- echo "=============================================="
-
- echo "$0: creating dir2 subdirectories"
- [ -d dir2 ] || { \
- mkdir -p dir2 || end_testcase "mkdir dir2 failed"
- }
- cd dir2 || err_log "cd dir2 FAILED"
- make_subdirs || err_log "make_subdirs on dir2 FAILED"
- cd ..
-
- echo "$0: creating dir1 subdirectories & files"
- [ -d dir1 ] || { \
- mkdir dir1 || abort "mkdir dir1 FAILED"
- }
- cd dir1 || err_log "cd dir1 FAILED"
- make_subdirs || err_log "make_subdirs on dir1 FAILED"
- touch_files
- pid1=$!
-
- i=1;
- while [ "$i" -le "$numloops" ]; do
- echo "Executing loop $i of $numloops..."
-
-# Added date stamps to track execution time and duration
-
- echo "$0: cd ../dir1 & creating files"
- cd ../dir1
- wait $pid1
- touch_files &
- pid1=$!
-
- echo "$0: cd ../dir1 & removing files"
- cd ../dir1
- wait $pid1
- rm_files &
- pid1=$!
-
- echo "$0: cd ../dir2 & creating files"
- cd ../dir2
- wait $pid2
- touch_files &
- pid2=$!
-
- echo "$0: cd ../dir2 & removing files"
- cd ../dir2
- wait $pid2
- rm_files &
- pid2=$!
-
- : $(( i += 1 ))
- done
-
- # wait for all background processes to complete execution
- wait
- return $step_errors
-}
-
-
-#=============================================================================
-# MAIN
-# See the description, purpose, and design of this test under TEST
-# in this test's prolog.
-#=============================================================================
- USAGE="Usage: ./fs_inod [volumename] [numsubdirectories] [numfiles] [numloops]"
-
- if [ $# -ne 4 ]
- then
- echo $USAGE
- exit 2
- fi
-
- testvol=$1
- numsubdirs=$2
- numfiles=$3
- numloops=$4
-
- cd $testvol || exit 2
-
- echo "FS_INODE: File system stress - inode allocation/deallocation"
- echo "Volume under test: $testvol"
- echo "Number of subdirectories: $numsubdirs"
- echo "Number of files: $numfiles"
- echo "Number of loops: $numloops"
- echo "Execution begins "
- date
-
- STEPS="1"
- for I in $STEPS
- do
- step_errors=0
- step$I
- if [ $? != 0 ]; then
- error "step$I failed - see above errors"
- fi
- done
-
-# Clean up and timestamp
- rm -rf $testvol/dir*
- echo "Execution completed"
- date
-
- return $ERRORS
+ tst_resm TINFO "rm files [0 - $DIR_NUM]/file$DIR_NUM[0 - $FILE_NUM]"
+ for j in $(seq 0 $DIR_NUM); do
+ cd dir$j
+ for k in $(seq 0 $FILE_NUM); do
+ ROD rm -f file$j$k
+ done
+ cd ..
+ done
}
-#=============================================================================
-# FUNCTION NAME: setup_testcase
-#
-# FUNCTION DESCRIPTION: Perform the setup function for the testcase.
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-
-setup_testcase()
+do_test()
{
-$trace_logic
-
-
- echo ""
- echo "Test Options:"
- echo " VERSION: $VERSION"
- echo " SOCKET_TYPE: $SOCKET_TYPE"
- echo " TESTDIR: $TESTDIR"
- echo " RHOST: $RHOST"
- echo " NFS_TYPE: $NFS_TYPE"
- echo ""
- echo "Test Parameters:"
- echo " Number of Directories: $DIR_NUM"
- echo " Number of Files per Directory: $FILE_NUM"
- echo " Number of nfsds tested: $THREAD_NUM"
- echo ""
-
- if [ "x$NFS_TYPE" != "xnfs4" ]; then
- OPTS=${OPTS:="-o vers=$VERSION,proto=$SOCKET_TYPE "}
- fi
-
- REMOTE_DIR=${RHOST}:$TESTDIR
- mkdir -p $TCtmp || end_testcase "Could not create $TCtmp"
- chmod 777 $TCtmp
-
- echo "Setting up remote machine: $RHOST"
- rsh -n $RHOST "mkdir -p $TESTDIR"
- [ $? = 0 ] || end_testcase "Could not create remote directory"
-
- if [ "x$NFS_TYPE" = "xnfs4" ]; then
- rsh -n $RHOST "mkdir -p /export$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not create /export$TESTDIR on server"
- echo "rsh -n $RHOST 'mount --bind $TESTDIR /export$TESTDIR'"
- rsh -n $RHOST "mount --bind $TESTDIR /export$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not bind $TESTDIR to /export"
- rsh -n $RHOST "/usr/sbin/exportfs -i -o no_root_squash,rw *:$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not export remote directory"
- else
- rsh -n $RHOST "/usr/sbin/exportfs -i -o no_root_squash,rw *:$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not export remote directory"
- fi
-
- echo "Mounting NFS filesystem $REMOTE_DIR on $TCtmp with options '$OPTS'"
- mount -t $NFS_TYPE $OPTS $REMOTE_DIR $TCtmp || end_testcase "Cannot mount $TCtmp"
- [ $? = 0 ] || end_testcase "Could not mount $REMOTE_DIR"
-
- echo "Setting server side nfsd count to $THREAD_NUM"
- ORIG_NFSD=`rsh -n $RHOST "ps -ef" | grep nfsd | grep -v grep | wc -l`
- rsh -n $RHOST "/usr/sbin/rpc.nfsd $THREAD_NUM"
- [ $? = 0 ] || end_testcase "Could not set the number of nfsds on $RHOST"
-
+ tst_resm TINFO "Multiple processes creating and deleting files"
+
+ tst_resm TINFO "creating dir1 subdirectories & files"
+ ROD mkdir -p dir1
+ ROD cd dir1
+ make_subdirs
+ touch_files &
+ pid1=$!
+ cd ..
+
+ tst_resm TINFO "creating dir2 subdirectories & files"
+ ROD mkdir -p dir2
+ ROD cd dir2
+ make_subdirs
+ touch_files &
+ pid2=$!
+
+ tst_resm TINFO "cd dir1 & removing files"
+ ROD cd ../dir1
+ wait $pid1
+ rm_files &
+
+ tst_resm TINFO "cd dir2 & removing files"
+ ROD cd ../dir2
+ wait $pid2
+ rm_files &
+
+ # wait for all background processes to complete execution
+ wait
+
+ tst_resm TPASS "test done"
}
-
-#=============================================================================
-# FUNCTION NAME: do_test
-#
-# FUNCTION DESCRIPTION: Perform the test
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-do_test()
+nfs03_setup()
{
-$trace_logic
- echo "fs_inod starting on $TCtmp."
- fs_inod $TCtmp $DIR_NUM $FILE_NUM 1
- retval=$?
- echo "fs_inod on $TCtmp finished."
+ nfs_setup
- if [ "$retval" != 0 ]; then
- end_testcase "Errors have resulted from this test: fs_inod returned $retval."
- fi
-
- cd /
+ tst_resm TINFO "Setting server side nfsd count to $THREAD_NUM"
+ ORIG_NFSD=$(tst_rhost_run -s -c 'ps -ef | grep nfsd | grep -v grep | wc -l')
+ tst_rhost_run -s -c "rpc.nfsd $THREAD_NUM"
}
-
-#=============================================================================
-# FUNCTION NAME: end_testcase
-#
-# FUNCTION DESCRIPTION: Clean up
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-end_testcase()
+nfs03_cleanup()
{
-$trace_logic
- if [ "$CLEANUP" = "ON" ]; then
- cd \
-
- echo "Cleaning up testcase"
- /bin/umount $TCtmp || echo "Cannot umount $TCtmp"
- sleep 2
- rmdir $TCtmp || echo "Cannot remove $TCtmp"
- rsh -n $RHOST "/usr/sbin/exportfs -u *:$TESTDIR"
- rsh -n $RHOST "rm -rf $TESTDIR"
- rsh -n $RHOST "/usr/sbin/rpc.nfsd $ORIG_NFSD"
-
- fi
-
- [ $# = 0 ] && { tst_resm TPASS "Test Successful"; exit 0; }
- tst_resm TFAIL "Test Failed: $@"
- exit 1
+ tst_rhost_run -c "rpc.nfsd $ORIG_NFSD"
+ nfs_cleanup
}
-#=============================================================================
-# MAIN PROCEDURE
-#=============================================================================
+nfs03_setup
-setup_testcase
do_test
-end_testcase
+
+tst_exit
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [LTP] [PATCH 09/10] network/nfs04: move to nfs_stress directory
2015-09-30 13:09 [LTP] [PATCH 01/10 resend] network/nfs01: add IPv6 test-cases Alexey Kodanev
` (6 preceding siblings ...)
2015-09-30 13:09 ` [LTP] [PATCH 08/10] network/nfs_stress/nfs03: use nfs_lib.sh, run over IPv6 Alexey Kodanev
@ 2015-09-30 13:09 ` Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 10/10] network/nfs04: cleanup and use nfs_lib.sh Alexey Kodanev
8 siblings, 0 replies; 13+ messages in thread
From: Alexey Kodanev @ 2015-09-30 13:09 UTC (permalink / raw)
To: ltp
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
testcases/network/.gitignore | 2 +-
testcases/network/nfs/nfs04/Makefile | 31 ---
testcases/network/nfs/nfs04/nfs04 | 197 --------------------
testcases/network/nfs/nfs04/nfs04_create_file.c | 74 --------
testcases/network/nfs/nfs_stress/Makefile | 5 +-
testcases/network/nfs/nfs_stress/nfs04 | 197 ++++++++++++++++++++
.../network/nfs/nfs_stress/nfs04_create_file.c | 74 ++++++++
7 files changed, 276 insertions(+), 304 deletions(-)
delete mode 100644 testcases/network/nfs/nfs04/Makefile
delete mode 100755 testcases/network/nfs/nfs04/nfs04
delete mode 100644 testcases/network/nfs/nfs04/nfs04_create_file.c
create mode 100755 testcases/network/nfs/nfs_stress/nfs04
create mode 100644 testcases/network/nfs/nfs_stress/nfs04_create_file.c
diff --git a/testcases/network/.gitignore b/testcases/network/.gitignore
index eae306a..7fd6c16 100644
--- a/testcases/network/.gitignore
+++ b/testcases/network/.gitignore
@@ -18,7 +18,7 @@
/multicast/mc_opts/mc_verify_opts
/multicast/mc_opts/mc_verify_opts_error
/nfs/nfs_stress/open_files
-/nfs/nfs04/nfs04_create_file
+/nfs/nfs_stress/nfs04_create_file
/nfs/nfs_fsstress/fsstress
/nfs/nfslock01/nfs_flock
/nfs/nfslock01/nfs_flock_dgen
diff --git a/testcases/network/nfs/nfs04/Makefile b/testcases/network/nfs/nfs04/Makefile
deleted file mode 100644
index 9676a57..0000000
--- a/testcases/network/nfs/nfs04/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# network/nfs/nfs04 testcases Makefile.
-#
-# Copyright (C) 2009, Cisco Systems Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Garrett Cooper, July 2009
-#
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-
-INSTALL_TARGETS := nfs04
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/nfs/nfs04/nfs04 b/testcases/network/nfs/nfs04/nfs04
deleted file mode 100755
index 7518d5b..0000000
--- a/testcases/network/nfs/nfs04/nfs04
+++ /dev/null
@@ -1,197 +0,0 @@
-#! /bin/sh
-#
-# Copyright (c) International Business Machines Corp., 2003
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implie; warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
-# the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-#
-#
-# FILE : nfs04.sh
-#
-# PURPOSE: Creates a text file of specified size locally and copies
-# the file to an NFS mountpoint. The two files are compared
-# and checked for differences. If the files differ, then
-# the test fails. By default, this test creates a 10Mb file
-# and runs for one loop.
-#
-#
-# SETUP: The home directory of root on the machine exported as "RHOST"
-# MUST have a ".rhosts" file with the hostname of the machine
-# where the test is executed.
-#
-#
-# HISTORY:
-# 10/17/03 Robbie Williamson (robbiew@us.ibm.com)
-# -Written
-#
-#***********************************************************************
-
-#Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-
-$trace_logic
-
-#-----------------------------------------------------------------------
-# Initialize local variables
-#-----------------------------------------------------------------------
-TC=${TC:=nfs04}
-TCbin=${TCbin:=`pwd`}
-TCtmp=${TCtmp:=/tmp/$TC$$}
-export TCID=$TC
-export TST_TOTAL=1
-
-# If CLEANUP is not set; set it to "ON"
-CLEANUP=${CLEANUP:="ON"}
-
-#=============================================================================
-# FUNCTION NAME: setup_testcase
-#
-# FUNCTION DESCRIPTION: Perform the setup function for the testcase.
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-
-setup_testcase()
-{
-$trace_logic
-
- PID=$$
-
- VERSION=${VERSION:=3}
- RHOST=${RHOST:=`hostname`}
- FILESIZE=${FILESIZE:=10}
- SOCKET_TYPE=${SOCKET_TYPE:=udp}
- TESTDIR=${TESTDIR:=/tmp/$TC$PID.testdir}
- NFS_TYPE=${NFS_TYPE:=nfs}
- LOOPS=${LOOPS:=1}
- export TST_COUNT=$LOOPS
-
- echo ""
- echo "Test Options:"
- echo " VERSION: $VERSION"
- echo " RHOST: $RHOST"
- echo " FILESIZE: $FILESIZE"
- echo " SOCKET_TYPE: $SOCKET_TYPE"
- echo " TESTDIR: $TESTDIR"
- echo " NFS_TYPE: $NFS_TYPE"
- echo " LOOPS: $LOOPS"
-
- if [ "x$NFS_TYPE" != "xnfs4" ]; then
- OPTS=${OPTS:="-o proto=$SOCKET_TYPE,vers=$VERSION "}
- fi
-
- REMOTE_DIR=${RHOST}:$TESTDIR
- LUSER=${LUSER:=root}
- mkdir -p $TCtmp || end_testcase "Could not create $TCtmp"
- chmod 777 $TCtmp
-
- tst_resm TINFO "Setting up remote machine: $RHOST"
- rsh -n $RHOST "mkdir -p $TESTDIR"
- [ $? = 0 ] || end_testcase "Could not create remote directory"
- rsh -n $RHOST "touch $TESTDIR/testfile"
- [ $? = 0 ] || end_testcase "Could not create testfile in remote directory"
-
- if [ "x$NFS_TYPE" = "xnfs4" ]; then
- rsh -n $RHOST "mkdir -p /export$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not create /export$TESTDIR on server"
- rsh -n $RHOST "mount --bind $TESTDIR /export$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not bind $TESTDIR to /export"
- rsh -n $RHOST "/usr/sbin/exportfs -o no_root_squash,rw,nohide,insecure,no_subtree_check *:$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not export remote directory"
- else
- rsh -n $RHOST "/usr/sbin/exportfs -i -o no_root_squash,rw *:$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not export remote directory"
- fi
-
- tst_resm TINFO "Mounting NFS filesystem"
- mount -t $NFS_TYPE $OPTS $REMOTE_DIR $TCtmp || end_testcase "Cannot mount $TCtmp"
- [ $? = 0 ] || end_testcase "Could not mount $REMOTE_DIR"
-}
-
-
-#=============================================================================
-# FUNCTION NAME: do_test
-#
-# FUNCTION DESCRIPTION: Perform the test
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-do_test()
-{
-$trace_logic
- loopcount=0
- nfs04_create_file $FILESIZE /tmp/nfs04$PID.testfile >/dev/null
- if [ $? != 0 ]; then
- end_testcase "Could not create testfile"
- fi
- tst_resm TINFO "Test Started"
- while [ $loopcount -lt $LOOPS ]
- do
- cp /tmp/nfs04$PID.testfile $TCtmp/nfs04$PID.testfile$loopcount
- cmp /tmp/nfs04$PID.testfile $TCtmp/nfs04$PID.testfile$loopcount
- retval=$?
- if [ "$retval" != 0 ]; then
- end_testcase "Error in loop $loopcount: First cmp FAILED"
- fi
- cp $TCtmp/nfs04$PID.testfile$loopcount /tmp/nfs04$PID.testfile_compare
- cmp /tmp/nfs04$PID.testfile /tmp/nfs04$PID.testfile_compare
- retval=$?
- if [ "$retval" != 0 ]; then
- end_testcase "Error in loop $loopcount: Second cmp FAILED"
- fi
- rm -f /tmp/nfs04$PID.testfile_compare
- loopcount=$(( $loopcount + 1 ))
- tst_resm TINFO "Completed Loop $loopcount"
- done
-}
-
-
-#=============================================================================
-# FUNCTION NAME: end_testcase
-#
-# FUNCTION DESCRIPTION: Clean up
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-end_testcase()
-{
-$trace_logic
- if [ "$CLEANUP" = "ON" ]; then
- sleep 2
- umount $TCtmp || tst_resm TBROK "Cannot umount $TCtmp"
- rm -rf $TCtmp || tst_resm TBROK "Cannot remove $TCtmp"
- rsh -n $RHOST "/usr/sbin/exportfs -u *:$TESTDIR"
- rsh -n $RHOST "rm -rf $TESTDIR"
- rm -f /tmp/nfs04$PID.testfile*
- fi
-
- [ $# = 0 ] && { tst_resm TPASS "Test Successful"; exit 0; }
- tst_resm TFAIL "Test Failed: $@"
- exit 1
-}
-
-#=============================================================================
-# MAIN PROCEDURE
-#=============================================================================
-
-setup_testcase
-do_test
-end_testcase
diff --git a/testcases/network/nfs/nfs04/nfs04_create_file.c b/testcases/network/nfs/nfs04/nfs04_create_file.c
deleted file mode 100644
index 653c500..0000000
--- a/testcases/network/nfs/nfs04/nfs04_create_file.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- *
- * Copyright (c) International Business Machines Corp., 2003
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
- * the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * FILE : create_file.c
- * PURPOSE : Creates a text file of specified size.
- * HISTORY :
- * 10/17/2003 Robbie Williamson
- * -Written
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-
-/* set write buffer size to whatever floats your boat. I usually use 1M */
-#define BSIZE 1048576L
-
-int main(int argc, char *argv[])
-{
- off_t i;
- long bufnum;
- char buf[BSIZE];
- off_t fd;
-
- if (argc != 3 || atoi(argv[1]) < 1) {
- printf
- ("usage:\n\tcreate_file <# of %ld buffers to write> <name of file to create>\n\t ex. # create_file 10 /tmp/testfile\n",
- BSIZE);
- exit(3);
- }
- bufnum = strtol(argv[1], NULL, 0);
- printf("Started building a %lu megabyte file\n", bufnum);
- buf[0] = 'A';
- for (i = 1; i < BSIZE; i++)
- buf[i] = buf[i - 1] + 1;
- buf[BSIZE - 1] = 'Z';
-
- if ((fd = creat(argv[2], 0755)) == -1)
- perror("lftest: ");
-
- for (i = 0; i < bufnum; i++) {
- if (write(fd, buf, BSIZE) == -1)
- return -1;
- else {
- printf(".");
- fflush(stdout);
- }
- fsync(fd);
- }
- close(fd);
- printf("\nFinished building a %lu megabyte file\n", bufnum);
- return (0);
-}
diff --git a/testcases/network/nfs/nfs_stress/Makefile b/testcases/network/nfs/nfs_stress/Makefile
index 69d2c81..2b5242c 100644
--- a/testcases/network/nfs/nfs_stress/Makefile
+++ b/testcases/network/nfs/nfs_stress/Makefile
@@ -18,9 +18,12 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/env_pre.mk
+nfs04_create_file: CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+
INSTALL_TARGETS := nfs_lib.sh \
nfs01 \
nfs02 \
- nfs03
+ nfs03 \
+ nfs04
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/nfs/nfs_stress/nfs04 b/testcases/network/nfs/nfs_stress/nfs04
new file mode 100755
index 0000000..7518d5b
--- /dev/null
+++ b/testcases/network/nfs/nfs_stress/nfs04
@@ -0,0 +1,197 @@
+#! /bin/sh
+#
+# Copyright (c) International Business Machines Corp., 2003
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implie; warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+#
+# FILE : nfs04.sh
+#
+# PURPOSE: Creates a text file of specified size locally and copies
+# the file to an NFS mountpoint. The two files are compared
+# and checked for differences. If the files differ, then
+# the test fails. By default, this test creates a 10Mb file
+# and runs for one loop.
+#
+#
+# SETUP: The home directory of root on the machine exported as "RHOST"
+# MUST have a ".rhosts" file with the hostname of the machine
+# where the test is executed.
+#
+#
+# HISTORY:
+# 10/17/03 Robbie Williamson (robbiew@us.ibm.com)
+# -Written
+#
+#***********************************************************************
+
+#Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+
+$trace_logic
+
+#-----------------------------------------------------------------------
+# Initialize local variables
+#-----------------------------------------------------------------------
+TC=${TC:=nfs04}
+TCbin=${TCbin:=`pwd`}
+TCtmp=${TCtmp:=/tmp/$TC$$}
+export TCID=$TC
+export TST_TOTAL=1
+
+# If CLEANUP is not set; set it to "ON"
+CLEANUP=${CLEANUP:="ON"}
+
+#=============================================================================
+# FUNCTION NAME: setup_testcase
+#
+# FUNCTION DESCRIPTION: Perform the setup function for the testcase.
+#
+# PARAMETERS: None.
+#
+# RETURNS: None.
+#=============================================================================
+
+setup_testcase()
+{
+$trace_logic
+
+ PID=$$
+
+ VERSION=${VERSION:=3}
+ RHOST=${RHOST:=`hostname`}
+ FILESIZE=${FILESIZE:=10}
+ SOCKET_TYPE=${SOCKET_TYPE:=udp}
+ TESTDIR=${TESTDIR:=/tmp/$TC$PID.testdir}
+ NFS_TYPE=${NFS_TYPE:=nfs}
+ LOOPS=${LOOPS:=1}
+ export TST_COUNT=$LOOPS
+
+ echo ""
+ echo "Test Options:"
+ echo " VERSION: $VERSION"
+ echo " RHOST: $RHOST"
+ echo " FILESIZE: $FILESIZE"
+ echo " SOCKET_TYPE: $SOCKET_TYPE"
+ echo " TESTDIR: $TESTDIR"
+ echo " NFS_TYPE: $NFS_TYPE"
+ echo " LOOPS: $LOOPS"
+
+ if [ "x$NFS_TYPE" != "xnfs4" ]; then
+ OPTS=${OPTS:="-o proto=$SOCKET_TYPE,vers=$VERSION "}
+ fi
+
+ REMOTE_DIR=${RHOST}:$TESTDIR
+ LUSER=${LUSER:=root}
+ mkdir -p $TCtmp || end_testcase "Could not create $TCtmp"
+ chmod 777 $TCtmp
+
+ tst_resm TINFO "Setting up remote machine: $RHOST"
+ rsh -n $RHOST "mkdir -p $TESTDIR"
+ [ $? = 0 ] || end_testcase "Could not create remote directory"
+ rsh -n $RHOST "touch $TESTDIR/testfile"
+ [ $? = 0 ] || end_testcase "Could not create testfile in remote directory"
+
+ if [ "x$NFS_TYPE" = "xnfs4" ]; then
+ rsh -n $RHOST "mkdir -p /export$TESTDIR"
+ [ $? = 0 ] || end_testcase "Could not create /export$TESTDIR on server"
+ rsh -n $RHOST "mount --bind $TESTDIR /export$TESTDIR"
+ [ $? = 0 ] || end_testcase "Could not bind $TESTDIR to /export"
+ rsh -n $RHOST "/usr/sbin/exportfs -o no_root_squash,rw,nohide,insecure,no_subtree_check *:$TESTDIR"
+ [ $? = 0 ] || end_testcase "Could not export remote directory"
+ else
+ rsh -n $RHOST "/usr/sbin/exportfs -i -o no_root_squash,rw *:$TESTDIR"
+ [ $? = 0 ] || end_testcase "Could not export remote directory"
+ fi
+
+ tst_resm TINFO "Mounting NFS filesystem"
+ mount -t $NFS_TYPE $OPTS $REMOTE_DIR $TCtmp || end_testcase "Cannot mount $TCtmp"
+ [ $? = 0 ] || end_testcase "Could not mount $REMOTE_DIR"
+}
+
+
+#=============================================================================
+# FUNCTION NAME: do_test
+#
+# FUNCTION DESCRIPTION: Perform the test
+#
+# PARAMETERS: None.
+#
+# RETURNS: None.
+#=============================================================================
+do_test()
+{
+$trace_logic
+ loopcount=0
+ nfs04_create_file $FILESIZE /tmp/nfs04$PID.testfile >/dev/null
+ if [ $? != 0 ]; then
+ end_testcase "Could not create testfile"
+ fi
+ tst_resm TINFO "Test Started"
+ while [ $loopcount -lt $LOOPS ]
+ do
+ cp /tmp/nfs04$PID.testfile $TCtmp/nfs04$PID.testfile$loopcount
+ cmp /tmp/nfs04$PID.testfile $TCtmp/nfs04$PID.testfile$loopcount
+ retval=$?
+ if [ "$retval" != 0 ]; then
+ end_testcase "Error in loop $loopcount: First cmp FAILED"
+ fi
+ cp $TCtmp/nfs04$PID.testfile$loopcount /tmp/nfs04$PID.testfile_compare
+ cmp /tmp/nfs04$PID.testfile /tmp/nfs04$PID.testfile_compare
+ retval=$?
+ if [ "$retval" != 0 ]; then
+ end_testcase "Error in loop $loopcount: Second cmp FAILED"
+ fi
+ rm -f /tmp/nfs04$PID.testfile_compare
+ loopcount=$(( $loopcount + 1 ))
+ tst_resm TINFO "Completed Loop $loopcount"
+ done
+}
+
+
+#=============================================================================
+# FUNCTION NAME: end_testcase
+#
+# FUNCTION DESCRIPTION: Clean up
+#
+# PARAMETERS: None.
+#
+# RETURNS: None.
+#=============================================================================
+end_testcase()
+{
+$trace_logic
+ if [ "$CLEANUP" = "ON" ]; then
+ sleep 2
+ umount $TCtmp || tst_resm TBROK "Cannot umount $TCtmp"
+ rm -rf $TCtmp || tst_resm TBROK "Cannot remove $TCtmp"
+ rsh -n $RHOST "/usr/sbin/exportfs -u *:$TESTDIR"
+ rsh -n $RHOST "rm -rf $TESTDIR"
+ rm -f /tmp/nfs04$PID.testfile*
+ fi
+
+ [ $# = 0 ] && { tst_resm TPASS "Test Successful"; exit 0; }
+ tst_resm TFAIL "Test Failed: $@"
+ exit 1
+}
+
+#=============================================================================
+# MAIN PROCEDURE
+#=============================================================================
+
+setup_testcase
+do_test
+end_testcase
diff --git a/testcases/network/nfs/nfs_stress/nfs04_create_file.c b/testcases/network/nfs/nfs_stress/nfs04_create_file.c
new file mode 100644
index 0000000..653c500
--- /dev/null
+++ b/testcases/network/nfs/nfs_stress/nfs04_create_file.c
@@ -0,0 +1,74 @@
+/*
+ *
+ * Copyright (c) International Business Machines Corp., 2003
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * FILE : create_file.c
+ * PURPOSE : Creates a text file of specified size.
+ * HISTORY :
+ * 10/17/2003 Robbie Williamson
+ * -Written
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+
+/* set write buffer size to whatever floats your boat. I usually use 1M */
+#define BSIZE 1048576L
+
+int main(int argc, char *argv[])
+{
+ off_t i;
+ long bufnum;
+ char buf[BSIZE];
+ off_t fd;
+
+ if (argc != 3 || atoi(argv[1]) < 1) {
+ printf
+ ("usage:\n\tcreate_file <# of %ld buffers to write> <name of file to create>\n\t ex. # create_file 10 /tmp/testfile\n",
+ BSIZE);
+ exit(3);
+ }
+ bufnum = strtol(argv[1], NULL, 0);
+ printf("Started building a %lu megabyte file\n", bufnum);
+ buf[0] = 'A';
+ for (i = 1; i < BSIZE; i++)
+ buf[i] = buf[i - 1] + 1;
+ buf[BSIZE - 1] = 'Z';
+
+ if ((fd = creat(argv[2], 0755)) == -1)
+ perror("lftest: ");
+
+ for (i = 0; i < bufnum; i++) {
+ if (write(fd, buf, BSIZE) == -1)
+ return -1;
+ else {
+ printf(".");
+ fflush(stdout);
+ }
+ fsync(fd);
+ }
+ close(fd);
+ printf("\nFinished building a %lu megabyte file\n", bufnum);
+ return (0);
+}
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [LTP] [PATCH 10/10] network/nfs04: cleanup and use nfs_lib.sh
2015-09-30 13:09 [LTP] [PATCH 01/10 resend] network/nfs01: add IPv6 test-cases Alexey Kodanev
` (7 preceding siblings ...)
2015-09-30 13:09 ` [LTP] [PATCH 09/10] network/nfs04: move to nfs_stress directory Alexey Kodanev
@ 2015-09-30 13:09 ` Alexey Kodanev
8 siblings, 0 replies; 13+ messages in thread
From: Alexey Kodanev @ 2015-09-30 13:09 UTC (permalink / raw)
To: ltp
The previous version created test files in tmp directory,
then copied it to NFS mount. This version creates the file
directly on NFS mount.
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
runtest/nfs | 6 +-
runtest/stress.part1 | 8 +-
testcases/network/nfs/nfs_stress/nfs04 | 213 ++++----------------------------
3 files changed, 36 insertions(+), 191 deletions(-)
diff --git a/runtest/nfs b/runtest/nfs
index 3ab2eb8..5bee539 100644
--- a/runtest/nfs
+++ b/runtest/nfs
@@ -17,7 +17,11 @@ 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
-nfs04 export VERSION SOCKET_TYPE; TCbin=$LTPROOT/testcases/bin nfs04
+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
+
nfslock01 export VERSION; TCbin=$LTPROOT/testcases/bin nfslock01
# This will run 1 thread on 20 directories with 50 files in each.
diff --git a/runtest/stress.part1 b/runtest/stress.part1
index af5f69d..622fa01 100644
--- a/runtest/stress.part1
+++ b/runtest/stress.part1
@@ -191,10 +191,10 @@ nfs03 export VERSION=2 SOCKET_TYPE=tcp; nfs03
nfs03 export VERSION=3 SOCKET_TYPE=udp; nfs03
nfs03 export VERSION=3 SOCKET_TYPE=tcp; nfs03
-nfs04 export VERSION=2 SOCKET_TYPE=udp; export TCbin=$LTPROOT/testcases/bin; nfs04
-nfs03 export VERSION=2 SOCKET_TYPE=tcp; export TCbin=$LTPROOT/testcases/bin; nfs04
-nfs03 export VERSION=3 SOCKET_TYPE=udp; export TCbin=$LTPROOT/testcases/bin; nfs04
-nfs03 export VERSION=3 SOCKET_TYPE=tcp; export TCbin=$LTPROOT/testcases/bin; nfs04
+nfs04 export VERSION=2 SOCKET_TYPE=udp; nfs04
+nfs04 export VERSION=2 SOCKET_TYPE=tcp; nfs04
+nfs04 export VERSION=3 SOCKET_TYPE=udp; nfs04
+nfs04 export VERSION=3 SOCKET_TYPE=tcp; nfs04
nfsstress export VERSION=2 SOCKET_TYPE=udp; nfsstress 20 50 1
nfsstress export VERSION=2 SOCKET_TYPE=tcp; nfsstress 20 50 1
diff --git a/testcases/network/nfs/nfs_stress/nfs04 b/testcases/network/nfs/nfs_stress/nfs04
index 7518d5b..b2375ab 100755
--- a/testcases/network/nfs/nfs_stress/nfs04
+++ b/testcases/network/nfs/nfs_stress/nfs04
@@ -1,197 +1,38 @@
-#! /bin/sh
+#!/bin/sh
+# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines Corp., 2003
#
-# Copyright (c) International Business Machines Corp., 2003
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implie; warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
-# the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-#
-#
-# FILE : nfs04.sh
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# PURPOSE: Creates a text file of specified size locally and copies
-# the file to an NFS mountpoint. The two files are compared
-# and checked for differences. If the files differ, then
-# the test fails. By default, this test creates a 10Mb file
-# and runs for one loop.
-#
+# the file to an NFS mountpoint. The two files are compared
+# and checked for differences. If the files differ, then
+# the test fails. By default, this test creates a 10Mb file
+# and runs for one loop.
#
-# SETUP: The home directory of root on the machine exported as "RHOST"
-# MUST have a ".rhosts" file with the hostname of the machine
-# where the test is executed.
-#
-#
-# HISTORY:
-# 10/17/03 Robbie Williamson (robbiew@us.ibm.com)
-# -Written
-#
-#***********************************************************************
-
-#Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-
-$trace_logic
-
-#-----------------------------------------------------------------------
-# Initialize local variables
-#-----------------------------------------------------------------------
-TC=${TC:=nfs04}
-TCbin=${TCbin:=`pwd`}
-TCtmp=${TCtmp:=/tmp/$TC$$}
-export TCID=$TC
-export TST_TOTAL=1
-
-# If CLEANUP is not set; set it to "ON"
-CLEANUP=${CLEANUP:="ON"}
-
-#=============================================================================
-# FUNCTION NAME: setup_testcase
-#
-# FUNCTION DESCRIPTION: Perform the setup function for the testcase.
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-
-setup_testcase()
-{
-$trace_logic
+# Created by: Robbie Williamson (robbiew@us.ibm.com)
- PID=$$
+TCID="nfs04"
+TST_TOTAL=1
+TST_CLEANUP="nfs_cleanup"
- VERSION=${VERSION:=3}
- RHOST=${RHOST:=`hostname`}
- FILESIZE=${FILESIZE:=10}
- SOCKET_TYPE=${SOCKET_TYPE:=udp}
- TESTDIR=${TESTDIR:=/tmp/$TC$PID.testdir}
- NFS_TYPE=${NFS_TYPE:=nfs}
- LOOPS=${LOOPS:=1}
- export TST_COUNT=$LOOPS
-
- echo ""
- echo "Test Options:"
- echo " VERSION: $VERSION"
- echo " RHOST: $RHOST"
- echo " FILESIZE: $FILESIZE"
- echo " SOCKET_TYPE: $SOCKET_TYPE"
- echo " TESTDIR: $TESTDIR"
- echo " NFS_TYPE: $NFS_TYPE"
- echo " LOOPS: $LOOPS"
-
- if [ "x$NFS_TYPE" != "xnfs4" ]; then
- OPTS=${OPTS:="-o proto=$SOCKET_TYPE,vers=$VERSION "}
- fi
-
- REMOTE_DIR=${RHOST}:$TESTDIR
- LUSER=${LUSER:=root}
- mkdir -p $TCtmp || end_testcase "Could not create $TCtmp"
- chmod 777 $TCtmp
-
- tst_resm TINFO "Setting up remote machine: $RHOST"
- rsh -n $RHOST "mkdir -p $TESTDIR"
- [ $? = 0 ] || end_testcase "Could not create remote directory"
- rsh -n $RHOST "touch $TESTDIR/testfile"
- [ $? = 0 ] || end_testcase "Could not create testfile in remote directory"
-
- if [ "x$NFS_TYPE" = "xnfs4" ]; then
- rsh -n $RHOST "mkdir -p /export$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not create /export$TESTDIR on server"
- rsh -n $RHOST "mount --bind $TESTDIR /export$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not bind $TESTDIR to /export"
- rsh -n $RHOST "/usr/sbin/exportfs -o no_root_squash,rw,nohide,insecure,no_subtree_check *:$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not export remote directory"
- else
- rsh -n $RHOST "/usr/sbin/exportfs -i -o no_root_squash,rw *:$TESTDIR"
- [ $? = 0 ] || end_testcase "Could not export remote directory"
- fi
-
- tst_resm TINFO "Mounting NFS filesystem"
- mount -t $NFS_TYPE $OPTS $REMOTE_DIR $TCtmp || end_testcase "Cannot mount $TCtmp"
- [ $? = 0 ] || end_testcase "Could not mount $REMOTE_DIR"
-}
-
-
-#=============================================================================
-# FUNCTION NAME: do_test
-#
-# FUNCTION DESCRIPTION: Perform the test
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-do_test()
-{
-$trace_logic
- loopcount=0
- nfs04_create_file $FILESIZE /tmp/nfs04$PID.testfile >/dev/null
- if [ $? != 0 ]; then
- end_testcase "Could not create testfile"
- fi
- tst_resm TINFO "Test Started"
- while [ $loopcount -lt $LOOPS ]
- do
- cp /tmp/nfs04$PID.testfile $TCtmp/nfs04$PID.testfile$loopcount
- cmp /tmp/nfs04$PID.testfile $TCtmp/nfs04$PID.testfile$loopcount
- retval=$?
- if [ "$retval" != 0 ]; then
- end_testcase "Error in loop $loopcount: First cmp FAILED"
- fi
- cp $TCtmp/nfs04$PID.testfile$loopcount /tmp/nfs04$PID.testfile_compare
- cmp /tmp/nfs04$PID.testfile /tmp/nfs04$PID.testfile_compare
- retval=$?
- if [ "$retval" != 0 ]; then
- end_testcase "Error in loop $loopcount: Second cmp FAILED"
- fi
- rm -f /tmp/nfs04$PID.testfile_compare
- loopcount=$(( $loopcount + 1 ))
- tst_resm TINFO "Completed Loop $loopcount"
- done
-}
-
-
-#=============================================================================
-# FUNCTION NAME: end_testcase
-#
-# FUNCTION DESCRIPTION: Clean up
-#
-# PARAMETERS: None.
-#
-# RETURNS: None.
-#=============================================================================
-end_testcase()
-{
-$trace_logic
- if [ "$CLEANUP" = "ON" ]; then
- sleep 2
- umount $TCtmp || tst_resm TBROK "Cannot umount $TCtmp"
- rm -rf $TCtmp || tst_resm TBROK "Cannot remove $TCtmp"
- rsh -n $RHOST "/usr/sbin/exportfs -u *:$TESTDIR"
- rsh -n $RHOST "rm -rf $TESTDIR"
- rm -f /tmp/nfs04$PID.testfile*
- fi
+. nfs_lib.sh
+. test_net.sh
- [ $# = 0 ] && { tst_resm TPASS "Test Successful"; exit 0; }
- tst_resm TFAIL "Test Failed: $@"
- exit 1
-}
+nfs_setup
-#=============================================================================
-# MAIN PROCEDURE
-#=============================================================================
+tst_resm TINFO "create 10M file"
+ROD nfs04_create_file 10 nfs04.testfile
-setup_testcase
-do_test
-end_testcase
+tst_exit
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [LTP] [PATCH 02/10] network/nfs: rename nfs dir to nfs_stress
2015-09-30 13:09 ` [LTP] [PATCH 02/10] network/nfs: rename nfs dir to nfs_stress Alexey Kodanev
@ 2015-10-06 13:21 ` Cyril Hrubis
2015-10-06 13:44 ` Alexey Kodanev
0 siblings, 1 reply; 13+ messages in thread
From: Cyril Hrubis @ 2015-10-06 13:21 UTC (permalink / raw)
To: ltp
Hi!
> testcases/network/nfs/nfs_stress/open_files.c | 126 +++++++++++++++++++++++++
I would like to to see the open_files.c to be renamed to
nfs01_open_files.c.
Otherwise the patchset looks good, acked.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 13+ messages in thread
* [LTP] [PATCH 02/10] network/nfs: rename nfs dir to nfs_stress
2015-10-06 13:21 ` Cyril Hrubis
@ 2015-10-06 13:44 ` Alexey Kodanev
2015-10-07 10:22 ` Alexey Kodanev
0 siblings, 1 reply; 13+ messages in thread
From: Alexey Kodanev @ 2015-10-06 13:44 UTC (permalink / raw)
To: ltp
Hi,
On 10/06/2015 04:21 PM, Cyril Hrubis wrote:
> Hi!
>> testcases/network/nfs/nfs_stress/open_files.c | 126 +++++++++++++++++++++++++
> I would like to to see the open_files.c to be renamed to
> nfs01_open_files.c.
OK, I'll rename it.
Thanks,
Alexey
> Otherwise the patchset looks good, acked.
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [LTP] [PATCH 02/10] network/nfs: rename nfs dir to nfs_stress
2015-10-06 13:44 ` Alexey Kodanev
@ 2015-10-07 10:22 ` Alexey Kodanev
0 siblings, 0 replies; 13+ messages in thread
From: Alexey Kodanev @ 2015-10-07 10:22 UTC (permalink / raw)
To: ltp
Hi,
Patchset applied with the following changes:
* open_files.c ->nfs01_open_files,
* added cd $TST_TMPDIR in setup after 'mount' command. This is need
because mount is called on test current working directory, so the test
could still write to the local dir instead of nfs mount.
Best regards,
Alexey
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2015-10-07 10:22 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-30 13:09 [LTP] [PATCH 01/10 resend] network/nfs01: add IPv6 test-cases Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 02/10] network/nfs: rename nfs dir to nfs_stress Alexey Kodanev
2015-10-06 13:21 ` Cyril Hrubis
2015-10-06 13:44 ` Alexey Kodanev
2015-10-07 10:22 ` Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 03/10] network/nfs_stress: move common code from nfs01 to library Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 04/10] network/nfs02: move to nfs_stress Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 05/10] network/nfs_stress/nfs02: use nfs_lib.sh Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 06/10] network/nfs/nfs_stress: rename library functions names Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 07/10] network/nfs03: move to nfs_stress directory Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 08/10] network/nfs_stress/nfs03: use nfs_lib.sh, run over IPv6 Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 09/10] network/nfs04: move to nfs_stress directory Alexey Kodanev
2015-09-30 13:09 ` [LTP] [PATCH 10/10] network/nfs04: cleanup and use nfs_lib.sh Alexey Kodanev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox