[PATCH kvm-unit-tests 2/2] runtime: Introduce VMM_PARAMS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Users may need to temporarily provide additional VMM parameters.
The VMM_PARAMS environment variable provides a way to do that.
We take care to make sure when executing ./run_tests.sh that
the VMM_PARAMS parameters come last, allowing unittests.cfg
parameters to be overridden. However, when running a command
line like `$ARCH/run $TEST $PARAMS` we want $PARAMS to override
$VMM_PARAMS, so we ensure that too.

Additional QEMU parameters can still be provided by appending
them to the $QEMU environment variable when it provides the
path to QEMU, but as those parameters will then be the first
in the command line they cannot override anything, and may
themselves be overridden.

Cc: Peter Maydell <peter.maydell@xxxxxxxxxx>
Cc: Alex Bennée <alex.bennee@xxxxxxxxxx>
Cc: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Cc: Laurent Vivier <lvivier@xxxxxxxxxx>
Cc: Thomas Huth <thuth@xxxxxxxxxx>
Cc: David Hildenbrand <david@xxxxxxxxxx>
Cc: Janosch Frank <frankja@xxxxxxxxxxxxx>
Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx>
---
 README.md            | 5 +++++
 arm/run              | 4 +++-
 powerpc/run          | 4 +++-
 s390x/run            | 1 +
 scripts/runtime.bash | 4 +++-
 x86/run              | 4 +++-
 6 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 396fbf809a4e..834d6202ac97 100644
--- a/README.md
+++ b/README.md
@@ -47,6 +47,11 @@ environment variable:
 
     QEMU=/tmp/qemu/x86_64-softmmu/qemu-system-x86_64 ./x86-run ./x86/msr.flat
 
+If QEMU additional parameters are needed for all tests, then they may be
+provided in the VMM_PARAMS environment variable:
+
+    VMM_PARAMS="-additional parameters -go here" ./run_tests.sh
+
 To select an accelerator, for example "kvm" or "tcg", specify the
 ACCEL=name environment variable:
 
diff --git a/arm/run b/arm/run
index 277db9bb4a02..a8a93591b825 100755
--- a/arm/run
+++ b/arm/run
@@ -60,7 +60,9 @@ fi
 
 M+=",accel=$ACCEL"
 command="$qemu -nodefaults $M -cpu $processor $chr_testdev $pci_testdev"
-command+=" -display none -serial stdio -kernel"
+command+=" -display none -serial stdio"
+command+=" $VMM_PARAMS"
+command+=" -kernel"
 command="$(timeout_cmd) $command"
 
 run_qemu $command "$@"
diff --git a/powerpc/run b/powerpc/run
index 597ab96ed8a8..b07aa18f26bf 100755
--- a/powerpc/run
+++ b/powerpc/run
@@ -23,7 +23,9 @@ fi
 M='-machine pseries'
 M+=",accel=$ACCEL"
 command="$qemu -nodefaults $M -bios $FIRMWARE"
-command+=" -display none -serial stdio -kernel"
+command+=" -display none -serial stdio"
+command+=" $VMM_PARAMS"
+command+=" -kernel"
 command="$(migration_cmd) $(timeout_cmd) $command"
 
 # powerpc tests currently exit with rtas-poweroff, which exits with 0.
diff --git a/s390x/run b/s390x/run
index 0980504448ce..9bfb95397064 100755
--- a/s390x/run
+++ b/s390x/run
@@ -19,6 +19,7 @@ M='-machine s390-ccw-virtio'
 M+=",accel=$ACCEL"
 command="$qemu -nodefaults -nographic $M"
 command+=" -chardev stdio,id=con0 -device sclpconsole,chardev=con0"
+command+=" $VMM_PARAMS"
 command+=" -kernel"
 command="$(timeout_cmd) $command"
 
diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index eb6089091e23..5ea3772d9b2b 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -30,7 +30,9 @@ premature_failure()
 get_cmdline()
 {
     local kernel=$1
-    echo "TESTNAME=$testname TIMEOUT=$timeout ACCEL=$accel $RUNTIME_arch_run $kernel -smp $smp $opts"
+
+    # Move VMM_PARAMS to the end to override parameters provided in unittests.cfg:extra_params
+    echo "VMM_PARAMS= TESTNAME=$testname TIMEOUT=$timeout ACCEL=$accel $RUNTIME_arch_run $kernel -smp $smp $opts $VMM_PARAMS"
 }
 
 skip_nodefault()
diff --git a/x86/run b/x86/run
index 1ac91f1d880f..3770c16ad4e6 100755
--- a/x86/run
+++ b/x86/run
@@ -38,7 +38,9 @@ else
 fi
 
 command="${qemu} -nodefaults $pc_testdev -vnc none -serial stdio $pci_testdev"
-command+=" -machine accel=$ACCEL -kernel"
+command+=" -machine accel=$ACCEL"
+command+=" $VMM_PARAMS"
+command+=" -kernel"
 command="$(timeout_cmd) $command"
 
 run_qemu ${command} "$@"
-- 
2.21.1





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux