summaryrefslogtreecommitdiff
path: root/tests/vm/basevm.py
AgeCommit message (Collapse)Author
2019-02-22Introduce a Python module structureCleber Rosa
This is a simple move of Python code that wraps common QEMU functionality, and are used by a number of different tests and scripts. By treating that code as a real Python module, we can more easily: * reuse code * have a proper place for the module's own unittests * apply a more consistent style * generate documentation Signed-off-by: Cleber Rosa <crosa@redhat.com> Reviewed-by: Caio Carrara <ccarrara@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20190206162901.19082-2-crosa@redhat.com> Signed-off-by: Cleber Rosa <crosa@redhat.com>
2019-02-08tests/vm: add --build-target optionAlex Bennée
This allows us to invoke the build with a custom target (for the VMs that use the {target} format string specifier). Currently OpenBSD is still hardwired due to problems running check. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2018-10-26tests/vm: Do not abuse parallelism when HOST != TARGET architecturePhilippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20181013004034.6968-9-f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com>
2018-10-26tests/vm: Do not use -enable-kvm if HOST != TARGET architecturePhilippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20181013004034.6968-8-f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com>
2018-10-26tests/vm: Add a BaseVM::arch propertyPhilippe Mathieu-Daudé
The 'arch' property gives a hint on which architecture the guest image runs. This can be use to select the correct QEMU binary path. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20181013004034.6968-6-f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com>
2018-10-26tests/vm: Display remaining seconds to wait for a VM to startPhilippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20181013004034.6968-5-f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com>
2018-10-26tests/vm: Do not use the -smp option with a single cpuPhilippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20181013004034.6968-4-f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com>
2018-10-26tests/vm: Do not abuse parallelism when KVM is not availablePhilippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20181013004034.6968-3-f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com>
2018-10-26tests/vm: Extract the kvm_available() handy functionPhilippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20181013004034.6968-2-f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com>
2018-09-26tests/vm: Use -cpu max rather than -cpu hostPeter Maydell
-cpu max works with any accelerator, so we don't need to use it only conditionally if not using KVM. Just use it all the time. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20180820155554.23476-1-peter.maydell@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com>
2018-08-24tests/vm: Increase timeout waiting for VM to boot to 5 minutesPeter Maydell
The VM tests currently have a timeout of 2 minutes for trying to connect to ssh. Since the guest VM has to boot from cold to the point of accepting inbound ssh during this time, if the host machine is heavily loaded it can spuriously time out. Increase the timeout from 2 to 5 minutes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Acked-by: Fam Zheng <famz@redhat.com> Message-id: 20180823112153.15279-1-peter.maydell@linaro.org
2018-08-15tests/vm: Bump guest RAM up from 2G to 4GPeter Maydell
Currently we run the guests in a VM which is given only 2G of RAM. Since the guests are configured without any swap space, builds can fail because the system runs out of memory and kills the compiler, especially if the job count is set for a lot of parallelism. Bump the setting up from 2G to 4G to give us some more headroom. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20180803085230.30574-5-peter.maydell@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com>
2018-08-15tests/vm: Propagate V=1 down into the make inside the VMPeter Maydell
Invoking 'make vm-build-freebsd' and friends with V=1 should propagate that verbosity setting down into the build run inside the VM. Make sure we do that. This brings it into line with how the container tests handle V=1. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20180803085230.30574-4-peter.maydell@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com>
2018-08-15tests: Add an option for snapshot (default: off)Fam Zheng
Not using snapshot has the benefit of automatically persisting useful test harnesses, such as docker images and ccache database. Although it will lose some cleanness, it is imaginably useful for patchew. Signed-off-by: Fam Zheng <famz@redhat.com> Message-Id: <20180712012829.20231-2-famz@redhat.com> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Fam Zheng <famz@redhat.com>
2018-08-15tests/vm: Only use -cpu 'host' if KVM is availablePhilippe Mathieu-Daudé
If KVM is not available, then use the 'max' cpu. This fixes: ERROR:root:Log: ERROR:root:qemu-system-x86_64: CPU model 'host' requires KVM Failed to prepare guest environment error: [Errno 104] Connection reset by peer source/qemu/tests/vm/Makefile.include:25: recipe for target 'tests/vm/ubuntu.i386.img' failed make: *** [tests/vm/ubuntu.i386.img] Error 2 Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180628153535.1411-4-f4bug@amsat.org> Signed-off-by: Fam Zheng <famz@redhat.com>
2018-06-08python: futurize -f libfuturize.fixes.fix_print_with_importEduardo Habkost
Change all Python code to use print as a function. This is necessary for Python 3 compatibility. Done using: $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ sort -u | grep -v README.sh4) $ futurize -w -f libfuturize.fixes.fix_print_with_import $py Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Acked-by: Fam Zheng <famz@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20180608122952.2009-2-ehabkost@redhat.com> [ehabkost: fixup tests/docker/docker.py] Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2018-04-09tests: Fix ubuntu.i386 image initializationFam Zheng
The apt-get commands we run through ssh expect certain features of the tty, and refuses to work if /dev/null is used. It is ugly, but easy to satisfy. Actually, there is no reason to hide the output. It just makes things harder to diagnose. We can always redirect in the Makefile, so don't do it conditionally here. Reported-by: Eric Blake <eblake@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com> Message-Id: <20180322034753.6301-1-famz@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Eric Blake <eblake@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com>
2017-10-11basevm: Call logging.basicConfig()Eduardo Habkost
Just setting level=DEBUG when debug is enabled is not enough: we need to set up a log handler if we want debug messages generated using logging.getLogger(...).debug() to be printed. This was not a problem before because logging.debug() calls logging.basicConfig() implicitly, but it's safer to not rely on that. Cc: "Alex Bennée" <alex.bennee@linaro.org> Cc: Fam Zheng <famz@redhat.com> Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20170927130339.21444-4-ehabkost@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Lukáš Doktor <ldoktor@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2017-09-22tests: Add vm test libFam Zheng
This is the common code to implement a "VM test" to 1) Download and initialize a pre-defined VM that has necessary dependencies to build QEMU and SSH access. 2) Archive $SRC_PATH to a .tar file. 3) Boot the VM, and pass the source tar file to the guest. 4) SSH into the VM, untar the source tarball, build from the source. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>