blob: de2e6f7555d26adbc5f25cc848df5538fb5dd0de [file] [log] [blame]
robbiew12947782003-02-12 17:02:45 +00001#!/bin/sh
2
3# Copyright (c) International Business Machines Corp., 2003
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
13# the 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, write to the Free Software
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18#
19# FILE : ltpstress.sh
20# DESCRIPTION : A script that will stress your system using the LTP testsuite.
21# REQUIREMENTS:
22# 1) The 'rsh' daemon must be running and NFS (versions 2 &3) must be
23# configured into the kernel and installed.
24# 2) The 'sar' application must be installed to use the "-S" option
25# HISTORY :
26# 02/11/2003 Robbie Williamson (robbiew@austin.ibm.com)
27# written
28####################################################
29
30export LTPROOT=${PWD}
31export TMPBASE="/tmp"
32export TMP="${TMPBASE}/ltpstress-$$"
33export PATH=$PATH:$LTPROOT/testcases/bin
34memsize=0
35duration=86400
36datafile="/tmp/ltpstress.data"
37interval=10
38Sar=0
39
40usage()
41{
42
43 cat <<-END >&2
44 usage: ${0##*/} [ -d datafile ] [ -i # (in seconds) ] [ -l logfile ] [ -m # (in Mb) ] [ -t duration ] [-S]
45
46 -d datafile Data file for 'sar' to log to. Default is "/tmp/ltpstress.data".
47 -i # (in sec) Interval that 'sar' should take snapshots. Default is 10 seconds.
48 -l logfile Log results of test in a logfile.
49 -m # (in Mb) Specify the _minimum_ memory load of # megabytes in background. Default is 64Mb.
50 -S Use 'sar' to measure data.
51 -t duration Execute the testsuite for given duration in hours. Default is 24.
52
53 example: ${0##*/} -d /tmp/topdata -l /tmp/ltplog.$$ -m 128 -t 24 -S
54 END
55exit
56}
57
58mkdir -p ${TMP}
59
60cd ${TMP}
61if [ $? -ne 0 ]; then
62 echo "could not cd ${TMP} ... exiting"
63 exit
64fi
65
66while getopts d:hi:l:St:m:\? arg
67do case $arg in
68
69 d) datafile="$OPTARG";;
70
71 h) echo "Help info:"
72 usage;;
73
74 i) interval=$OPTARG;;
75
76 l) logfile="-l $OPTARG";;
77
78 m) memsize=$(($OPTARG * 1024 * 1024));;
79
80 S) Sar=1;;
81
82 t) hours=$OPTARG
83 duration=$(($hours * 60 * 60));;
84
85 \?) echo "Help info:"
86 usage;;
87 esac
88done
89
90# Networking setup
91echo `hostname` >> /root/.rhosts
92chmod 644 /root/.rhosts
93
94netstat -an | grep 514
95if [ $? -eq 1 ];then
96 echo "Error: 'rsh' deamon not active on this machine."
97 exit 1
98fi
99
100ps -ef | grep portmap | grep -v grep
101if [ $? -eq 1 ];then
102 /sbin/portmap &
103fi
104sleep 1
105ps -ef | grep portmap | grep -v grep
106if [ $? -eq 1 ];then
107 echo "Error: Could not start portmap daemon."
108 exit 1
109fi
110
111rpcinfo -p | grep status
112if [ $? -eq 1 ];then
113 /sbin/rpc.statd
114fi
115sleep 1
116rpcinfo -p | grep status
117if [ $? -eq 1 ];then
118 echo "Error: Could not start statd daemon."
119 exit 1
120fi
121
122rpcinfo -p | grep nfs
123if [ $? -eq 1 ];then
124 /usr/sbin/rpc.nfsd
125fi
126sleep 1
127rpcinfo -p | grep nfs
128if [ $? -eq 1 ];then
129 echo "Error: Could not start nfs server daemon."
130 exit 1
131fi
132
133rpcinfo -p | grep mount
134if [ $? -eq 1 ];then
135 /usr/sbin/rpc.mountd
136fi
137sleep 1
138rpcinfo -p | grep mount
139if [ $? -eq 1 ];then
140 echo "Error: Could not start mountd daemon."
141 exit 1
142fi
143# End of network setup
144
145
146
147if [ $memsize -eq 0 ]; then
148 memsize=$((64 * 1024 * 1024))
149fi
150
151genload --vm 0 --vm-bytes $memsize 2>&1 1>/dev/null &
152
153netpipe.sh >/dev/null 2>/dev/null &
154
155${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/stress.part1 > ${TMP}/stress.part1
156${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/stress.part2 > ${TMP}/stress.part2
157${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/stress.part3 > ${TMP}/stress.part3
158${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/stress.part4 > ${TMP}/stress.part4
159
160sleep 2
161
162if [ $Sar -eq 1 ]; then
163 sar -o $datafile $interval 0 &
164fi
165
166sleep 2
167
168${LTPROOT}/pan/pan -e -p -q -S -t ${hours}h -a stress1 -n stress1 $logfile -f ${TMP}/stress.part1 >/dev/null 2>&1 &
169${LTPROOT}/pan/pan -e -p -q -S -t ${hours}h -a stress2 -n stress2 $logfile -f ${TMP}/stress.part2 >/dev/null 2>&1 &
170${LTPROOT}/pan/pan -e -p -q -S -t ${hours}h -a stress3 -n stress3 $logfile -f ${TMP}/stress.part3 >/dev/null 2>&1 &
171${LTPROOT}/pan/pan -e -p -q -S -t ${hours}h -a stress4 -n stress4 $logfile -f ${TMP}/stress.part4 >/dev/null 2>&1 &
172
173echo "Running LTP Stress for $hours hour(s)"
174
175# Sleep a little longer than duration to let pan "try" to gracefully end itself.
176sleep $(($duration + 10))
177
178if [ $Sar -eq 1 ]; then
179 killall -9 sadc >/dev/null 2>&1
180fi
181killall -9 pan >/dev/null 2>&1
182killall -9 genload >/dev/null 2>&1
183killall -9 netpipe.sh >/dev/null 2>&1
184killall -9 NPtcp >/dev/null 2>&1
185
186rm -rf ${TMP}
187echo "Testing done"
188