aboutgitcodebugslistschat
path: root/test/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* test: Simplify data handling for transfer testsDavid Gibson2022-09-291-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | Many of our tests are based around performing transfers of sample data across passt/pasta created links. The data flow here can be a bit hard to follow since, e.g. we create a file transfer it to the guest, then transfer it back to the host across several different tests. This also means that the test cases aren't independent of each other. Because we don't have the original file available at both ends in some cases, we compare them by generating md5sums at each end and comparing them, which is a bit complicated. Make a number of changes to simplify this: 1. Pre-generate the sample data files as a test asset, rather than building them on the fly during the tests proper 2. Include the sample data files in the mbuto guest image 3. Because we have good copies of the original data available in all contexts, we can now simply use 'cmp' to check if the transfer has worked, avoiding md5sum complications. 4. Similarly we can always use the original copy of the sample data on the send side of each transfer, meaning that the tests become more independent of each other. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* test: Use context system for guest commandsDavid Gibson2022-09-131-2/+5
| | | | | | | | | | | | | | | Extends the context system in the test scripts to allow executing commands within a guest. Do this without requiring an existing network in the guest by using socat to run ssh via a vsock connection. We do need some additional "sleep"s in the tests, because the new faster dispatch means that sometimes we attempt to connect before socat has managed to listen. For now, only use this for the plain "passt" tests. The "passt_in_ns" and other tests have additional complications we still need to deal with. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* test: Add nsholder utilityDavid Gibson2022-09-131-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | In our test scripts we need to do some ugly parsing of /proc and/or pstree output in order to get the PIDs of processes running in namespaces so that we can connect to those namespaces with nsenter or pasta. This is actually a pretty tricky problem with standard tools. To determine the PID from the outside of the namespace we need to know how the process of interest is related to the unshare or pasta process (child? one of several children? grandchild?) as well as then parsing /proc or ps output. This is slightly awkward now, and will get worse with future changes I'd like to make to have processes are dispatched. The obvious solution would be to have the process of interest (which we control) report its own PID, but that doesn't work easily, because it is in a PID namepace and sees only its local PID not the global PID we need to address it from outside. To handle this, add a small custom tool, "nsholder". This takes a path and a mode parameter. In "hold" mode it will create a unix domain socket bound to the path and listening. In "pid" mode it will get the "hold"ing process's pid via the unix socket using SO_PEERCRED, which translates between PID namespaces. In "stop" mode it will send a message to the socket causing the "hold"ing process to clean up and exit. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: Prepare distro images during asset build phaseDavid Gibson2022-07-141-4/+16
| | | | | | | | | | | | | | | | | | | | | | | Before booting the guest images, the distro test cases need to modify the guest images, using virt-edit and guestfish, to boot in the way we need. At present this gets repeated on every test run, even though it's not really doing anything we want to test for. In addition many of the images have the same preparation steps leading to a lot of duplicated stages in the tests. A number of additional images can be prepared using common steps, even if the ones used now have small differences. Therefore move the preparation of most of the guest images to the asset build phase, where they can be done a single time for multiple test runs, using a common preparation script. We can even avoid making a copy of the disk image for booting, by using qemu's -snapshot option. A few of the distros (openSUSE and older Ubuntu) do need different steps. For now we don't chage how they are run, they could possibly be handled more like this in future. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: Move distro image download to asset build makefileDavid Gibson2022-07-141-1/+130
| | | | | | | | | | | | Rather than directly download distro images from the test scripts, handle all the downloads during the test asset build, then just clone them for the tests themselves. This avoids repeated downloads which can be very slow when debugging failing tests. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> [sbrivio: Add OPENSUSE_IMGS to DOWNLOAD_ASSETS in Makefile, and note that xzcat doesn't take a -O option in test/distro/opensuse] Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* tests: Search multiple places for aarch64 EDK2 bios imageDavid Gibson2022-07-141-1/+4
| | | | | | | | | | | | | | | | | Apparently qemu's ARM virt machine needs to be explicitly given a firmware image, rather than just supplying a sane default. Unfortunately the EDK2 firmware image we need isn't in the same place on all host distros. Currently the test scripts hardcode the Debian location, meaning it will break on hosts that have it somewhere else. This patch searches multiple locations for the firmware, and creates a local link during the asset build phase, which the tests can then use. For now it only searches the locations used by Debian and Fedora, but that's a small improvement in robustness already, and can be later improved further if we need to. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: Move mbuto download and execution to asset buildDavid Gibson2022-07-141-2/+8
| | | | | | | | | | | | Move the download of mbuto and using it to create a sample initramfs to the asset build makefile, rather than embedding it in the test scripts themselves. The two_guests tests used to use two separate copies of the mbuto image. As an initramfs the mbuto image is strictly readonly though, so that's not necessary. So, also use the same image for both guests. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: Introduce makefile for building test assetsDavid Gibson2022-07-141-0/+27
A number of passt/pasta testcases have initial steps which are just about building images or other assets we need for the test proper. Repeating these for each test run can be quite costly. This patch makes a start on moving this sort of test asset building to a separate phase before running the tests proper. For now just add a Makefile to handle the asset building (although it doesn't build anything yet), and make the path where we'll be building the assets available to the tests. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>