drm/panel: panel-himax-hx83102: support for csot-pna957qt1-1 MIPI-DSI panel
[drm/drm-misc.git] / tools / testing / selftests / rcutorture / bin / kvm-test-1-run-batch.sh
blobf87046b702d88e6819bf6b2368b7d5b2a09b1d66
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0+
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.
7 # Usage: kvm-test-1-run-batch.sh SCENARIO [ SCENARIO ... ]
9 # Each SCENARIO is the name of a directory in the current directory
10 # containing a ready-to-run qemu-cmd file.
12 # Copyright (C) 2021 Facebook, Inc.
14 # Authors: Paul E. McKenney <paulmck@kernel.org>
16 T="`mktemp -d ${TMPDIR-/tmp}/kvm-test-1-run-batch.sh.XXXXXX`"
17 trap 'rm -rf $T' 0
19 echo ---- Running batch $*
20 # Check arguments
21 runfiles=
22 for i in "$@"
24 if ! echo $i | grep -q '^[^/.a-z]\+\(\.[0-9]\+\)\?$'
25 then
26 echo Bad scenario name: \"$i\" 1>&2
27 exit 1
29 if ! test -d "$i"
30 then
31 echo Scenario name not a directory: \"$i\" 1>&2
32 exit 2
34 if ! test -f "$i/qemu-cmd"
35 then
36 echo Scenario lacks a command file: \"$i/qemu-cmd\" 1>&2
37 exit 3
39 rm -f $i/build.*
40 touch $i/build.run
41 runfiles="$runfiles $i/build.run"
42 done
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
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 "$@"
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 if test -z "${TORTURE_NO_AFFINITY}"
60 then
61 cat << ' ___EOF___' >> $T/cpubatches.awk
62 END {
63 affinitylist = "";
64 if (!gotcpus()) {
65 print "echo No CPU-affinity information, so no taskset command.";
66 } else if (cpu_count !~ /^[0-9][0-9]*$/) {
67 print "echo " scenario ": Bogus number of CPUs (old qemu-cmd?), so no taskset command.";
68 } else {
69 affinitylist = nextcpus(cpu_count);
70 if (!(affinitylist ~ /^[0-9,-][0-9,-]*$/))
71 print "echo " scenario ": Bogus CPU-affinity information, so no taskset command.";
72 else if (!dumpcpustate())
73 print "echo " scenario ": Could not dump state, so no taskset command.";
74 else
75 print "export TORTURE_AFFINITY=" affinitylist;
78 ___EOF___
79 cpu_count="`grep '# TORTURE_CPU_COUNT=' $i/qemu-cmd | sed -e 's/^.*=//'`"
80 affinity_export="`awk -f $T/cpubatches.awk -v cpu_count="$cpu_count" -v scenario=$i < /dev/null`"
81 $affinity_export
83 kvm-test-1-run-qemu.sh $i >> $i/kvm-test-1-run-qemu.sh.out 2>&1 &
84 done
85 for i in $runfiles
87 while ls $i > /dev/null 2>&1
90 done
91 done
92 echo ---- All kernel runs complete. `date` | tee -a log
93 $TORTURE_JITTER_STOP