~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/rcutorture/bin/kvm-test-1-run-batch.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0+
  3 #
  4 # Carry out a kvm-based run for the specified batch of scenarios, which
  5 # might have been built by --build-only kvm.sh run.
  6 #
  7 # Usage: kvm-test-1-run-batch.sh SCENARIO [ SCENARIO ... ]
  8 #
  9 # Each SCENARIO is the name of a directory in the current directory
 10 #       containing a ready-to-run qemu-cmd file.
 11 #
 12 # Copyright (C) 2021 Facebook, Inc.
 13 #
 14 # Authors: Paul E. McKenney <paulmck@kernel.org>
 15 
 16 T="`mktemp -d ${TMPDIR-/tmp}/kvm-test-1-run-batch.sh.XXXXXX`"
 17 trap 'rm -rf $T' 0
 18 
 19 echo ---- Running batch $*
 20 # Check arguments
 21 runfiles=
 22 for i in "$@"
 23 do
 24         if ! echo $i | grep -q '^[^/.a-z]\+\(\.[0-9]\+\)\?$'
 25         then
 26                 echo Bad scenario name: \"$i\" 1>&2
 27                 exit 1
 28         fi
 29         if ! test -d "$i"
 30         then
 31                 echo Scenario name not a directory: \"$i\" 1>&2
 32                 exit 2
 33         fi
 34         if ! test -f "$i/qemu-cmd"
 35         then
 36                 echo Scenario lacks a command file: \"$i/qemu-cmd\" 1>&2
 37                 exit 3
 38         fi
 39         rm -f $i/build.*
 40         touch $i/build.run
 41         runfiles="$runfiles $i/build.run"
 42 done
 43 
 44 # Extract settings from the qemu-cmd file.
 45 grep '^#' $1/qemu-cmd | sed -e 's/^# //' > $T/qemu-cmd-settings
 46 . $T/qemu-cmd-settings
 47 
 48 # Start up jitter, start each scenario, wait, end jitter.
 49 echo ---- System running test: `uname -a`
 50 echo ---- Starting kernels. `date` | tee -a log
 51 $TORTURE_JITTER_START
 52 kvm-assign-cpus.sh /sys/devices/system/node > $T/cpuarray.awk
 53 for i in "$@"
 54 do
 55         echo ---- System running test: `uname -a` > $i/kvm-test-1-run-qemu.sh.out
 56         echo > $i/kvm-test-1-run-qemu.sh.out
 57         export TORTURE_AFFINITY=
 58         kvm-get-cpus-script.sh $T/cpuarray.awk $T/cpubatches.awk $T/cpustate
 59         cat << '        ___EOF___' >> $T/cpubatches.awk
 60         END {
 61                 affinitylist = "";
 62                 if (!gotcpus()) {
 63                         print "echo No CPU-affinity information, so no taskset command.";
 64                 } else if (cpu_count !~ /^[0-9][0-9]*$/) {
 65                         print "echo " scenario ": Bogus number of CPUs (old qemu-cmd?), so no taskset command.";
 66                 } else {
 67                         affinitylist = nextcpus(cpu_count);
 68                         if (!(affinitylist ~ /^[0-9,-][0-9,-]*$/))
 69                                 print "echo " scenario ": Bogus CPU-affinity information, so no taskset command.";
 70                         else if (!dumpcpustate())
 71                                 print "echo " scenario ": Could not dump state, so no taskset command.";
 72                         else
 73                                 print "export TORTURE_AFFINITY=" affinitylist;
 74                 }
 75         }
 76         ___EOF___
 77         cpu_count="`grep '# TORTURE_CPU_COUNT=' $i/qemu-cmd | sed -e 's/^.*=//'`"
 78         affinity_export="`awk -f $T/cpubatches.awk -v cpu_count="$cpu_count" -v scenario=$i < /dev/null`"
 79         $affinity_export
 80         kvm-test-1-run-qemu.sh $i >> $i/kvm-test-1-run-qemu.sh.out 2>&1 &
 81 done
 82 for i in $runfiles
 83 do
 84         while ls $i > /dev/null 2>&1
 85         do
 86                 :
 87         done
 88 done
 89 echo ---- All kernel runs complete. `date` | tee -a log
 90 $TORTURE_JITTER_STOP

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php