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, you can access it online at 24# http://www.gnu.org/licenses/gpl-2.0.html. 25# 26# Copyright (C) IBM Corporation, 2011 27# 28# Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com> 29 30scriptname=$0 31args="$*" 32 33dur=30 34KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM 35PATH=${KVM}/bin:$PATH; export PATH 36builddir="${KVM}/b1" 37RCU_INITRD="$KVM/initrd"; export RCU_INITRD 38RCU_KMAKE_ARG=""; export RCU_KMAKE_ARG 39resdir="" 40configs="" 41ds=`date +%Y.%m.%d-%H:%M:%S` 42kversion="" 43 44. functions.sh 45 46usage () { 47 echo "Usage: $scriptname optional arguments:" 48 echo " --bootargs kernel-boot-arguments" 49 echo " --builddir absolute-pathname" 50 echo " --buildonly" 51 echo " --configs \"config-file list\"" 52 echo " --datestamp string" 53 echo " --duration minutes" 54 echo " --interactive" 55 echo " --kmake-arg kernel-make-arguments" 56 echo " --kversion vN.NN" 57 echo " --mac nn:nn:nn:nn:nn:nn" 58 echo " --no-initrd" 59 echo " --qemu-args qemu-system-..." 60 echo " --qemu-cmd qemu-system-..." 61 echo " --results absolute-pathname" 62 echo " --relbuilddir relative-pathname" 63 exit 1 64} 65 66while test $# -gt 0 67do 68 case "$1" in 69 --bootargs) 70 checkarg --bootargs "(list of kernel boot arguments)" "$#" "$2" '.*' '^--' 71 RCU_BOOTARGS="$2" 72 shift 73 ;; 74 --builddir) 75 checkarg --builddir "(absolute pathname)" "$#" "$2" '^/' '^error' 76 builddir=$2 77 gotbuilddir=1 78 shift 79 ;; 80 --buildonly) 81 RCU_BUILDONLY=1; export RCU_BUILDONLY 82 ;; 83 --configs) 84 checkarg --configs "(list of config files)" "$#" "$2" '^[^/]*$' '^--' 85 configs="$2" 86 shift 87 ;; 88 --datestamp) 89 checkarg --datestamp "(relative pathname)" "$#" "$2" '^[^/]*$' '^--' 90 ds=$2 91 shift 92 ;; 93 --duration) 94 checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' '^error' 95 dur=$2 96 shift 97 ;; 98 --interactive) 99 RCU_QEMU_INTERACTIVE=1; export RCU_QEMU_INTERACTIVE 100 ;; 101 --kmake-arg) 102 checkarg --kmake-arg "(kernel make arguments)" $# "$2" '.*' '^error$' 103 RCU_KMAKE_ARG="$2"; export RCU_KMAKE_ARG 104 shift 105 ;; 106 --kversion) 107 checkarg --kversion "(kernel version)" $# "$2" '^v[0-9.]*$' '^error' 108 kversion=$2 109 shift 110 ;; 111 --mac) 112 checkarg --mac "(MAC address)" $# "$2" '^\([0-9a-fA-F]\{2\}:\)\{5\}[0-9a-fA-F]\{2\}$' error 113 RCU_QEMU_MAC=$2; export RCU_QEMU_MAC 114 shift 115 ;; 116 --no-initrd) 117 RCU_INITRD=""; export RCU_INITRD 118 ;; 119 --qemu-args) 120 checkarg --qemu-args "-qemu args" $# "$2" '^-' '^error' 121 RCU_QEMU_ARG="$2" 122 shift 123 ;; 124 --qemu-cmd) 125 checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' '^--' 126 RCU_QEMU_CMD="$2"; export RCU_QEMU_CMD 127 shift 128 ;; 129 --relbuilddir) 130 checkarg --relbuilddir "(relative pathname)" "$#" "$2" '^[^/]*$' '^--' 131 relbuilddir=$2 132 gotrelbuilddir=1 133 builddir=${KVM}/${relbuilddir} 134 shift 135 ;; 136 --results) 137 checkarg --results "(absolute pathname)" "$#" "$2" '^/' '^error' 138 resdir=$2 139 shift 140 ;; 141 *) 142 echo Unknown argument $1 143 usage 144 ;; 145 esac 146 shift 147done 148 149CONFIGFRAG=${KVM}/configs; export CONFIGFRAG 150KVPATH=${CONFIGFRAG}/$kversion; export KVPATH 151 152if test -z "$configs" 153then 154 configs="`cat $CONFIGFRAG/$kversion/CFLIST`" 155fi 156 157if test -z "$resdir" 158then 159 resdir=$KVM/res 160 if ! test -e $resdir 161 then 162 mkdir $resdir || : 163 fi 164else 165 if ! test -e $resdir 166 then 167 mkdir -p "$resdir" || : 168 fi 169fi 170mkdir $resdir/$ds 171touch $resdir/$ds/log 172echo $scriptname $args >> $resdir/$ds/log 173 174pwd > $resdir/$ds/testid.txt 175if test -d .git 176then 177 git status >> $resdir/$ds/testid.txt 178 git rev-parse HEAD >> $resdir/$ds/testid.txt 179fi 180builddir=$KVM/b1 181if ! test -e $builddir 182then 183 mkdir $builddir || : 184fi 185 186for CF in $configs 187do 188 # Running TREE01 multiple times creates TREE01, TREE01.2, TREE01.3, ... 189 rd=$resdir/$ds/$CF 190 if test -d "${rd}" 191 then 192 n="`ls -d "${rd}"* | grep '\.[0-9]\+$' | 193 sed -e 's/^.*\.\([0-9]\+\)/\1/' | 194 sort -k1n | tail -1`" 195 if test -z "$n" 196 then 197 rd="${rd}.2" 198 else 199 n="`expr $n + 1`" 200 rd="${rd}.${n}" 201 fi 202 fi 203 mkdir "${rd}" 204 echo Results directory: $rd 205 kvm-test-1-rcu.sh $CONFIGFRAG/$kversion/$CF $builddir $rd $dur "-nographic $RCU_QEMU_ARG" "rcutorture.test_no_idle_hz=1 rcutorture.verbose=1 $RCU_BOOTARGS" 206done 207# Tracing: trace_event=rcu:rcu_grace_period,rcu:rcu_future_grace_period,rcu:rcu_grace_period_init,rcu:rcu_nocb_wake,rcu:rcu_preempt_task,rcu:rcu_unlock_preempted_task,rcu:rcu_quiescent_state_report,rcu:rcu_fqs,rcu:rcu_callback,rcu:rcu_kfree_callback,rcu:rcu_batch_start,rcu:rcu_invoke_callback,rcu:rcu_invoke_kfree_callback,rcu:rcu_batch_end,rcu:rcu_torture_read,rcu:rcu_barrier 208 209echo " --- `date` Test summary:" 210kvm-recheck.sh $resdir/$ds 211