Home | History | Annotate | Download | only in testscripts
      1 #!/bin/bash
      2 #
      3 # adp.sh -- run ADP's stress test on /proc/[0-9]*/cmdline
      4 #
      5 #
      6 
      7 usage()
      8 {
      9   cat << EOF
     10   usage: $0 options
     11 
     12   This script runs ADP's stress test on /proc/[0-0]*/cmdline.
     13 
     14   OPTIONS
     15     -h    display this message and exit
     16     -d    delay for top, in seconds
     17     -n    number of iterations for top
     18 EOF
     19 }
     20 
     21 
     22 checkvar()
     23 {
     24   VAR=$1
     25   eval VALUE='$'$VAR
     26   if [ "x$VALUE" = "x" ]; then
     27       echo "`basename $0`: $VAR is not set."
     28       return 1
     29 	else
     30       return 0
     31   fi
     32 }
     33 
     34 
     35 while getopts hd:n: OPTION
     36 do
     37   case $OPTION in
     38     h)
     39       usage
     40       exit 1
     41       ;;
     42     d)
     43       delay=$OPTARG
     44       ;;
     45     n)
     46       iterations=$OPTARG
     47       ;;
     48     ?)
     49       usage
     50       exit 1
     51       ;;
     52   esac
     53 done
     54 
     55 
     56 #check all vars
     57 checkvar delay && checkvar iterations || {
     58   usage
     59   exit 2
     60 }
     61 
     62 echo "-------------------------------------------------------------------------"
     63 date
     64 echo "Starting tests..."
     65 
     66 for i in 1 2 3 4 5
     67 do
     68 	./adp_children.sh &
     69 done
     70 
     71 echo "Stressing /proc/[0-9]*/cmdline..."
     72 
     73 for i in 1 2 3 4 5
     74 do
     75 	./adp_test.sh &
     76 done
     77 
     78 echo "Starting 'top', redirecting output to 'adp.log'..."
     79 top -b -d $delay -n $iterations > adp.log &
     80 
     81 echo "LTP ADP Test done. Killing processes..."
     82 killall adp_test.sh
     83 killall adp_children.sh
     84 
     85 echo "Done. Please check adp.log."
     86 date
     87 
     88 echo "-------------------------------------------------------------------------"
     89 
     90