diff mbox series

[kvm-unit-tests,3/4] configure: Make the --target option available to all architectures

Message ID 20220210150943.1280146-4-alexandru.elisei@arm.com (mailing list archive)
State New, archived
Headers show
Series configure changes and rename --target-efi | expand

Commit Message

Alexandru Elisei Feb. 10, 2022, 3:09 p.m. UTC
The arm and arm64 architectures got the --target option to support running
with either qemu or kvmtool as the virtual machine manager. Make --target
valid for the other architectures, in which case qemu will be the only
valid target.

Generating the $TARGET variable in config.mak regardless of the
architecture will make adding support for another VMM to run_tests.sh
easier.

Suggested-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
---
 configure | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/configure b/configure
index 6620e78ec09c..2720b7efd64a 100755
--- a/configure
+++ b/configure
@@ -22,7 +22,7 @@  pretty_print_stacks=yes
 environ_default=yes
 u32_long=
 wa_divide=
-target=
+target=qemu
 errata_force=0
 erratatxt="$srcdir/errata.txt"
 host_key_document=
@@ -38,8 +38,8 @@  usage() {
 	Options include:
 	    --arch=ARCH            architecture to compile for ($arch)
 	    --processor=PROCESSOR  processor to compile for ($arch)
-	    --target=TARGET        target platform that the tests will be running on (qemu or
-	                           kvmtool, default is qemu) (arm/arm64 only)
+	    --target=TARGET        target platform that the tests will be running on (default is qemu)
+	                           (qemu or kvmtool for arm and arm64, qemu for all other architectures)
 	    --cross-prefix=PREFIX  cross compiler prefix
 	    --cc=CC                c compiler to use ($cc)
 	    --cflags=FLAGS         extra options to be passed to the c compiler
@@ -168,14 +168,22 @@  arch_name=$arch
 [ "$arch" = "aarch64" ] && arch="arm64"
 [ "$arch_name" = "arm64" ] && arch_name="aarch64"
 
-if [ -z "$target" ]; then
-    target="qemu"
-else
+case "$target" in
+qemu)
+    # All architectures support qemu as the target.
+    ;;
+kvmtool)
+    # Only arm and arm64 support running under kvmtool.
     if [ "$arch" != "arm64" ] && [ "$arch" != "arm" ]; then
-        echo "--target is not supported for $arch"
+        echo "--target=$target is not supported for $arch"
         usage
     fi
-fi
+    ;;
+*)
+    echo "--target=$target is not supported for $arch"
+    usage
+    ;;
+esac
 
 if [ "$target_efi" ] && [ "$arch" != "x86_64" ]; then
     echo "--target-efi is not supported for $arch"
@@ -369,10 +377,8 @@  GENPROTIMG=${GENPROTIMG-genprotimg}
 HOST_KEY_DOCUMENT=$host_key_document
 TARGET_EFI=$target_efi
 GEN_SE_HEADER=$gen_se_header
+TARGET=$target
 EOF
-if [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then
-    echo "TARGET=$target" >> config.mak
-fi
 
 cat <<EOF > lib/config.h
 #ifndef _CONFIG_H_