Commit Graph

426 Commits

Author SHA1 Message Date
Michael Zhao
f060ecd705 tests: Unblock some vhost-user tests
Signed-off-by: Michael Zhao <michael.zhao@arm.com>
2021-06-11 11:03:08 +02:00
Henry Wang
31e4d80caf tests: Enable AArch64 API pause/resume test case
Signed-off-by: Henry Wang <Henry.Wang@arm.com>
2021-06-11 09:05:54 +02:00
Michael Zhao
7cfb2139d0 tests: Enable pty test case on AArch64
Signed-off-by: Michael Zhao <michael.zhao@arm.com>
2021-06-10 15:05:25 +02:00
Michael Zhao
97307a7fc1 tests: Remove test_aarch64_pe_boot case
test_aarch64_pe_boot was added at the very beginning of AArch64 support.
Now it can be combined to test_vmlinux_boot.

Renamed test_vmlinux_boot to test_direct_kernel_boot for generality.

Signed-off-by: Michael Zhao <michael.zhao@arm.com>
2021-06-10 10:10:53 +02:00
Michael Zhao
6ed1f83a87 tests: Enable the boot_noacpi case on AArch64
Enabled test case test_vmlinux_boot_noacpi on AArch64 and renamed it
test_direct_kernel_boot_noacpi for generality.

Signed-off-by: Michael Zhao <michael.zhao@arm.com>
2021-06-10 10:10:53 +02:00
Michael Zhao
04aff2e2f9 tests: Enable test_console_file case on AArch64
This test case could have been ready on AArch64 since the serial issue
was fixed.

Signed-off-by: Michael Zhao <michael.zhao@arm.com>
2021-06-10 10:10:53 +02:00
Sebastien Boeuf
9dba097224 ci: Update guest cloud image by installing "stress" utility
Some new integration tests will require the "stress" binary to be
present in the guest in order to run correctly.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-06-09 14:34:55 +01:00
Michael Zhao
ce5c5833cb tests: Add a simple test case for ACPI on AArch64
In the test case, the guest boots from EDK2.

Signed-off-by: Michael Zhao <michael.zhao@arm.com>
2021-06-09 18:36:59 +08:00
Sebastien Boeuf
bb68e0bc3b tests: Re-enable virtiofsd tests
Re-enable virtiofsd testing now that issues with capstone repository
have been resolved.

This reverts commit a14c70019a.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-06-08 20:13:41 +02:00
Sebastien Boeuf
1e2aa769e5 test_infra, tests: Introduce exec_host_command_output() function
This new function allows for better readability of the code by
factorizing a few of lines of code into a single one.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-06-04 16:25:41 +02:00
Sebastien Boeuf
8091c28dd5 tests: Make sure exec_host_command_status() succeeds
It's important to verify the actual exit code returned from the new
function exec_host_command_status() to ensure the command ran
successfully.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-06-04 16:25:41 +02:00
Sebastien Boeuf
eca1df4e2d test_infra, tests: Introduce exec_host_command_status() function
This new function allows for better readability of the code by
factorizing a bunch of lines of code into a single one.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-06-04 16:25:41 +02:00
Sebastien Boeuf
3d8728488d tests: Remove ssh_command_ok()
There's no need for ssh_command_ok() anymore since ssh_command() now
returns an error in case the executed command returned with an exit code
different than 0.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-06-04 16:25:41 +02:00
Sebastien Boeuf
b443900cc2 tests: Extend OVS DPDK test with reconnection
Make sure the reconnection functionaliity is well tested from the OVS
DPDK integration test.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-06-04 11:13:44 +02:00
Sebastien Boeuf
8fad60bada tests: Improve OVS DPDK integration test
In order to simplify and speed up the OVS DPDK test, we switch from
using 'iperf3' to 'netcat' to validate the connectivity is functional.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-06-04 11:13:44 +02:00
Sebastien Boeuf
2e8a552c24 tests: Use OVS DPDK in client mode
Since OVS DPDK deprecated the use for the server mode, let's make sure
the integration test uses the client mode instead. This means the OVS
backend is the client and the VMM acts as the server, therefore the
reason why we use "vhost_mode=server".

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-06-04 11:13:44 +02:00
Sebastien Boeuf
7c917c0e74 tests: Re-enable test_ovs_dpdk
Re-enable the OVS DPDK integration test by assigning both VMs to the
NUMA node 0. This ensures the processes are being run on NUMA node 0,
preventing OVS DPDK from abnormal functioning.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-06-04 11:13:44 +02:00
Rob Bradford
0ccb597baf tests: Adapt commands for new SSH non-zero exit behaviour
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-06-03 13:28:25 -07:00
Rob Bradford
a3cbc1ff72 tests: Use sudo when testing disks with dd
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-06-03 13:28:25 -07:00
Rob Bradford
a14c70019a tests: Don't test virtiofsd
The CI is failing due the git server that the submodules required for
this fork of QEMU need to build from is unavailable.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
(cherry picked from commit 2aec0a92a5)
2021-06-02 16:12:30 +02:00
Rob Bradford
9341cce8b3 tests: Temporarily disable test_ovs_dpdk
This test is flaking out regularly, particularly on the musl build.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-06-01 17:46:58 +02:00
Sebastien Boeuf
4db7530f28 ci: Add OVS-DPDK integration test
In order to avoid regression regarding OVS-DPDK support, a new
integration test is added. This test consists of running two VMs, both
attached to a distinct OVS port, where both ports are connected to an
OVS bridge. Once the VM are running, the test validates the connection
between the two VMs works correctly.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-06-01 12:17:23 +02:00
Sebastien Boeuf
239e2adc68 tests: Introduce ssh_command_ok()
Adding a new function ssh_command_ok() as a wrapper around the existing
ssh_command() function. The goal being to identify if the command
returned without any error.

This new function allow for a bit of factorization through the codebase.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-06-01 12:17:23 +02:00
Anatol Belski
56b9149325 tests: Pull common code into a separate method
Yet another small refactoring step for WindowsGuest
after f56471566b.

For this particular case - there's currently neither overloading nor
default argument support in Rust (except a macro or other tricky stuff),
so keep the timeout and other options default for now.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2021-05-19 16:41:08 +01:00
Anatol Belski
01e2826f26 tests: Implement disk hotplug test
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2021-05-19 10:39:46 +02:00
Sebastien Boeuf
ae4e01adc9 tests: vfio: Increase time for memory hotplug
Bump the sleep time before checking the guest RAM size from 10 to 30
seconds. This will help the VFIO baremetal CI passing more consistently.

Fixes #2606

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-05-07 18:44:31 +02:00
Rob Bradford
6d6cafafb2 tests: Fix clippy issues in integration tests
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-05-07 14:31:57 +02:00
Sebastien Boeuf
5268bf5a8c tests: Re-enable virtiofsd tests
Re-enable virtiofsd testing now that issues with capstone repository
have been resolved.

