Home | History | Annotate | Download | only in nfs_stress
      1 #!/bin/sh
      2 # Copyright (c) 2016 Oracle and/or its affiliates. All Rights Reserved.
      3 # Copyright (c) International Business Machines  Corp., 2003
      4 #
      5 # This program is free software; you can redistribute it and/or
      6 # modify it under the terms of the GNU General Public License as
      7 # published by the Free Software Foundation; either version 2 of
      8 # the License, or (at your option) any later version.
      9 #
     10 # This program is distributed in the hope that it would be useful,
     11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 # GNU General Public License for more details.
     14 #
     15 # You should have received a copy of the GNU General Public License
     16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
     17 #
     18 #  PURPOSE: Runs fsstress over an NFS mount point for a specified amount
     19 #           of time. The purpose of this test is to stress the NFS kernel
     20 #           code and possibly the underlying filesystem where the export
     21 #           resides.  A PASS is if the test completes.
     22 
     23 TCID=nfs06
     24 TST_TOTAL=1
     25 TST_CLEANUP="nfs_cleanup"
     26 
     27 . nfs_lib.sh
     28 . test_net.sh
     29 
     30 do_test()
     31 {
     32 	tst_resm TINFO "Starting fsstress processes on NFS mounts"
     33 
     34 	local n=0
     35 	local pids
     36 	for i in $VERSION; do
     37 		fsstress -l 1 -d $TST_TMPDIR/$i/$n -n 1000 -p 50 -r -c > /dev/null &
     38 		pids="$pids $!"
     39 		n=$(( n + 1 ))
     40 	done
     41 
     42 	tst_resm TINFO "waiting for pids:$pids"
     43 	for p in $pids; do
     44 		wait $p
     45 		if [ $? -ne 0 ]; then
     46 			kill -9 $pids
     47 			tst_brkm TFAIL "fsstress process failed"
     48 		else
     49 			tst_resm TINFO "fsstress '$p' completed"
     50 		fi
     51 	done
     52 
     53 	tst_resm TPASS "all fsstress processes completed on '$n' NFS mounts"
     54 }
     55 
     56 nfs_setup
     57 
     58 do_test
     59 
     60 tst_exit
     61