diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2013-09-30 20:17:57 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2013-12-03 13:11:14 -0500 |
commit | 4f8a031279f5c17ad76b6833c64b8f86a450ebda (patch) | |
tree | cb938ffe50dd57b2cdb5ef4457eaf6a1e750f69a | |
parent | 50d48a1d154ef9ece016512817dbbd33c598f162 (diff) |
rcutorture: Abstract qemu-flavor identification
The task of working out which flavor of qemu to use gets more complex
as more types of CPUs are supported. Adding Power makes three in addition
to 32-bit and 64-bit x86, so it is time to pull this out into a function.
This commit therefore creates an identify_qemu function and also adds
a --qemu-cmd command-line argument for the inevitable case where the
identify_qemu cannot figure it out.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
-rw-r--r-- | tools/testing/selftests/rcutorture/bin/functions.sh | 27 | ||||
-rwxr-xr-x | tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh | 9 | ||||
-rw-r--r-- | tools/testing/selftests/rcutorture/bin/kvm.sh | 6 |
3 files changed, 36 insertions, 6 deletions
diff --git a/tools/testing/selftests/rcutorture/bin/functions.sh b/tools/testing/selftests/rcutorture/bin/functions.sh index 8f912419ed7f..c974414ef7a5 100644 --- a/tools/testing/selftests/rcutorture/bin/functions.sh +++ b/tools/testing/selftests/rcutorture/bin/functions.sh | |||
@@ -51,3 +51,30 @@ configfrag_hotplug_cpu () { | |||
51 | fi | 51 | fi |
52 | grep -q '^CONFIG_HOTPLUG_CPU=y$' "$1" | 52 | grep -q '^CONFIG_HOTPLUG_CPU=y$' "$1" |
53 | } | 53 | } |
54 | |||
55 | # identify_qemu builddir | ||
56 | # | ||
57 | # Returns our best guess as to which qemu command is appropriate for | ||
58 | # the kernel at hand. Override with the RCU_QEMU_CMD environment variable. | ||
59 | identify_qemu () { | ||
60 | local u="`file "$1"`" | ||
61 | if test -n "$RCU_QEMU_CMD" | ||
62 | then | ||
63 | echo $RCU_QEMU_CMD | ||
64 | elif echo $u | grep -q x86-64 | ||
65 | then | ||
66 | echo qemu-system-x86_64 | ||
67 | elif echo $u | grep -q "Intel 80386" | ||
68 | then | ||
69 | echo qemu-system-i386 | ||
70 | elif uname -a | grep -q ppc64 | ||
71 | then | ||
72 | echo qemu-system-ppc64 | ||
73 | else | ||
74 | echo Cannot figure out what qemu command to use! 1>&2 | ||
75 | # Usually this will be one of /usr/bin/qemu-system-* | ||
76 | # Use RCU_QEMU_CMD environment variable or appropriate | ||
77 | # argument to top-level script. | ||
78 | exit 1 | ||
79 | fi | ||
80 | } | ||
diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh index 5526550a5d56..ddf3bd6eaf19 100755 --- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh +++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh | |||
@@ -109,12 +109,9 @@ boot_args=$6 | |||
109 | cd $KVM | 109 | cd $KVM |
110 | kstarttime=`awk 'BEGIN { print systime() }' < /dev/null` | 110 | kstarttime=`awk 'BEGIN { print systime() }' < /dev/null` |
111 | echo ' ---' `date`: Starting kernel | 111 | echo ' ---' `date`: Starting kernel |
112 | if file linux-2.6/*.o | grep -q 64-bit | 112 | |
113 | then | 113 | # Determine the appropriate flavor of qemu command. |
114 | QEMU=qemu-system-x86_64 | 114 | QEMU="`identify_qemu $builddir/vmlinux.o`" |
115 | else | ||
116 | QEMU=qemu-system-i386 | ||
117 | fi | ||
118 | 115 | ||
119 | # Generate -smp qemu argument. | 116 | # Generate -smp qemu argument. |
120 | cpu_count=`configNR_CPUS.sh $config_template` | 117 | cpu_count=`configNR_CPUS.sh $config_template` |
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh b/tools/testing/selftests/rcutorture/bin/kvm.sh index bf6d68e96e94..89164c245ca1 100644 --- a/tools/testing/selftests/rcutorture/bin/kvm.sh +++ b/tools/testing/selftests/rcutorture/bin/kvm.sh | |||
@@ -45,6 +45,7 @@ usage () { | |||
45 | echo " --datestamp string" | 45 | echo " --datestamp string" |
46 | echo " --duration minutes" | 46 | echo " --duration minutes" |
47 | echo " --kversion vN.NN" | 47 | echo " --kversion vN.NN" |
48 | echo " --qemu-cmd qemu-system-..." | ||
48 | echo " --rcu-kvm absolute-pathname" | 49 | echo " --rcu-kvm absolute-pathname" |
49 | echo " --results absolute-pathname" | 50 | echo " --results absolute-pathname" |
50 | echo " --relbuilddir relative-pathname" | 51 | echo " --relbuilddir relative-pathname" |
@@ -101,6 +102,11 @@ do | |||
101 | kversion=$2 | 102 | kversion=$2 |
102 | shift | 103 | shift |
103 | ;; | 104 | ;; |
105 | --qemu-cmd) | ||
106 | checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' '^--' | ||
107 | RCU_QEMU_CMD="$2"; export RCU_QEMU_CMD | ||
108 | shift | ||
109 | ;; | ||
104 | --rcu-kvm) | 110 | --rcu-kvm) |
105 | checkarg --rcu-kvm "(absolute pathname)" "$#" "$2" '^/' error | 111 | checkarg --rcu-kvm "(absolute pathname)" "$#" "$2" '^/' error |
106 | KVM=$2; export KVM | 112 | KVM=$2; export KVM |