This reverts commit 2aec0a92a5.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-05-07 11:16:36 +02:00
Wei Liu
c439324451 tests: add a Windows multiple queues test
Create as many queues as there are boot CPUs for block and twice as many
for net.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
2021-05-07 08:57:13 +02:00
Sebastien Boeuf
66b46a277e tests: Remove unused code from Windows integration tests
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-05-07 08:57:13 +02:00
Sebastien Boeuf
9adfc04f75 tests: Wait for dnsmasq process to terminate
Make sure the dnsmasq process terminates after we sent the kill signal.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-05-07 08:57:13 +02:00
Sebastien Boeuf
0a00df2e7e tests: Dynamically assign IPs for Windows integration tests
Relying on dnsmasq running on the host, the Windows guest are now
getting allocated with the expected IP addresses. This allows for
multiple VMs, therefore multiple tests to run in parallel.

The end goal is to reduce the time spent running Windows integration
tests.

Fixes #1891

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-05-06 17:27:33 +02:00
Sebastien Boeuf
aa76c9db2e tests: Rename Windows specific functions
Let's keep the function names as simple as possible.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-05-06 15:17:27 +02:00
Sebastien Boeuf
f56471566b tests: Introduce WindowsGuest structure for further factorization
This new wrapping structure allows for a better factorization of the
Windows specific code. This makes each test simpler and easier to read.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-05-06 15:17:27 +02:00
Sebastien Boeuf
14544d64e4 tests: Factorize shutdown and reboot functions for Windows
Add some factorization for both functions rebooting and shutting down a
Windows guest.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-05-06 15:17:27 +02:00
Sebastien Boeuf
2646b24047 tests: Remove references from Guest and DiskConfig
By using a Box around the DiskConfig trait, it becomes Sized. For that
reason, we can pass the DiskConfig to the Guest so that it can own it.
This allows for further simplification as the Guest does not need to be
bound to a specific lifetime, which makes things easier.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-05-06 15:17:27 +02:00
Sebastien Boeuf
b2b577257f tests: Add integration test for vhost-user-net client mode
Refactor the existing vhost-user-net integration tests in order to
extend it with an extra test for vhost-user client mode.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-05-05 16:05:51 +02:00
Sebastien Boeuf
b5be62a167 tests: Extend VFIO baremetal integration tests
Relying on guest Ubuntu image 21.04, including a 5.11 kernel, this patch
adds some additional tests to the VFIO baremetal integration tests. It
adds a test for ACPI memory hotplug, another one for virtio-mem memory
hotplug, and finally a test for hotplugging the NVIDIA card.

The existing test already taking care of the reboot has been renamed.

The script running "cargo test" has been modified to run only one thread
at a time, so that each test run sequentially. This is mandatory since
the card can't be shared across multiple VMs.

Fixes #2404

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-05-04 15:01:29 +02:00
Sebastien Boeuf
6eaf44ec61 tests: Update journalctl command to get reboot count
In order to support most recent Ubuntu distributions, we must update
the way of detecting a reboot through the journal since there is no
more "-- Reboot --" logs.

Using the `--list-boots` option is the preferred way for getting the
boot count information from journalctl command. We simply need to add 1
to the count in order to get the reboot count.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-05-04 15:01:29 +02:00
Sebastien Boeuf
8ee0377456 tests: Update VFIO baremetal test to rely on Ubuntu 21.04
Moving to latest Ubuntu version as the guest image is needed to move to
more recent guest kernel (5.11). With more recent kernels, we'll be able
to add hotplug and virtio-mem tests to the VFIO baremetal CI.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-05-04 15:01:29 +02:00
Rob Bradford
2aec0a92a5 tests: Don't test virtiofsd
The CI is failing due the git server that the submodules required for
this fork of QEMU need to build from is unavailable.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-05-04 12:14:37 +01:00
Rob Bradford
1f4a34ffc8 tests: Remove last tests using bzImage
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-30 16:16:48 +02:00
Sebastien Boeuf
ed54036bfb tests: Fix reboot by allowing specifying the custom timeout
test_reboot became flaky after the refactoring of the VM reboot code.
This is because we removed the ability to specify a custom timeout.
This patch fixes the issue by allowing a custom timeout of 120s to be
set.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-04-29 11:10:40 +01:00
Sebastien Boeuf
b31589f6bc tests: Factorize memory hotplug enabling
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-04-28 17:48:10 +02:00
Sebastien Boeuf
d30de8ecee tests: Add reboot validation to VFIO baremetal testing
Make sure the VFIO baremetal tests are still passing correctly after the
guest is rebooted.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-04-28 17:48:10 +02:00
Sebastien Boeuf
d203c62b42 tests: Factorize a few functions
Factorize NVIDIA GPU checks into its own function so that it can be
reused.

Factorize linux guest reboot into its own function to reduce the amount
of code.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-04-28 17:48:10 +02:00
Rob Bradford
7367ca70c2 tests: Don't build separate pvh/non-pvh vmlinux binary
Use the PVH vmlinux for all tests (with the exception of the specific
bzImage test.)

See: #2231

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-28 10:40:31 +02:00
Sebastien Boeuf
fdcfec081b tests: Fix test_vfio
The new kernel 5.12 requires the devices to be manually bound to
vfio-pci while adding a new_id is only needed once per
device_id:vendor_id pair.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-04-28 09:02:01 +02:00
Anatol Belski
87a4f4ae32 tests: Disable test_windows_* for mshv
It appears that mshv is not yet there to succeed with these tests. It is
suggested to ignore them and enable later one by one as the
functionality gets fixed.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2021-04-23 17:57:28 +02:00
Anatol Belski
ac3414503c tests: Implement test for net dev hotplug for Windows guest
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2021-04-22 11:42:43 -07:00
Rob Bradford
fd72612e91 tests: Extend test_tap_from_fd to reboot
Check that the VM comes back with the correct network setup after a
reboot.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-22 12:19:01 +02:00
Bo Chen
99694cf5c1 tests: Simplify 'test_memory_mergeable'
We now reply on the value from '/sys/kernel/mm/ksm/shared_pages' to
validate our "--memory mergeable=on|off" option. For `mergeable=on`,
we are expecting to see more 'shared_pages' reported by the kernel when
we start more VMs with this option. For `mergeable=off`, we are
expecting the 'shared_pages' value to be always 0, as we are assuming
the rest of the system (in our CI) is not using mergeable memory.

Fixes: #2138

Signed-off-by: Bo Chen <chen.bo@intel.com>
2021-04-13 09:00:00 +02:00
Anatol Belski
e1cc702327 memory_manager: Fix address range calculation in MemorySlot
The MCRS method returns a 64-bit memory range descriptor. The
calculation is supposed to be done as follows:

max = min + len - 1

However, every operand is represented not as a QWORD but as combination
of two DWORDs for high and low part. Till now, the calculation was done
this way, please see also inline comments:

max.lo = min.lo + len.lo //this may overflow, need to carry over to high
max.hi = min.hi + len.hi
max.hi = max.hi - 1 // subtraction needs to happen on the low part

