1#!/bin/bash 2# 3# Run a series of 14 tests under KVM. These are not particularly 4# well-selected or well-tuned, but are the current set. Run from the 5# top level of the source tree. 6# 7# Edit the definitions below to set the locations of the various directories, 8# as well as the test duration. 9# 10# Usage: sh kvm.sh [ options ] 11# 12# This program is free software; you can redistribute it and/or modify 13# it under the terms of the GNU General Public License as published by 14# the Free Software Foundation; either version 2 of the License, or 15# (at your option) any later version. 16# 17# This program is distributed in the hope that it will be useful, 18# but WITHOUT ANY WARRANTY; without even the implied warranty of 19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20# GNU General Public License for more details. 21# 22# You should have received a copy of the GNU General Public License 23# along with this program; if not, write to the Free Software 24# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 25# 26# Copyright (C) IBM Corporation, 2011 27# 28# Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com> 29 30scriptname=$0 31 32dur=30 33KVM=`pwd`/tools/testing/selftests/rcutorture; export KVM 34builddir=${KVM}/b1 35resdir="" 36configs=" sysidleY.2013.06.19a \ 37 sysidleN.2013.06.19a \ 38 P1-S-T-NH-SD-SMP-HP \ 39 P2-2-t-nh-sd-SMP-hp \ 40 P3-3-T-nh-SD-SMP-hp \ 41 P4-A-t-NH-sd-SMP-HP \ 42 P5-U-T-NH-sd-SMP-hp \ 43 P6---t-nh-SD-smp-hp \ 44 N1-S-T-NH-SD-SMP-HP \ 45 N2-2-t-nh-sd-SMP-hp \ 46 N3-3-T-nh-SD-SMP-hp \ 47 N4-A-t-NH-sd-SMP-HP \ 48 N5-U-T-NH-sd-SMP-hp \ 49 PT1-nh \ 50 PT2-NH \ 51 NT1-nh \ 52 NT3-NH" 53ds=`date +%Y.%m.%d-%H:%M:%S` 54 55usage () { 56 echo "Usage: $scriptname optional arguments:" 57 echo " --builddir absolute-pathname" 58 echo " --configs \"config-file list\"" 59 echo " --datestamp string" 60 echo " --duration minutes" 61 echo " --rcu-kvm absolute-pathname" 62 echo " --results absolute-pathname" 63 echo " --relbuilddir relative-pathname" 64 exit 1 65} 66 67# checkarg --argname argtype $# arg mustmatch cannotmatch 68checkarg () { 69 if test $3 -le 1 70 then 71 echo $1 needs argument $2 matching \"$5\" 72 usage 73 fi 74 if echo "$4" | grep -q -e "$5" 75 then 76 : 77 else 78 echo $1 $2 \"$4\" must match \"$5\" 79 usage 80 fi 81 if echo "$4" | grep -q -e "$6" 82 then 83 echo $1 $2 \"$4\" must not match \"$6\" 84 usage 85 fi 86} 87 88while test $# -gt 0 89do 90 echo ":$1:" 91 case "$1" in 92 --builddir) 93 checkarg --builddir "(absolute pathname)" "$#" "$2" '^/' error 94 builddir=$2 95 gotbuilddir=1 96 shift 97 ;; 98 --configs) 99 checkarg --configs "(list of config files)" "$#" "$2" '^[^/]*$' '^--' 100 configs="$2" 101 shift 102 ;; 103 --datestamp) 104 checkarg --datestamp "(relative pathname)" "$#" "$2" '^[^/]*$' '^--' 105 ds=$2 106 shift 107 ;; 108 --duration) 109 checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' error 110 dur=$2 111 shift 112 ;; 113 --rcu-kvm) 114 checkarg --rcu-kvm "(absolute pathname)" "$#" "$2" '^/' error 115 KVM=$2; export KVM 116 if -z "$gotbuilddir" 117 then 118 builddir=${KVM}/b1 119 fi 120 if -n "$gotrelbuilddir" 121 then 122 builddir=${KVM}/${relbuilddir} 123 fi 124 shift 125 ;; 126 --relbuilddir) 127 checkarg --relbuilddir "(relative pathname)" "$#" "$2" '^[^/]*$' '^--' 128 relbuilddir=$2 129 gotrelbuilddir=1 130 builddir=${KVM}/${relbuilddir} 131 shift 132 ;; 133 --results) 134 checkarg --results "(absolute pathname)" "$#" "$2" '^/' error 135 resdir=$2 136 shift 137 ;; 138 *) 139 usage 140 ;; 141 esac 142 shift 143done 144 145echo "builddir=$builddir" 146echo "dur=$dur" 147echo "KVM=$KVM" 148echo "resdir=$resdir" 149 150PATH=${KVM}/bin:$PATH; export PATH 151CONFIGFRAG=${KVM}/configs; export CONFIGFRAG 152 153if test -z "$resdir" 154then 155 resdir=$KVM/res 156 mkdir $resdir || : 157else 158 mkdir -p "$resdir" || : 159fi 160mkdir $resdir/$ds 161echo Datestamp: $ds 162 163pwd > $resdir/$ds/testid.txt 164if test -d .git 165then 166 git status >> $resdir/$ds/testid.txt 167 git rev-parse HEAD >> $resdir/$ds/testid.txt 168fi 169builddir=$KVM/b1 170mkdir $builddir || : 171 172for CF in $configs 173do 174 rd=$resdir/$ds/$CF 175 mkdir $rd || : 176 echo Results directory: $rd 177 kvm-test-1-rcu.sh $CONFIGFRAG/$CF $builddir $rd $dur "-nographic" "rcutorture.test_no_idle_hz=1 rcutorture.n_barrier_cbs=4 rcutorture.verbose=1" 178done 179# Tracing: trace_event=rcu:rcu_nocb_grace_period,rcu:rcu_grace_period,rcu:rcu_grace_period_init,rcu:rcu_quiescent_state_report,rcu:rcu_fqs,rcu:rcu_callback,rcu:rcu_torture_read,rcu:rcu_invoke_callback,rcu:rcu_fqs,rcu:rcu_dyntick,rcu:rcu_unlock_preempted_task 180