aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2014-03-06 17:44:46 -0500
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2014-05-14 12:46:04 -0400
commitf189cc8c9451aa88bc718c57aa0228d2a7555956 (patch)
treeeb38382d7002d3ab43ee254b5c20efb11d99c216 /tools/testing
parent06188731168bc73e9835f68f0490e5590947db0c (diff)
torture: Choose bzImage location based on architecture
Currently, the scripts hard-code arch/x86/boot/bzImage, which does not work well for other architectures. This commit therefore provides a identify_boot_image function that selects the correct bzImage location relative to the top of the Linux source tree. This commit also adds a --bootimage argument that allows selecting some other file, for example, "vmlinux". This change requires that the definition of the QEMU variable be computed earlier in order to identify where to look for the boot image when it comes time to copy it to the results directory. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/rcutorture/bin/functions.sh24
-rwxr-xr-xtools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh17
-rw-r--r--tools/testing/selftests/rcutorture/bin/kvm.sh8
3 files changed, 43 insertions, 6 deletions
diff --git a/tools/testing/selftests/rcutorture/bin/functions.sh b/tools/testing/selftests/rcutorture/bin/functions.sh
index 6b2adb29b073..d01b865bb100 100644
--- a/tools/testing/selftests/rcutorture/bin/functions.sh
+++ b/tools/testing/selftests/rcutorture/bin/functions.sh
@@ -76,6 +76,30 @@ configfrag_hotplug_cpu () {
76 grep -q '^CONFIG_HOTPLUG_CPU=y$' "$1" 76 grep -q '^CONFIG_HOTPLUG_CPU=y$' "$1"
77} 77}
78 78
79# identify_boot_image qemu-cmd
80#
81# Returns the relative path to the kernel build image. This will be
82# arch/<arch>/boot/bzImage unless overridden with the TORTURE_BOOT_IMAGE
83# environment variable.
84identify_boot_image () {
85 if test -n "$TORTURE_BOOT_IMAGE"
86 then
87 echo $TORTURE_BOOT_IMAGE
88 else
89 case "$1" in
90 qemu-system-x86_64|qemu-system-i386)
91 echo arch/x86/boot/bzImage
92 ;;
93 qemu-system-ppc64)
94 echo arch/powerpc/boot/bzImage
95 ;;
96 *)
97 echo ""
98 ;;
99 esac
100 fi
101}
102
79# identify_qemu builddir 103# identify_qemu builddir
80# 104#
81# Returns our best guess as to which qemu command is appropriate for 105# Returns our best guess as to which qemu command is appropriate for
diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
index cfa97e1ad8dc..2301982b8087 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
@@ -94,9 +94,17 @@ fi
94# CONFIG_YENTA=n 94# CONFIG_YENTA=n
95if kvm-build.sh $config_template $builddir $T 95if kvm-build.sh $config_template $builddir $T
96then 96then
97 QEMU="`identify_qemu $builddir/vmlinux`"
98 BOOT_IMAGE="`identify_boot_image $QEMU`"
97 cp $builddir/Make*.out $resdir 99 cp $builddir/Make*.out $resdir
98 cp $builddir/.config $resdir 100 cp $builddir/.config $resdir
99 cp $builddir/arch/x86/boot/bzImage $resdir 101 if test -n "$BOOT_IMAGE"
102 then
103 cp $builddir/$BOOT_IMAGE $resdir
104 else
105 echo No identifiable boot image, not running KVM, see $resdir.
106 echo Do the torture scripts know about your architecture?
107 fi
100 parse-build.sh $resdir/Make.out $title 108 parse-build.sh $resdir/Make.out $title
101 if test -f $builddir.wait 109 if test -f $builddir.wait
102 then 110 then
@@ -124,9 +132,6 @@ cd $KVM
124kstarttime=`awk 'BEGIN { print systime() }' < /dev/null` 132kstarttime=`awk 'BEGIN { print systime() }' < /dev/null`
125echo ' ---' `date`: Starting kernel 133echo ' ---' `date`: Starting kernel
126 134
127# Determine the appropriate flavor of qemu command.
128QEMU="`identify_qemu $builddir/vmlinux`"
129
130# Generate -smp qemu argument. 135# Generate -smp qemu argument.
131qemu_args="-nographic $qemu_args" 136qemu_args="-nographic $qemu_args"
132cpu_count=`configNR_CPUS.sh $config_template` 137cpu_count=`configNR_CPUS.sh $config_template`
@@ -151,13 +156,13 @@ boot_args="`configfrag_boot_params "$boot_args" "$config_template"`"
151# Generate kernel-version-specific boot parameters 156# Generate kernel-version-specific boot parameters
152boot_args="`per_version_boot_params "$boot_args" $builddir/.config $seconds`" 157boot_args="`per_version_boot_params "$boot_args" $builddir/.config $seconds`"
153 158
154echo $QEMU $qemu_args -m 512 -kernel $builddir/arch/x86/boot/bzImage -append \"$qemu_append $boot_args\" > $resdir/qemu-cmd 159echo $QEMU $qemu_args -m 512 -kernel $builddir/$BOOT_IMAGE -append \"$qemu_append $boot_args\" > $resdir/qemu-cmd
155if test -n "$TORTURE_BUILDONLY" 160if test -n "$TORTURE_BUILDONLY"
156then 161then
157 echo Build-only run specified, boot/test omitted. 162 echo Build-only run specified, boot/test omitted.
158 exit 0 163 exit 0
159fi 164fi
160( $QEMU $qemu_args -m 512 -kernel $builddir/arch/x86/boot/bzImage -append "$qemu_append $boot_args"; echo $? > $resdir/qemu-retval ) & 165( $QEMU $qemu_args -m 512 -kernel $builddir/$BOOT_IMAGE -append "$qemu_append $boot_args"; echo $? > $resdir/qemu-retval ) &
161qemu_pid=$! 166qemu_pid=$!
162commandcompleted=0 167commandcompleted=0
163echo Monitoring qemu job at pid $qemu_pid 168echo Monitoring qemu job at pid $qemu_pid
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 37960d707d3e..468d92f94e7f 100644
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -39,6 +39,7 @@ dryrun=""
39KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM 39KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM
40PATH=${KVM}/bin:$PATH; export PATH 40PATH=${KVM}/bin:$PATH; export PATH
41TORTURE_DEFCONFIG=defconfig 41TORTURE_DEFCONFIG=defconfig
42TORTURE_BOOT_IMAGE=""
42TORTURE_INITRD="$KVM/initrd"; export TORTURE_INITRD 43TORTURE_INITRD="$KVM/initrd"; export TORTURE_INITRD
43TORTURE_KMAKE_ARG="" 44TORTURE_KMAKE_ARG=""
44TORTURE_SUITE=rcu 45TORTURE_SUITE=rcu
@@ -53,6 +54,7 @@ kversion=""
53usage () { 54usage () {
54 echo "Usage: $scriptname optional arguments:" 55 echo "Usage: $scriptname optional arguments:"
55 echo " --bootargs kernel-boot-arguments" 56 echo " --bootargs kernel-boot-arguments"
57 echo " --bootimage relative-path-to-kernel-boot-image"
56 echo " --buildonly" 58 echo " --buildonly"
57 echo " --configs \"config-file list\"" 59 echo " --configs \"config-file list\""
58 echo " --cpus N" 60 echo " --cpus N"
@@ -80,6 +82,11 @@ do
80 TORTURE_BOOTARGS="$2" 82 TORTURE_BOOTARGS="$2"
81 shift 83 shift
82 ;; 84 ;;
85 --bootimage)
86 checkarg --bootimage "(relative path to kernel boot image)" "$#" "$2" '[a-zA-Z0-9][a-zA-Z0-9_]*' '^--'
87 TORTURE_BOOT_IMAGE="$2"
88 shift
89 ;;
83 --buildonly) 90 --buildonly)
84 TORTURE_BUILDONLY=1 91 TORTURE_BUILDONLY=1
85 ;; 92 ;;
@@ -245,6 +252,7 @@ CONFIGFRAG="$CONFIGFRAG"; export CONFIGFRAG
245KVM="$KVM"; export KVM 252KVM="$KVM"; export KVM
246KVPATH="$KVPATH"; export KVPATH 253KVPATH="$KVPATH"; export KVPATH
247PATH="$PATH"; export PATH 254PATH="$PATH"; export PATH
255TORTURE_BOOT_IMAGE="$TORTURE_BOOT_IMAGE"; export TORTURE_BOOT_IMAGE
248TORTURE_BUILDONLY="$TORTURE_BUILDONLY"; export TORTURE_BUILDONLY 256TORTURE_BUILDONLY="$TORTURE_BUILDONLY"; export TORTURE_BUILDONLY
249TORTURE_DEFCONFIG="$TORTURE_DEFCONFIG"; export TORTURE_DEFCONFIG 257TORTURE_DEFCONFIG="$TORTURE_DEFCONFIG"; export TORTURE_DEFCONFIG
250TORTURE_INITRD="$TORTURE_INITRD"; export TORTURE_INITRD 258TORTURE_INITRD="$TORTURE_INITRD"; export TORTURE_INITRD