This calculation has been corrected the following way:

max.lo = min.lo + len.lo
max.hi = min.hi + len.hi + (max.lo < min.lo) // check for overflow
max.lo = max.lo - 1 // subtract from low part

The relevant part from the generated ASL for the MCRS method:
```
Method (MCRS, 1, Serialized)
{
    Acquire (MLCK, 0xFFFF)
    \_SB.MHPC.MSEL = Arg0
    Name (MR64, ResourceTemplate ()
    {
	QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
	    0x0000000000000000, // Granularity
	    0x0000000000000000, // Range Minimum
	    0xFFFFFFFFFFFFFFFE, // Range Maximum
	    0x0000000000000000, // Translation Offset
	    0xFFFFFFFFFFFFFFFF, // Length
	    ,, _Y00, AddressRangeMemory, TypeStatic)
    })
    CreateQWordField (MR64, \_SB.MHPC.MCRS._Y00._MIN, MINL)  // _MIN: Minimum Base Address
    CreateDWordField (MR64, 0x12, MINH)
    CreateQWordField (MR64, \_SB.MHPC.MCRS._Y00._MAX, MAXL)  // _MAX: Maximum Base Address
    CreateDWordField (MR64, 0x1A, MAXH)
    CreateQWordField (MR64, \_SB.MHPC.MCRS._Y00._LEN, LENL)  // _LEN: Length
    CreateDWordField (MR64, 0x2A, LENH)
    MINL = \_SB.MHPC.MHBL
    MINH = \_SB.MHPC.MHBH
    LENL = \_SB.MHPC.MHLL
    LENH = \_SB.MHPC.MHLH
    MAXL = (MINL + LENL) /* \_SB_.MHPC.MCRS.LENL */
    MAXH = (MINH + LENH) /* \_SB_.MHPC.MCRS.LENH */
    If ((MAXL < MINL))
    {
	MAXH += One /* \_SB_.MHPC.MCRS.MAXH */
    }

    MAXL -= One
    Release (MLCK)
    Return (MR64) /* \_SB_.MHPC.MCRS.MR64 */
}
```

Fixes #1800.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2021-04-12 16:20:19 +02:00
Sebastien Boeuf
7e2c4b63c2 ci: Update SGX test to rely on vmlinux
Since using bzImage is now deprecated, let's update the SGX integration
test to rely on vmlinux instead.

Fixes #2476

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-04-07 17:40:10 +02:00
Anatol Belski
3f5ecbd326 tests: Extend Windows guest CPU hotplug test and update doc
Both changes aim to document the absence of the CPU hot-remove
functionality on Windows.

Closes #2457.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2021-04-07 14:44:29 +01:00
Sebastien Boeuf
e5211a6e1d ci: Update Ubuntu Focal custom image
Update the Ubuntu Focal image used as the guest image. It's based on the
latest Focal image released on April 1st 2021, and customized to include
all the utilities we need. As usual, snapd and pollinate services have
been removed.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-04-07 10:26:15 +01:00
Rob Bradford
9a8a34a8a9 tests: Only use bzImage in integration tests that require it
i.e. test_bzimage_boot and test_bzimage_reboot

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-06 13:30:59 +02:00
Anatol Belski
1bb0e54e92 tests: Add test for CPU hotplug for Windows guest
Also, add a note on hotplug support to windows.md.

Closes #2438.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2021-04-01 16:07:50 +01:00
Sebastien Boeuf
73e8fd4d72 clippy: Fix codebase to compile with beta toolchain
Fixes the current codebase so that every cargo clippy can be run with
the beta toolchain without any error.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-03-29 15:56:23 +01:00
Rob Bradford
5c010d489d tests: Address Rust 1.51.0 clippy issue (needless_question_mark)
error: Question mark operator is useless here
   --> tests/integration.rs:494:13
    |
494 | /             Ok(self
495 | |                 .ssh_command("grep MemTotal /proc/meminfo | grep -o \"[0-9]*\"")?
496 | |                 .trim()
497 | |                 .parse()
498 | |                 .map_err(Error::Parsing)?)
    | |__________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-03-26 11:32:09 +00:00
Rob Bradford
88c30764e0 tests: Move test_infra from a module to crate
It must be specified as excluded from the workspace as it must not be
built on non-test targets due to issues with the ssh2 dependency and the
musl toolchain.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-03-23 18:04:50 +01:00
Rob Bradford
16cb40733a tests: Extract out generic integration test code
This includes:

* OS disk image management
* Cloud init creation
* SSH to guest access
* Waiting for guest to boot

This will be useful in other projects that want to do similar things in
their integration tests.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-03-17 12:18:04 +00:00
Sebastien Boeuf
04dc496808 ci: Enable baremetal VFIO integration tests
Relying on a NVIDIA Tesla T4 card present in the SGX machine, this patch
enables baremetal VFIO testing, validated by running several NVIDIA
tools in the guest. The guest image has been prepared to include all the
software needed to run these tests.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-03-16 18:59:46 +00:00
Henry Wang
205e587fad tests: Enable test_power_button for AArch64
This commit enables the test_power_button test case for AArch64.

Signed-off-by: Henry Wang <Henry.Wang@arm.com>
2021-03-16 20:27:15 +08:00
Henry Wang
9c3b489f0e tests: Switch AArch64 serial test cases to ttyAMA0
This commit switches the serial test cases for AArch64 to ttyAMA0.

Signed-off-by: Henry Wang <Henry.Wang@arm.com>
2021-03-16 11:53:51 +08:00
Michael Zhao
c3a75dafc5 tests: Enable serial test cases for AArch64
Enabled all "ttyS0" related test cases:
- test_serial_off
- test_serial_tty
- test_serial_file

Enabled mandatory guest kernel driver for "ns16550a" on AArch64.

Signed-off-by: Michael Zhao <michael.zhao@arm.com>
2021-03-15 20:59:50 +08:00
Rob Bradford
99baee8d37 tests: Move Windows integration test to updated OVMF
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-03-01 22:11:19 +00:00
Rob Bradford
24922ce1e3 tests: Move integration tests to vmm_sys_util::tempdir::TempDir
This removes the dependency on "tempdir" which in turn depends on the
large rand dependency chain.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-02-23 11:07:48 +00:00
Rob Bradford
d78b2ec8b5 tests: Use vmm_sys_util::tempfile::Tempfile in integration tests
This removes the requirement for an extra crate and simplifies the
dependency chain.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-02-22 14:29:53 +01:00
Muminul Islam
0ef69fa592 tests: Use constant instead of static value for windows image name
Signed-off-by: Muminul Islam <muislam@microsoft.com>
2021-02-19 10:09:23 +00:00
Bo Chen
a838d0bde1 scripts, tests: Rustify the network setup commands for tests
Fixes: #2218

Signed-off-by: Bo Chen <chen.bo@intel.com>
2021-02-15 08:34:23 +00:00
Rob Bradford
9c5be6f660 build: Remove unnecessary Result<> returns
If the function can never return an error this is now a clippy failure:

