aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/rcutorture/bin/functions.sh
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2013-09-30 20:17:57 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2013-12-03 13:11:14 -0500
commit4f8a031279f5c17ad76b6833c64b8f86a450ebda (patch)
treecb938ffe50dd57b2cdb5ef4457eaf6a1e750f69a /tools/testing/selftests/rcutorture/bin/functions.sh
parent50d48a1d154ef9ece016512817dbbd33c598f162 (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>
Diffstat (limited to 'tools/testing/selftests/rcutorture/bin/functions.sh')
-rw-r--r--tools/testing/selftests/rcutorture/bin/functions.sh27
1 files changed, 27 insertions, 0 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.
59identify_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}