Lines Matching +full:0 +full:- +full:9 +full:a +full:- +full:z

2 # SPDX-License-Identifier: GPL-2.0+
4 # Run a series of tests under KVM. By default, this series is specified
5 # by the relevant CFLIST file, but can be overridden by the --configs
6 # command-line argument.
14 scriptname=$0
17 T="`mktemp -d ${TMPDIR-/tmp}/kvm.sh.XXXXXX`"
18 trap 'rm -rf $T' 0
23 LANG=en_US.UTF-8; export LANG
55 cpus=0
56 ds=`date +%Y.%m.%d-%H.%M.%S`
57 jitter="-1"
64 echo " --allcpus"
65 echo " --bootargs kernel-boot-arguments"
66 echo " --bootimage relative-path-to-kernel-boot-image"
67 echo " --buildonly"
68 echo " --configs \"config-file list w/ repeat factor (3*TINY01)\""
69 echo " --cpus N"
70 echo " --datestamp string"
71 echo " --defconfig string"
72 echo " --debug-info"
73 echo " --dryrun batches|scenarios|sched|script"
74 echo " --duration minutes | <seconds>s | <hours>h | <days>d"
75 echo " --gdb"
76 echo " --help"
77 echo " --interactive"
78 echo " --jitter N [ maxsleep (us) [ maxspin (us) ] ]"
79 echo " --kasan"
80 echo " --kconfig Kconfig-options"
81 echo " --kcsan"
82 echo " --kmake-arg kernel-make-arguments"
83 echo " --mac nn:nn:nn:nn:nn:nn"
84 echo " --memory megabytes|nnnG"
85 echo " --no-initrd"
86 echo " --qemu-args qemu-arguments"
87 echo " --qemu-cmd qemu-system-..."
88 echo " --remote"
89 echo " --results absolute-pathname"
90 echo " --shutdown-grace seconds"
91 echo " --torture lock|rcu|rcuscale|refscale|scf|X*"
92 echo " --trust-make"
96 while test $# -gt 0
99 --allcpus)
103 --bootargs|--bootarg)
104 checkarg --bootargs "(list of kernel boot arguments)" "$#" "$2" '.*' '^--'
108 --bootimage)
109 …checkarg --bootimage "(relative path to kernel boot image)" "$#" "$2" '[a-zA-Z0-9][a-zA-Z0-9_]*' '…
113 --buildonly|--build-only)
116 --configs|--config)
117 checkarg --configs "(list of config files)" "$#" "$2" '^[^/.a-z]\+$' '^--'
121 --cpus)
122 checkarg --cpus "(number)" "$#" "$2" '^[0-9]*$' '^--'
125 if test -z "$TORTURE_REMOTE"
128 if test "$TORTURE_ALLOTED_CPUS" -gt "$max_cpus"
135 --datestamp)
136 checkarg --datestamp "(relative pathname)" "$#" "$2" '^[a-zA-Z0-9._/-]*$' '^--'
140 --debug-info|--debuginfo)
141 if test -z "$TORTURE_KCONFIG_KCSAN_ARG" && test -z "$TORTURE_BOOT_GDB_ARG"
146 echo "Ignored redundant --debug-info (implied by --kcsan &c)"
149 --defconfig)
150 checkarg --defconfig "defconfigtype" "$#" "$2" '^[^/][^/]*$' '^--'
154 --dryrun)
155 checkarg --dryrun "batches|sched|script" $# "$2" 'batches\|scenarios\|sched\|script' '^--'
159 --duration)
160 checkarg --duration "(minutes)" $# "$2" '^[0-9][0-9]*\(s\|m\|h\|d\|\)$' '^error'
162 if echo "$2" | grep -q 's$'
165 elif echo "$2" | grep -q 'h$'
168 elif echo "$2" | grep -q 'd$'
172 ts=`echo $2 | sed -e 's/[smhd]$//'`
176 --gdb)
179 TORTURE_QEMU_GDB_ARG="-s -S"; export TORTURE_QEMU_GDB_ARG
181 --help|-h)
184 --interactive)
187 --jitter)
188 …checkarg --jitter "(# threads [ sleep [ spin ] ])" $# "$2" '^-\{,1\}[0-9]\+\( \+[0-9]\+\)\{,2\} *$…
192 --kasan)
194 if test -n "$torture_qemu_mem_default"
199 --kconfig|--kconfigs)
200 …rg --kconfig "(Kconfig options)" $# "$2" '^\(#CHECK#\)\?CONFIG_[A-Z0-9_]\+=\([ynm]\|[0-9]\+\|"[^"]…
201 TORTURE_KCONFIG_ARG="`echo "$TORTURE_KCONFIG_ARG $2" | sed -e 's/^ *//' -e 's/ *$//'`"
204 --kcsan)
207 --kmake-arg|--kmake-args)
208 checkarg --kmake-arg "(kernel make arguments)" $# "$2" '.*' '^error$'
209 TORTURE_KMAKE_ARG="`echo "$TORTURE_KMAKE_ARG $2" | sed -e 's/^ *//' -e 's/ *$//'`"
212 --mac)
213 checkarg --mac "(MAC address)" $# "$2" '^\([0-9a-fA-F]\{2\}:\)\{5\}[0-9a-fA-F]\{2\}$' error
217 --memory)
218 checkarg --memory "(memory size)" $# "$2" '^[0-9]\+[MG]\?$' error
223 --no-initrd)
226 --qemu-args|--qemu-arg)
227 checkarg --qemu-args "(qemu arguments)" $# "$2" '^-' '^error'
228 TORTURE_QEMU_ARG="`echo "$TORTURE_QEMU_ARG $2" | sed -e 's/^ *//' -e 's/ *$//'`"
231 --qemu-cmd)
232 checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' '^--'
236 --remote)
239 --results)
240 checkarg --results "(absolute pathname)" "$#" "$2" '^/' '^error'
244 --shutdown-grace)
245 checkarg --shutdown-grace "(seconds)" "$#" "$2" '^[0-9]*$' '^error'
249 --torture)
250 checkarg --torture "(suite name)" "$#" "$2" '^\(lock\|rcu\|rcuscale\|refscale\|scf\|X.*\)$' '^--'
252 TORTURE_MOD="`echo $TORTURE_SUITE | sed -e 's/^\(lock\|rcu\|scf\)$/\1torture/'`"
259 jitter=0
262 --trust-make)
273 if test -n "$dryrun" || test -z "$TORTURE_INITRD" || tools/testing/selftests/rcutorture/bin/mkinitr…
284 if test -z "$configs"
289 if test -z "$resdir"
294 # Create a file of test-name/#cpus pairs, sorted by decreasing #cpus.
299 [0-9]\**|[0-9][0-9]\**|[0-9][0-9][0-9]\**|[0-9][0-9][0-9][0-9]\**)
300 config_reps=`echo $CF | sed -e 's/\*.*$//'`
301 CF1=`echo $CF | sed -e 's/^[^*]*\*//'`
308 for ((cur_rep=0;cur_rep<$config_reps;cur_rep++))
314 configs_derep="`echo $configs_derep | sed -e "s/\<CFLIST\>/$defaultconfigs/g"`"
315 if test -n "$TORTURE_KCONFIG_GDB_ARG"
317 if test "`echo $configs_derep | wc -w`" -gt 1
319 echo "The --config list is: $configs_derep."
320 echo "Only one --config permitted with --gdb, terminating."
325 for CF1 in `echo $configs_derep | tr -s ' ' '\012' | sort -u`
327 if test -f "$CONFIGFRAG/$CF1"
329 if echo "$TORTURE_KCONFIG_ARG" | grep -q '\<CONFIG_NR_CPUS='
331 echo "$TORTURE_KCONFIG_ARG" | tr -s ' ' | tr ' ' '\012' > $T/KCONFIG_ARG
340 echo "The --configs file $CF1 does not exist, terminating."
351 echo $configs_derep | awk -f $T/cfgcpu.awk > $T/cfgcpu
352 sort -k2nr $T/cfgcpu -T="$T" > $T/cfgcpu.sort
354 # Use a greedy bin-packing algorithm, sorting the list accordingly.
355 awk < $T/cfgcpu.sort > $T/cfgcpu.pack -v ncpus=$cpus '
357 njobs = 0;
368 batch = 0;
369 nc = -1;
372 # can be executed concurrently given ncpus. Note that a given test
381 for (i = 0; i < njobs; i++) {
383 continue; # Already part of a batch.
388 nc -= cpus[i];
389 if (nc <= 0)
390 break; # Too-big test in its own batch.
397 for (i = 0; i < njobs; i++)
402 # Generate a script to execute the tests in appropriate batches.
427 if ! test -e $resdir
429 mkdir -p "$resdir" || :
431 mkdir -p $resdir/$ds
440 if test -d .git
442 echo Current commit: `git rev-parse HEAD` >> $resdir/$ds/testid.txt
444 echo ' ---' Output of "'"git status"'": >> $resdir/$ds/testid.txt
448 echo ' ---' Output of "'"git diff HEAD"'": >> $resdir/$ds/testid.txt
452 kvm-assign-cpus.sh /sys/devices/system/node > $T/cpuarray.awk
453 kvm-get-cpus-script.sh $T/cpuarray.awk $T/dumpbatches.awk
456 i = 0;
468 print "echo ----Start batch " batchnum ": `date` | tee -a " rd "log";
471 njitter = 0;
473 if (ja[1] == -1 && ncpus == 0)
475 else if (ja[1] == -1)
491 if (cpusr[jn] > ncpus && ncpus != 0)
492 ovf = "-ovf";
495 print "echo ", cfr[jn], cpusr[jn] ovf ": Starting build. `date` | tee -a " rd "log";
502 if (affinitylist ~ /^[0-9,-][0-9,-]*$/)
506 …print "kvm-test-1-run.sh " CONFIGDIR cf[j], rd cfr[jn], dur " \"" TORTURE_QEMU_ARG "\" \"" TORTURE…
507 …print "echo ", cfr[jn], cpusr[jn] ovf ": Waiting for build to complete. `date` | tee -a " rd "log";
508 print "while test -f " builddir ".wait"
512 print "echo ", cfr[jn], cpusr[jn] ovf ": Build complete. `date` | tee -a " rd "log";
519 print "rm -f " builddir ".ready"
524 print "if test -f \"" rd cfr[j] "/builtkernel\""
526 print "\techo ----", cfr[j], cpusr[j] ovf ": Kernel present. `date` | tee -a " rd "log";
530 if (TORTURE_BUILDONLY && njitter != 0) {
531 njitter = 0;
532 print "echo Build-only run, so suppressing jitter | tee -a " rd "log"
537 print "if test -n \"$needqemurun\""
539 print "\techo ---- Starting kernels. `date` | tee -a " rd "log";
546 print "\techo ---- All kernel runs complete. `date` | tee -a " rd "log";
549 print "\techo ---- No kernel runs. `date` | tee -a " rd "log";
552 print "echo ----", cfr[j], cpusr[j] ovf ": Build/run results: | tee -a " rd "log";
553 print "cat " rd cfr[j] "/kvm-test-1-run.sh.out | tee -a " rd "log";
560 first = 0;
564 for (i = 0; i < njobs; i++) {
565 if (ncpus == 0) {
570 } else if (nc < cpus[i] && i != 0) {
571 # Out of CPUs, dump out a batch.
578 nc -= cpus[i];
581 if (ncpus != 0)
586 -v TORTURE_BUILDONLY="$TORTURE_BUILDONLY" \
587 -v CONFIGDIR="$CONFIGFRAG/" \
588 -v RCUTORTURE="$RCUTORTURE" \
589 -v ncpus=$cpus \
590 -v jitter="$jitter" \
591 -v rd=$resdir/$ds/ \
592 -v dur=$dur \
593 -v TORTURE_QEMU_ARG="$TORTURE_QEMU_ARG" \
594 -v TORTURE_BOOTARGS="$TORTURE_BOOTARGS" \
595 -f $T/dumpbatches.awk >> $T/script
596 echo kvm-end-run-stats.sh "$resdir/$ds" "$starttime" >> $T/script
599 grep -E 'Start batch|Starting build\.' $T/script | grep -v ">>" |
600 sed -e 's/:.*$//' -e 's/^echo //' -e 's/-ovf//' |
602 /^----Start/ {
611 grep -v '^#' $T/batches | awk '
632 exit 0
636 grep -E 'Start batch|Starting build\.' $T/script | grep -v ">>" |
637 sed -e 's/:.*$//' -e 's/^echo //'
639 grep -v ">>" | sed -e 's/:.*$//' -e 's/^echo //' |
640 awk '{ print $1 }' | grep -v '\.' | wc -l`"
642 nbatches="`grep 'Start batch' $T/script | grep -v ">>" | wc -l`"
644 exit 0
648 exit 0
652 exit 0
654 # Not a dryrun. Record the batches and the number of CPUs, then run the script.
664 # Function-graph tracing: ftrace=function_graph ftrace_graph_filter=sched_setaffinity,migration_cpu…
665 # Also --kconfig "CONFIG_FUNCTION_TRACER=y CONFIG_FUNCTION_GRAPH_TRACER=y"
666 # Control buffer size: --bootargs trace_buf_size=3k
667 # Get trace-buffer dumps on all oopses: --bootargs ftrace_dump_on_oops
668 # Ditto, but dump only the oopsing CPU: --bootargs ftrace_dump_on_oops=orig_cpu
669 # Heavy-handed way to also dump on warnings: --bootargs panic_on_warn=1