error: this function's return value is unnecessarily wrapped by `Result`
   --> virtio-devices/src/watchdog.rs:215:5
    |
215 | /     fn set_state(&mut self, state: &WatchdogState) -> io::Result<()> {
216 | |         self.common.avail_features = state.avail_features;
217 | |         self.common.acked_features = state.acked_features;
218 | |         // When restoring enable the watchdog if it was previously enabled. We reset the timer
...   |
223 | |         Ok(())
224 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-02-11 18:18:44 +00:00
Bo Chen
d561b45552 tests: Add integration test test_macvtap
This integration test mimics the instructions from
`docs/macvtap-bridge.md`.

Fixes: #2215

Signed-off-by: Bo Chen <chen.bo@intel.com>
2021-02-11 15:25:32 +00:00
William Douglas
48963e322a Enable pty console
Add the ability for cloud-hypervisor to create, manage and monitor a
pty for serial and/or console I/O from a user. The reasoning for
having cloud-hypervisor create the ptys is so that clients, libvirt
for example, could exit and later re-open the pty without causing I/O
issues. If the clients were responsible for creating the pty, when
they exit the main pty fd would close and cause cloud-hypervisor to
get I/O errors on writes.

Ideally the main and subordinate pty fds would be kept in the main
vmm's Vm structure. However, because the device manager owns parsing
the configuration for the serial and console devices, the information
is instead stored in new fields under the DeviceManager structure
directly.

From there hooking up the main fd is intended to look as close to
handling stdin and stdout on the tty as possible (there is some future
work ahead for perhaps moving support for the pty into the
vmm_sys_utils crate).

The main fd is used for reading user input and writing to output of
the Vm device. The subordinate fd is used to setup raw mode and it is
kept open in order to avoid I/O errors when clients open and close the
pty device.

The ability to handle multiple inputs as part of this change is
intentional. The current code allows serial and console ptys to be
created and both be used as input. There was an implementation gap
though with the queue_input_bytes needing to be modified so the pty
handlers for serial and console could access the methods on the serial
and console structures directly. Without this change only a single
input source could be processed as the console would switch based on
its input type (this is still valid for tty and isn't otherwise
modified).

Signed-off-by: William Douglas <william.r.douglas@gmail.com>
2021-02-09 10:03:28 +00:00
Sebastien Boeuf
b26777cb01 ci: Add integration test for VHD format
Let's create a fixed VHD disk file from the existing RAW file thanks to
qemu-img, and create a new integration test to validate that
Cloud-Hypervisor can boot VHD disk image.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-02-01 13:45:08 +00:00
Bo Chen
5fbeacabad tests: Remove manual delete of the TAP interface in test_tap_from_fd
By using `net_util::open_tap` to create the TAP interface, the created
interface will be deleted when the returned variable (`net_utils::Tap`)
is dropped.

Signed-off-by: Bo Chen <chen.bo@intel.com>
2021-01-28 09:11:39 +00:00
Bo Chen
f7502057d9 tests: Extend test_tap_from_fd() with using multiple TAP fds
Signed-off-by: Bo Chen <chen.bo@intel.com>
2021-01-28 09:11:39 +00:00
Rob Bradford
5209026f52 tests: Port test_tap_from_fd to use net_util::open_tap
This removes the need for manually creating the interface and assigning
the IP.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-01-28 09:11:39 +00:00
Rob Bradford
58009af85d tests: Add clippy check for integration test building
Ensure that we try and keep the integration tests clippy clean.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-01-26 13:23:16 +01:00
Rob Bradford
92f3f86669 tests: Add integration test for power button
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-01-13 17:00:39 +00:00
Sebastien Boeuf
3b43551d98 ci: Use device mapper to avoid copying Windows image
The Windows image is quite large (about 20GiB), hence it takes some time
to copy it for every test in order to avoid potential corruption.

One way to mitigate that without compromising on safety between each
test is by using device mapper. By creating a read-only base, we ensure
the image won't be modified by any of the tests, and by creating one
snapshot for each test, we avoid copying the entire image each time.
A dedicated Copy On Write disk image is created to handle any change
that might be performed on the base image, letting the tests behave as
expected.

Fixes #2155

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-01-13 10:48:06 +00:00
Sebastien Boeuf
c3df42d42f ci: Copy Windows image for each integration test
By relying on the Guest object, Windows dedicated tests copy the Windows
guest image before booting from it. The point being to avoid corruption
between multiple tests. This is already how the rest of the integration
tests work, Windows tests were the only ones missing this feature.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-01-13 10:48:06 +00:00
Rob Bradford
ba7864e111 tests: Send systemd journal to console
This will aid debugging of test issues especially those for critical
services during the boot.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-01-11 16:38:07 +00:00
Rob Bradford
5881809126 tests: Update integration tests to use new image without pollinate
This image does not have the pollinate service which can sometimes fail
and prevent SSH from starting as it marks itself as a prerequisite. This
service will never fully succeed as it tries to make a network
connection which will fail inside our test VMs.

Fixes: #2113

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-01-11 16:38:07 +00:00
Sebastien Boeuf
7889fc9207 scripts: Run test container with the default bridge network
Using --net=host is not necessary for any of the integration tests, so
let's use the default network option called "bridge".

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-01-11 11:18:48 +00:00
Sebastien Boeuf
df522cf12c ci: Re-enable test_windows_guest_snapshot_restore
This reverts commit 72d054bf40.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-01-11 09:32:58 +00:00
Rob Bradford
a920ef48de Revert "tests: Temporarily disable test_watchdog on aarch64"
This reverts commit 49b49421d0.

Probable solution was applied in f70852c04b

Fixes: #2103

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-01-11 10:26:52 +01:00
Sebastien Boeuf
20fde6b924 tests: Increase sleep time in Windows integration tests
Some sporadic failures were due to an early connection to the VM while
it was not fully ready. Increasing sleep times fixes these issues.

Fixes #2104

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-01-08 15:03:04 +00:00
Rob Bradford
72d054bf40 tests: Teporarily disable test_windows_guest_snapshot_restore
This test is reliably failing on our CI and we need time to investigate
why.

See: #2126

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-01-08 15:03:04 +00:00
Bo Chen
a286e960ed tests: Remove the check on the "booted" message in 'wait_vm_boot()'
Given we already check the connected IP address matches the expected
guest IP address, the check on the "booted" message is not needed.

Fixes: #2117

Signed-off-by: Bo Chen <chen.bo@intel.com>
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-01-08 12:54:35 +00:00
Rob Bradford
28abe63f46 tests: Fix test_virtio_block_disable_io_uring()
This test wasn't actually disabling io_uring.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-01-06 18:26:02 +00:00
Rob Bradford
49b49421d0 tests: Temporarily disable test_watchdog on aarch64
This test is very flaky and regularly causing CI failures. Until we can
identify the root cause we should disable this test.

See: #2103

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-01-06 18:26:02 +00:00
Rob Bradford
ef12216c19 tests: Add explicit QCOW2 based image test
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-01-06 18:26:02 +00:00
Rob Bradford
e05ed9240a tests: Use raw images for all tests
Simplify our image handling by not copying both QCOW2 and raw images for
every test. Allow the test to choose QCOW2 or raw by specifying the
image name manually. A follow on patch will add explicity QCOW2 tests.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-01-06 18:26:02 +00:00
Rob Bradford
c91d25ea64 tests: Don't swallow SSH errors
When an SSH command fails we want to be able to see, via a panic() why
and where it failed. Replace use of .unwrap_or_default() from SSH
command calls to ensure that we can see the location of the panic.

Also enhance the existing SSH output code to show the error if there is
one.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-01-06 13:51:26 +01:00
Rob Bradford
2e87d5ae02 tests: integration: Check different virtio-fs SHM region names
Depending on the kernel version the SHM region has a different name.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-01-04 22:44:40 +00:00
Rob Bradford
bb1ef5f1b8 tests: integration: Remove quiet from kernel command line
It will be useful to see kernel output from our integration tests when
they fail.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-12-18 16:05:14 +00:00
Rob Bradford
d9e1eec47d tests: integration: Use direct kernel boot for most tests
The boot time for direct kernel boot based tests is significantly
quicker than booting via the firmware and stock kernel as it triggers a
reboot during the boot process due to the initrd handling.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-12-18 16:05:14 +00:00
Rob Bradford
a4c076bd09 tests: integration: Don't always have kernel serial output
When doing a direct kernel boot only have console=ttyS0 in the command
line if we are explicitly testing the serial output. The default
behaviour is `--serial null` so this output will not be visible but will
trigger a KVM exit for every byte which is very costly when running
under nested virtualization.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-12-18 16:05:14 +00:00
Rob Bradford
873c79a931 tests: Add test_tap_from_fd()
This test creates new TAP device, opens it and then passed the fd in via
--net fd=<fd>

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-12-17 22:51:30 +01:00
Rob Bradford
3ee56112cb tests: Bump boot default timeout
Starting the virtio device threads from the VMM thread has slowed down
the start of the VM when running on a highly contested system like the
CI.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-12-17 11:23:53 +00:00
Rob Bradford
06f391e022 tests: integration: Retry epoll if we receive -EINTR or -EAGAIN
On the CI we are seeing that sometimes the epoll is receiving these
errors which do not indicate a failure but that we should retry.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-12-10 10:11:19 -08:00
Rob Bradford
1908f488c3 tests: Move tests from vhost_user_fs to virtiofsd-rs
Download and build virtiofsd-rs and then use that in the integration
test suite.

Fixes: #2013

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-12-01 11:13:21 +01:00
Rob Bradford
f271378811 tests: Wait for reboot in test_virtio_watchdog()
Aim to reduce flaky failures of this test by waiting for the VM to come
back after a reboot.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-11-18 18:27:34 +01:00
Rob Bradford
78b9edf848 tests: Get output from firmware and Linux for test_large_vm()
As we switched to focal for this test we no longer get any output during
the boot unless serial is used over virtio-console.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-11-18 18:27:34 +01:00
Rob Bradford
d0aebfb922 tests: Increase time waited for hotplugged memory to appear
There have been a lot of flakes around tests such as
test_virtio_fs_hotplug_dax_on_w_vhost_user_fs_daemon() or
test_virtio_fs_hotplug_dax_on() which all try and hotplug memory.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-11-18 18:27:34 +01:00
Rob Bradford
f913dd6150 tests: Add integration test to force io_uring off for block
Fixes: #1561

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-11-18 11:47:54 +01:00
Rob Bradford
fb70baece0 tests: Make integration test use vhost_user_{net,block} binaries
With the removal of vhost-user self-spawning support we should migrate
the tests to use the binaries so that we can remove the functionality
from the cloud-hypervisor binary itself.

See: #1925

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-11-18 11:46:32 +01:00
Anatol Belski
b399287430 memory_manager: Make addressable space size 64k aligned
While the addressable space size reduction of 4k in necessary due to
the Linux bug, the 64k alignment of the addressable space size is
required by Windows. This patch satisfies both.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2020-11-16 16:39:11 +00:00
Rob Bradford
ec84abc5c7 tests: Remove self spawning integration tests
Fixes: #1925

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-11-09 00:16:15 +01:00
Michael Zhao
164d481683 tests: Enable watchdog test case on AArch64
Signed-off-by: Michael Zhao <michael.zhao@arm.com>
2020-11-02 08:19:07 +00:00
Michael Zhao
a278704ae0 tests: Enable reboot test case on AArch64
Signed-off-by: Michael Zhao <michael.zhao@arm.com>
2020-10-30 17:14:44 +00:00
Michael Zhao
0f5e5d9e6d tests: Fix some build warnings in integration test on AArch64
Signed-off-by: Michael Zhao <michael.zhao@arm.com>
2020-10-30 17:14:12 +00:00
Michael Zhao
4606f0f28a tests: Make migration test case X86 only
Set the test case test_snapshot_restore X86 only, instead of excluding
it from test command line.

The command line option was added because we used to support migration
with Virtio-MMIO, but not Virtio-PCI.

Signed-off-by: Michael Zhao <michael.zhao@arm.com>
2020-10-30 17:14:12 +00:00
Bo Chen
8c268e351c tests: Port more tests to use wait_vm_boot
Tests not ported include 1) the ones that start guest VMs without
network (e.g. test_net_hotplug, test_initramfs), 2) test_vfio that
involves l2 guest. Also, some tests that use bionic guest image are
given extended timeout (120s) for 'wait_vm_boot'.

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-10-29 15:30:17 +00:00
Bo Chen
a79f058a90 tests: Accept custom timeout for wait_vm_boot
This allows known slow tests to have a longer/customized timeout while
keeping the default timeout short.

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-10-29 15:30:17 +00:00
Bo Chen
26783fea89 tests: Wait explicitly for vm shutdown w/ the 'wait-timeout' crate
Instead of waiting blindly with fixed amount of sleeping time, we can
use the `wait-timeout` crate to explicitly wait VM shutdown (with a
timeout). It can reduces the execution time of some tests
substantially. Also, this patch increases the `shutdown` timeout for
'test_reboot', which should fix the recent sporadic failures on this
test.

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-10-29 15:30:17 +00:00
Bo Chen
8c92d1dbdc tests: Wait explicitly for the guest vm to boot
Instead of blindly waiting for 20-40s for the guest VM to boot, this
patch waits the notification from the guest VM explicitly by using a
simple TcpListener on the host and a custom systemd service in the
guest.

