diff options
| author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-03-06 17:44:46 -0500 |
|---|---|---|
| committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-05-14 12:46:04 -0400 |
| commit | f189cc8c9451aa88bc718c57aa0228d2a7555956 (patch) | |
| tree | eb38382d7002d3ab43ee254b5c20efb11d99c216 /tools/testing | |
| parent | 06188731168bc73e9835f68f0490e5590947db0c (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.sh | 24 | ||||
| -rwxr-xr-x | tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh | 17 | ||||
| -rw-r--r-- | tools/testing/selftests/rcutorture/bin/kvm.sh | 8 |
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. | ||
| 84 | identify_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 |
| 95 | if kvm-build.sh $config_template $builddir $T | 95 | if kvm-build.sh $config_template $builddir $T |
| 96 | then | 96 | then |
| 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 | |||
| 124 | kstarttime=`awk 'BEGIN { print systime() }' < /dev/null` | 132 | kstarttime=`awk 'BEGIN { print systime() }' < /dev/null` |
| 125 | echo ' ---' `date`: Starting kernel | 133 | echo ' ---' `date`: Starting kernel |
| 126 | 134 | ||
| 127 | # Determine the appropriate flavor of qemu command. | ||
| 128 | QEMU="`identify_qemu $builddir/vmlinux`" | ||
| 129 | |||
| 130 | # Generate -smp qemu argument. | 135 | # Generate -smp qemu argument. |
| 131 | qemu_args="-nographic $qemu_args" | 136 | qemu_args="-nographic $qemu_args" |
| 132 | cpu_count=`configNR_CPUS.sh $config_template` | 137 | cpu_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 |
| 152 | boot_args="`per_version_boot_params "$boot_args" $builddir/.config $seconds`" | 157 | boot_args="`per_version_boot_params "$boot_args" $builddir/.config $seconds`" |
| 153 | 158 | ||
| 154 | echo $QEMU $qemu_args -m 512 -kernel $builddir/arch/x86/boot/bzImage -append \"$qemu_append $boot_args\" > $resdir/qemu-cmd | 159 | echo $QEMU $qemu_args -m 512 -kernel $builddir/$BOOT_IMAGE -append \"$qemu_append $boot_args\" > $resdir/qemu-cmd |
| 155 | if test -n "$TORTURE_BUILDONLY" | 160 | if test -n "$TORTURE_BUILDONLY" |
| 156 | then | 161 | then |
| 157 | echo Build-only run specified, boot/test omitted. | 162 | echo Build-only run specified, boot/test omitted. |
| 158 | exit 0 | 163 | exit 0 |
| 159 | fi | 164 | fi |
| 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 ) & |
| 161 | qemu_pid=$! | 166 | qemu_pid=$! |
| 162 | commandcompleted=0 | 167 | commandcompleted=0 |
| 163 | echo Monitoring qemu job at pid $qemu_pid | 168 | echo 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="" | |||
| 39 | KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM | 39 | KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM |
| 40 | PATH=${KVM}/bin:$PATH; export PATH | 40 | PATH=${KVM}/bin:$PATH; export PATH |
| 41 | TORTURE_DEFCONFIG=defconfig | 41 | TORTURE_DEFCONFIG=defconfig |
| 42 | TORTURE_BOOT_IMAGE="" | ||
| 42 | TORTURE_INITRD="$KVM/initrd"; export TORTURE_INITRD | 43 | TORTURE_INITRD="$KVM/initrd"; export TORTURE_INITRD |
| 43 | TORTURE_KMAKE_ARG="" | 44 | TORTURE_KMAKE_ARG="" |
| 44 | TORTURE_SUITE=rcu | 45 | TORTURE_SUITE=rcu |
| @@ -53,6 +54,7 @@ kversion="" | |||
| 53 | usage () { | 54 | usage () { |
| 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 | |||
| 245 | KVM="$KVM"; export KVM | 252 | KVM="$KVM"; export KVM |
| 246 | KVPATH="$KVPATH"; export KVPATH | 253 | KVPATH="$KVPATH"; export KVPATH |
| 247 | PATH="$PATH"; export PATH | 254 | PATH="$PATH"; export PATH |
| 255 | TORTURE_BOOT_IMAGE="$TORTURE_BOOT_IMAGE"; export TORTURE_BOOT_IMAGE | ||
| 248 | TORTURE_BUILDONLY="$TORTURE_BUILDONLY"; export TORTURE_BUILDONLY | 256 | TORTURE_BUILDONLY="$TORTURE_BUILDONLY"; export TORTURE_BUILDONLY |
| 249 | TORTURE_DEFCONFIG="$TORTURE_DEFCONFIG"; export TORTURE_DEFCONFIG | 257 | TORTURE_DEFCONFIG="$TORTURE_DEFCONFIG"; export TORTURE_DEFCONFIG |
| 250 | TORTURE_INITRD="$TORTURE_INITRD"; export TORTURE_INITRD | 258 | TORTURE_INITRD="$TORTURE_INITRD"; export TORTURE_INITRD |