This patch also ported few tests to use this new machanism, while more
tests are to be ported.

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-10-28 11:27:25 -07:00
Wei Liu
255dbd29ef tests: factor out windows_auth
This avoid repetition once we have more Windows tests.

No functional change.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
2020-10-22 18:23:08 +02:00
Wei Liu
2902a96ae6 tests: add Windows guest snapshot test
We also need to restrict the number of test threads to 1 to avoid tests
interfere with each other.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
2020-10-22 18:23:08 +02:00
Sebastien Boeuf
89b3d7b49b ci: Update integration tests with latest balloon changes
Now that virtio-balloon is not declared as part of the --memory
parameter, the integration tests are updated to keep the correct
behavior.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-10-22 16:33:16 +02:00
Rob Bradford
700f63fad8 tests: Add integration test for virtio-watchdog
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-10-21 16:02:39 +01:00
Bo Chen
e83d99ab10 tests: Run binary with INFO (-v) level logging
Given the increased amount of output from cloud-hypervisor, this patch
also increased the PIPE_SIZE to 32MB (from 256KB).

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-10-21 08:48:28 +01:00
Bo Chen
e869d2f1bc tests: Print full commandline for better debugging
This patch prints the complete commandline when launching
cloud-hypervisor. It also prints the details of the `ssh` command if
the command is failing.

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-10-21 08:48:28 +01:00
Sebastien Boeuf
8b9c9bc97f ci: Remove all references to 'mmio' feature
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-10-19 14:58:48 +01:00
Rob Bradford
d598341534 tests: Add Windows guest integration test
This is a new integration test running Windows as a guest with Cloud
Hypervisor. Once the VM is booted, the test connects to the guest
through SSH and shutdown the VM. If this succeeds, this means the VM
was properly booted to userspace and that the network was functional.

Important to note that because this test generates lots of logs, it
requires a large pipe size for both stdout and stderr.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-10-14 11:19:29 +02:00
Rob Bradford
0eabc00b27 tests: Allow controlling the password for SSH auth
The login details for the Windows VM are different.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-10-14 11:19:29 +02:00
Sebastien Boeuf
9d882bc8fe ci: Add integration test for testing maximum physical bits
Introduce a new test that will validate the new option `max_phys_bits`
from the `--cpus` parameter behaves as expected.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-10-13 18:58:36 +02:00
Sebastien Boeuf
67025948dc ci: Simplify test scripts
Since all unit and integration tests are run inside containers because
they are called from dev_cli.sh, they always run as root. That's why
both unit and integration scripts can be simplified as they don't need
to apply specific capabilities and run cargo tests in a dedicated 'kvm'
group.

Fixes #1683

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-10-07 14:26:13 +02:00
Sebastien Boeuf
162789a2d1 ci: Extend virtio-blk hotplug integration test
The existing virtio-blk hotplug test is extended by removing and
re-adding the virtio-blk device. This ensures the unplug/re-plug
feature is properly tested.

Fixes #1809

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-10-06 17:22:29 +01:00
Sebastien Boeuf
14163c5200 ci: Extend virtio-net hotplug integration test
The existing virtio-net hotplug test is extended by removing and
re-adding the virtio-net device. This ensures the unplug/re-plug
feature is properly tested.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-10-06 17:22:29 +01:00
Bo Chen
1d3c3bc6ec tests: Capture child process stdout/err in 'test_memory_mergeable'
Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-09-25 08:40:23 +02:00
Bo Chen
2441798fe4 tests: Resize the pipe size to 256K for capturing child stdout/err
As discussed in #1707, the `vcpu` thread can be stalled when using
`--serial tty`. To workaround that issue, this patch enforces to resize
the pipe size to 256K when we capture the stdout/stderr of the
cloud-hypervisor child process in the integration tests. Note that the
pipe size (256K) is chosen based on the output size of our integration
tests at this point, which may need to be increased in the future.

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-09-25 08:40:23 +02:00
Bo Chen
365b947023 tests: Port test_simple_launch to the new methodology
This is the last test to be ported to the new methodology.

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-09-25 08:40:23 +02:00
Bo Chen
cb2f11724a tests: Port test_reboot to the new methodology
Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-09-25 08:40:23 +02:00
Henry Wang
c85c1f0d76 ci: AArch64: enable snapshot/restore integration test case
Signed-off-by: Henry Wang <Henry.Wang@arm.com>
2020-09-23 12:37:25 +01:00
Sebastien Boeuf
5a3d54fa19 ci: Extend virtio-mem integration test with reboot
Now that virtio-mem supports reboot, we extend the existing integration
tests to validate the amount of RAM after reboot is the same as before
the reboot, but also that we can still resize down the VM or the memory
zone after the reboot.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-09-16 19:20:04 +02:00
Sebastien Boeuf
9d8672afc6 ci: Extend guest NUMA integration test with memory zone resizing
Extend the existing test to validate that each NUMA node gets assigned
the right amount of memory after each memory zone has been resized.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-09-16 19:20:04 +02:00
Sebastien Boeuf
5823c12eab ci: Extend memory zone integration test with 'resize-zone'
Now that we can resize each memory zone independently, this commit
extends the memory zone related test by validating 'vm.resize-zone'
works correctly.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-09-16 19:20:04 +02:00
Sebastien Boeuf
56b0c85578 ci: Introduce SGX integration testing
Extending the Cloud-Hypervisor CI to allow for testing SGX on a
dedicated machine where special image and kernels are ready.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-09-09 15:33:49 +02:00
Sebastien Boeuf
e15dba2925 vmm: Rename NUMA option 'id' into 'guest_numa_id'
The goal of this commit is to rename the existing NUMA option 'id' with
'guest_numa_id'. This is done without any modification to the way this
option behaves.

The reason for the rename is caused by the observation that all other
parameters with an option called 'id' expect a string to be provided.

Because in this particular case we expect a u32 representing a proximity
domain from the ACPI specification, it's better to name it with a more
explicit name.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-09-07 07:37:14 +02:00
Sebastien Boeuf
bf5e028016 ci: Update memory zone and NUMA integration tests
Since both --memory-zone and --numa parameters have been updated with
addition and removal of multiple options, this commit updates the
related integration tests to ensure they are still valid.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-09-07 07:37:14 +02:00
Bo Chen
4392a1484c tests: Port test_bzimage_reboot to the new methodology
Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-09-03 17:47:14 +01:00
Bo Chen
ded376c6e1 tests: Port test_console_file to the new methodology
Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-09-03 17:47:14 +01:00
Bo Chen
a4abb7f8e5 tests: Port test_virtio_console to the new methodology
Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-09-03 17:47:14 +01:00
Bo Chen
aac0cba0d1 tests: Port test_serial_file to the new methodology
Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-09-03 17:47:14 +01:00
Bo Chen
9686aef2c9 tests: Port test_serial_tty to the new methodology
Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-09-03 17:47:14 +01:00
Bo Chen
4e0e3d6221 tests: Port test_serial_null to the new methodology
Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-09-03 17:47:14 +01:00
Bo Chen
9e7e64d2a3 tests: Port various integration tests to new methodology
This patch ported many tests to the new methodology, where the guest log
will be printed only when the test is failing.

Things to finish in follow-up PRs:

1. Special tests not ported yet include: test_reboot,
test_bzimage_reboot, test_serial_null(), test_serial_tty(),
test_serial_file(), test_virtio_console(), test_console_file(),
and test_simple_launch.

2. Few direct calls to 'Command::new(clh_command("cloud-hypervisor"))',
which is still printing the guest console

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-09-03 08:13:20 +02:00
Sebastien Boeuf
5d80bc2339 ci: Add distance validation to NUMA integration test
By extending the existing NUMA integration test, this commit validates
the proper distances between NUMA nodes are exposed to the guest.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-09-01 18:09:01 +02:00
Sebastien Boeuf
d6fc18da9e ci: Add CPUs validation to the NUMA integration test
Extend the existing NUMA integration to validate that specifying CPUs
for each NUMA node gets propagated to the guest.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-09-01 15:25:00 +02:00
Sebastien Boeuf
36171caba9 ci: Add integration test for defining NUMA nodes in the guest
This new test validates the guest OS can find the NUMA nodes which have
been defined by the user through the CLI, and that the right amount of
memory is associated with each node.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-09-01 14:11:49 +02:00
Michael Zhao
a1c4c77cd8 tests: Enable test cases checking PCI MSI on AArch64
Signed-off-by: Michael Zhao <michael.zhao@arm.com>
2020-08-31 08:20:42 +02:00
Michael Zhao
2b8e08bd36 tests: Enable test_multi_cpu case on AArch64
Signed-off-by: Michael Zhao <michael.zhao@arm.com>
2020-08-31 08:20:42 +02:00
Michael Zhao
85c9bd0f47 tests: Enable vhost-user-net self-spawned test cases
Signed-off-by: Michael Zhao <michael.zhao@arm.com>
2020-08-31 08:19:23 +02:00
Sebastien Boeuf
1b4591aecc vmm: memory_manager: Apply NUMA policy to memory zones
Relying on the new option 'host_numa_node' from the 'memory-zone'
parameter, the user can now define which NUMA node from the host
should be used to back the current memory zone.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-08-27 08:39:38 -07:00
Sebastien Boeuf
7b898285d5 ci: Extend integration tests with user defined memory zones
Adding a small test to validate that user defined memory zones work as
expected when using --memory-zone option.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-08-25 16:43:10 +02:00
Michael Zhao
24fb5c8387 tests: Enable test case test_counters on AArch64
Signed-off-by: Michael Zhao <michael.zhao@arm.com>
2020-08-18 08:10:04 +02:00
Rob Bradford
fd48779a0d tests: Port test_initramfs to new methodology
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-08-13 13:03:22 +02:00
Rob Bradford
dd39aedde1 tests: Port test_memory_mergeable to new methodology
As a compromise we only print out the first child's output.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-08-13 13:03:22 +02:00
Rob Bradford
9dd4625fb4 tests: Port test_virtio_vsock to new methodology
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-08-13 13:03:22 +02:00
Rob Bradford
4983e5c322 tests: Port test_virtio_pmem to new methodology
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-08-13 13:03:22 +02:00
Rob Bradford
32b70e354c tests: Port virtiofs tests to new methodology
This required a bit of rearranging as it is not possible to call
prepare_daemon() inside a catch_unwind{} block.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-08-12 14:53:02 +01:00
Rob Bradford
23174800ca tests: Port vhost_user_block tests to new methodology
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-08-12 14:53:02 +01:00
Rob Bradford
8f4e1382a9 tests: Port vhost_user_net tests to new methodology
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-08-12 14:53:02 +01:00
Rob Bradford
effff460d4 tests: Port test_cpu_topology to new test methodology
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-08-12 14:53:02 +01:00
Rob Bradford
d749aa2e6b tests: Port test_vfio to new test methodology
Now the testing aspects are run inside a panic handler block rather than
inside a credibility TestBlock. If the test fails then the output from
the cloud-hypervisor binary is then presented.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-08-12 12:19:34 +02:00
Rob Bradford
4ef702ea76 tests: Use a disk image for test_vfio rather than virtio-fs
This reduces the complexity of the test slightly. The PCI BDFs in the L1
needed changing as the block devices come before the network ones.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-08-12 12:19:34 +02:00
Rob Bradford
070f47246c tests: Port test_snapshot_restore to new methodology
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-08-11 12:57:18 +02:00
Rob Bradford
6cd31e7a4d tests: Introduce new test methodology
Rather than using a credible TestBlock to capture the test assertions
instead use a catch_unwind block to catch the panic and turn
it into a Result<>.

If block panicked or the child binary had non-zero exit then, and only
then, print out the child output.

This results in a clearer test output with no interleaving.

Currently only test_counters is ported to this methodology to
demonstrate its use.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-08-11 12:57:18 +02:00
Michael Zhao
f2db346127 tests: Enable more integration test cases on AArch64
Enabled 3 test cases:
- test_large_vm
- test_huge_memory
- test_serial_null

Signed-off-by: Michael Zhao <michael.zhao@arm.com>
2020-08-05 08:15:18 +01:00
Henry Wang
a47da51539 ci: AArch64: Enable basic virtio_vsock test case for AArch64
This commit enables the test case for testing the basic function
of virtio_vsock (i.e. without the hotplug).

Signed-off-by: Henry Wang <Henry.Wang@arm.com>
2020-08-04 13:16:14 +01:00
Henry Wang
61c093f724 ci: AArch64: Enable api_create_boot for AArch64
This commit enables the `api_create_boot` case in the integration
test as the test for the Cloud Hypervisor API server functionality.

Signed-off-by: Henry Wang <Henry.Wang@arm.com>
2020-08-03 14:15:14 +01:00
Henry Wang
d5863caa4d ci: AArch64: Enable virtio-fs integration test
This commit enables the virtio-fs related integration test cases
for AArch64.

Note that to run virtio-fs cases, the host kernel should be
newer than v5.5.

Fixes: https://github.com/cloud-hypervisor/cloud-hypervisor/issues/1516

Signed-off-by: Henry Wang <henry.wang@arm.com>
2020-07-31 14:06:55 +02:00
Michael Zhao
fec54f71b0 tests: Enable PCI integration test cases on AArch64
Enabled a minimum set of PCI test case.
More cases are to be adapted or debugged.

Signed-off-by: Michael Zhao <michael.zhao@arm.com>
2020-07-30 09:52:12 +02:00
Michael Zhao
b363d1c706 tests: Enable integration test for initramfs on AArch64
Signed-off-by: Michael Zhao <michael.zhao@arm.com>
2020-07-20 14:20:53 +01:00
Henry Wang
f449aec78e ci: AArch64: Enable AArch64 mmio-related integration test cases
This commit enables some mmio-related integration test cases on
AArch64, including:
* some vhost_user test cases
* virtio-blk test cases
* pmem test cases

Also this commit contains a bug fix in creating virtio-blk device.
Previously, when creating the FDT, the virtio-blk device was
labeled in the reverse order of address allocation.

Signed-off-by: Henry Wang <Henry.Wang@arm.com>
2020-07-20 11:45:47 +01:00
Sebastien Boeuf
8be80aca80 ci: Give some time to the disk hotplug
Under high load, the VM might take some time to hotplug the disk after
the hotplug command has been issued. For this reason, let's put a 10s
sleep before checking for the presence of the new disk.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-07-13 12:19:24 +02:00
Sebastien Boeuf
802f02532a ci: Extend test_vfio time before VM is ready
We want to give the time to the nested VM to be fully ready before we
check it's correctly setup. This involves 3 layers of virtualization
when running the CI on Azure, which added to the high load happening
because of the parallelization, adds up to the start up time.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-07-13 12:19:24 +02:00
Rob Bradford
81ce8f505c tests: Enable virtio-mmio tests for virtio-console
This is useful to ensure that virtio-console support is covered.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-07-13 10:16:03 +02:00
Rob Bradford
6161d3bef8 tests: Enable virtio-vsock testing with virtio-mmio transport
As compiling without acpi (implied by mmio) means that the VM will
terminate on i8042 reset we cannot test the reboot.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-07-10 07:22:37 +02:00
Rob Bradford
bb6b738c0d tests: Enable test_multiple_network_interfaces with virtio-mmio
Ensure that multiple network interfaces function correctly when using
virtio-mmio.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-07-09 09:53:30 +02:00
Rob Bradford
730f3884f4 tests: Enable test_virtio_blk with virtio-mmio transport
This test makes use of MQ support in virtio-block so it is advisable to
test with virtio-mmio.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-07-09 09:53:13 +02:00
Rob Bradford
d725c2cbfb tests: Enable virtio-mem testing with virtio-mmio
Try and enable virtio-mem testing when using the virtio-mmio transport.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-07-09 09:52:56 +02:00
Sebastien Boeuf
ef554ba13c ci: Increase time to stabilize memory measurement
Check if increasing the time after the VM is spawned help with getting
more stable numbers for the base PSS.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-07-07 19:36:12 +02:00
Hui Zhu
b59f231092 tests: Add integration test to test_memory_hotplug for virtio-balloon
Signed-off-by: Hui Zhu <teawater@antfin.com>
2020-07-07 17:25:13 +01:00
Henry Wang
33c5d6bb98 tests: Enable test_aarch64_pe_boot case for AArch64
The compiled AArch64 linux kernel by running `make` is in PE format
instead of vmlinux, vmlinux.pvh and bzImage format. Therefore we
need to add integration test for this case.

Signed-off-by: Henry Wang <Henry.Wang@arm.com>
2020-07-07 13:55:39 +01:00
Sebastien Boeuf
bb9174601a ci: Separate parallel vs sequential tests
In order to differentiate tests that can be run in parallel versus
tests that must be run on their own, we move all tests into dedicated
modules.

The point is to avoid glitches in results that can be caused by the fact
that other tests (hence VMs) are running at the same time.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-07-03 13:08:37 +01:00
Sebastien Boeuf
c2920d2b6b ci: Move from Clear Linux to Ubuntu Focal Fossa cloud image
Move the CI to rely entirely on Ubuntu cloud images. It's worth noting
that both QCOW2 and RAW images from Ubuntu Focal Fossa have been
modified to include the tools needed from integration tests.
This means fio, iperf, iperf3, netcat and socat have been added to the
image. The snapd package have been fully removed as it was expecting the
support for squashfs (not present when using our own kernel from direct
kernel boot), which was causing some failures, and was preventing
cloud-init from terminating properly.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-07-02 13:47:16 +02:00
Rob Bradford
135ee4568e tests: Enhance rate_limited_copy() to also consider free disk space
With QCOW disk images the space needed is greater than the size of the
iamge as any "zero" blocks in the image are allocated when they are
touched making the image bigger.

Here we add a threshold of 6GiB with added debugging messages to ensure
that there is sufficient disk space to run the tests.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-07-02 11:52:49 +02:00
Sebastien Boeuf
514978b54a ci: Improve test_snapshot_restore with multiple vCPUs
Extend the existing integration test test_snapshot_restore by testing
with more than one vCPU.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-06-30 14:03:03 +01:00
Rob Bradford
48a05c4727 tests: Add simple counters integration test
Add a simple test to check that the data from the counters matches what
is expected and that the value of the counters increases after an
operation that will hit all counters.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-06-25 07:02:44 +02:00
Rob Bradford
4b64f2a027 vmm: cpu: Reuse already allocated vCPUs if available
When a request is made to increase the number of vCPUs in the VM attempt
to reuse any previously removed (and hence inactive) vCPUs before
creating new ones.

This ensures that the APIC ID is not reused for a different KVM vCPU
(which is not allowed) and that the APIC IDs are also sequential.

The two key changes to support this are:

* Clearing the "kill" bit on the old vCPU state so that it does not
  immediately exit upon thread recreation.
* Using the length of the vcpus vector (the number of allocated vcpus)
  rather than the number of active vCPUs (.present_vcpus()) to determine
  how many should be created.

This change also introduced some new info!() debugging on the vCPU
creation/removal path to aid further development in the future.

TEST=Expanded test_cpu_hotplug test.

Fixes: #1338

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-06-23 14:11:14 +01:00
Sebastien Boeuf
b5cf150ac3 ci: Update test_snapshot_restore by resuming the VM
Now that snapshot/restore is symmetrical, that is the VM must be paused
before it is snapshot and it must be resumed after it's been restored,
the integration test is updated accordingly.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-06-23 10:15:03 +02:00
Rob Bradford
798f3f01a9 tests: Add integration tests for CPU topology
Add multiple integration tests with various different CPU topologies and
check that they work as expected.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-06-17 12:18:09 +02:00
Sebastien Boeuf
4f311b56eb ci: Extend integration tests for checking PCI hotplug response
Upon PCI hotplug, the VMM now returns some information about the device
name and the associated b/d/f. This patch extends the integration tests
so that we validate the response is the one that is expected.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2020-06-12 13:37:18 +01:00
Bo Chen
cc85d896a5 tests: Extend test_*_reboot with checks on fd leaking
This revised version of the patch reuses the back-off strategy from
'ssh_command()' to deal with varying booting time.

Fixes: #1209

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-06-10 13:54:18 +01:00
Rob Bradford
aa79a92c35 tests: Add integration test for unprivileged network
This tests whether we can have a working network without having
CAP_NET_ADMIN.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-06-08 17:56:10 +02:00
Bo Chen
a8cdf2f070 tests,vm-virtio,vmm: Use 'socket' for all CLI/API parameters
This patch unifies the inconsistent uses of 'socket' and 'sock' from our
CLI/API parameters.

Fixes: #1091

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-06-08 17:41:12 +02:00
Rob Bradford
eabf43fbf6 Revert "tests: Extend test_*_reboot with checks on fd leaking"
This reverts commit 7dc4e91303.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-06-05 14:09:17 +01:00