Commit Graph

50267 Commits

Author SHA1 Message Date
Michal Privoznik
378dc6a32b virnetdevopenvswitch: Drop @brname arg from virNetDevOpenvswitchRemovePort()
The @brname argument of virNetDevOpenvswitchRemovePort() is and
was unused ever since its introduction in v0.9.11-rc1~257. Just
remove it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-04-12 20:45:00 +02:00
Michal Privoznik
f8b5bd855f hypervisor: Introduce and use virDomainInterfaceVportRemove()
Both LXC and QEMU drivers have the same code to remove vport when
removing a domain's interface. Instead of repeating the same
pattern in both drivers, move the code into hypervisor agnostic
location (src/hypervisor/) and switch to calling this new
function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-04-12 20:44:52 +02:00
Michal Privoznik
767d92f098 virnetdevopenvswitch: Fix comment to virNetDevOpenvswitchInterfaceGetMaster()
The comment to virNetDevOpenvswitchInterfaceGetMaster() contains
wrong function name. Fix this.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-04-12 20:44:40 +02:00
Michal Privoznik
2e72cfe25d vsh: Drop fwd declaration of a nonexistent function
The vshFindTypedParamByName() function no longer exists (as of
v1.0.2-rc1~82), but its header file declaration was still kept
around. Drop it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-04-12 14:27:58 +02:00
Michal Privoznik
01f2b614a2 qemusecuritytest: Call real virFileExists in mock
When I suggested to Jim to call real virFileExists() I forgot to
also suggest calling init_syms(). Without it, real_virFileExists
pointer might be left unset. And indeed, that's what we were
seeing on FreeBSD.

This effectively reverts commit 4b5cc57ed3.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2024-04-09 16:55:25 +02:00
Jim Fehlig
4b5cc57ed3 qemusecuritytest: Don't call real virFileExists in mock
Calling the real virFileExists in qemusecuritymock.c can cause a
segfault in qemusecuritytest. No segfaults are noticed when calling
access(2) instead of virFileExists.

Fixes: 4ed5ade753
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2024-04-08 14:40:02 -06:00
Jim Fehlig
4ed5ade753 security: Ensure file exists before attempting to restore label
When performing an install, it's common for tooling such as virt-install
to remove the install kernel/initrd once they are successfully booted and
the domain has been redefined to boot without them. After the installation
is complete and the domain is rebooted/shutdown, the DAC and selinux
security drivers attempt to restore labels on the now deleted files. It's
harmles wrt functionality, but results in error messages such as

Mar 08 12:40:37 virtqemud[5639]: internal error: child reported (status=125): unable to stat: /var/lib/libvirt/boot/vir>
Mar 08 12:40:37 virtqemud[5639]: unable to stat: /var/lib/libvirt/boot/virtinst-yvp19moo-linux: No such file or directo>
Mar 08 12:40:37 virtqemud[5639]: Unable to run security manager transaction

Add a check for file existence to the virSecurity*RestoreFileLabel functions,
and avoid relabeling if the file is no longer available. Skipping the restore
caused failures in qemusecuritytest, which mocks stat, chown, etc as part of
ensuring the security drivers properly restore labels. virFileExists is now
mocked in qemusecuritymock.c to return true when passed a file previously
seen by the mocked stat, chown, etc functions.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-08 10:38:25 -06:00
Michal Privoznik
fdd440c096 rpcgen: tests: Include stdint.h in test_demo.c
Since header file structure is a bit different on MacOS, it
doesn't get uint64_t type declaration and thus test_demo.c must
include it explicitly. This is proper solution anyway, because on
Linux we're apparently relying on the header file sneaking
through some other include.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/619
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-08 15:47:24 +02:00
Göran Uddeborg
c9dbcd2c87 Translated using Weblate (Swedish)
Currently translated at 69.0% (7208 of 10438 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2024-04-06 22:36:02 +02:00
Benjamin Taubmann
a39dd25715 Extend libvirt-guests to shutdown only persistent VMs
At the moment, there is no configuration option for the libvirt-guests
service that allows users to define that only persistent virtual machines
should be shutdown on host shutdown.

Currently, the service config allows to choose between two ON_SHUTDOWN
actions that are executed on running virtual machines when the host goes
down: shutdown, suspend.
The ON_SHUTDOWN action should be orthogonal to the type of the virtual
machine. However, the existing implementation, does not suspend
transient virtual machines.
This is the matrix of actions that is executed on virtual machines based
on the configured ON_SHUTDOWN action and the type of a virtual machine.

         | persistent | transient
shutdown | shutdown   | shutdown (what we want to change)
suspend  | suspend    | nothing

Add config option PERSISTENT_ONLY to libvirt-guests config that allows
users to define if the ON_SHUTDOWN action should be applied only on
persistent virtual machines. PERSISTENT_ONLY can be set to true, false,
default. The default option will implement the already existing logic.

Case 1: PERSISTENT_ONLY=default
         | persistent | transient
shutdown | shutdown   | shutdown
suspend  | suspend    | nothing

Case 2: PERSISTENT_ONLY=true
         | persistent | transient
shutdown | shutdown   | nothing
suspend  | suspend    | nothing

Case 3: PERSISTENT_ONLY=false
         | persistent | transient
shutdown | shutdown   | shutdown
suspend  | suspend    | suspend

Signed-off-by: Benjamin Taubmann <benjamin.taubmann@nutanix.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2024-04-04 09:10:00 +02:00
Marc Hartmayer
5138dd2478 node_device_conf: virNodeDeviceGetSCSITargetCaps: fix memory leak
Make sure the old value in `scsi_target->wwpn` is free'd before replacing it.
While at it, simplify the code.

==9104== 38 bytes in 2 blocks are definitely lost in loss record 1,943 of 3,250
==9104==    at 0x483B8C0: malloc (vg_replace_malloc.c:442)
==9104==    by 0x4DFB69B: g_malloc (gmem.c:130)
==9104==    by 0x4E1921D: g_strdup (gstrfuncs.c:363)
==9104==    by 0x495D60B: g_strdup_inline (gstrfuncs.h:321)
==9104==    by 0x495D60B: virFCReadRportValue (virfcp.c:62)
==9104==    by 0x4A5F5CB: virNodeDeviceGetSCSITargetCaps (node_device_conf.c:2914)
==9104==    by 0xBF62529: udevProcessSCSITarget (node_device_udev.c:657)
==9104==    by 0xBF62529: udevGetDeviceDetails (node_device_udev.c:1406)
==9104==    by 0xBF62529: udevAddOneDevice (node_device_udev.c:1563)
==9104==    by 0xBF639B5: udevProcessDeviceListEntry (node_device_udev.c:1637)
==9104==    by 0xBF639B5: udevEnumerateDevices (node_device_udev.c:1691)
==9104==    by 0xBF639B5: nodeStateInitializeEnumerate (node_device_udev.c:2009)
==9104==    by 0x49BDBFD: virThreadHelper (virthread.c:256)
==9104==    by 0x5242069: start_thread (in /usr/lib64/libc.so.6)

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-04 09:05:11 +02:00
Peter Krempa
e2a7dd3f7e qemucapabilitiestest: Update qemu-9.0 capabilities for RC1
Update the capabilities to v9.0.0-rc1-55-g7fcf7575f3

Notable changes:
 - Q35 machine now supports 4096 cpus

 - 'kvm-asyncpf-vmexit' cpu feature added
 - 'x2apic' cpu feature is now migratable

 - LUKS detached header support added
 - LUKS sm4 cipher alg support added

 - 'console' chardev backend type removed
 - 'memory' chardev backend type deprecated

 - 'mapped-ram' migration capability added
 - 'zero-page-detection' migration parameter added

 - 'acpi-generic-initiator' 'object' added

 - 'request-ebpf' QMP command added

 - 'legacy-reset', 'resettable-container', 'vhost-user-snd*' QOM types
   added

 - 'vdpa' property added for following device models:
    - virtio-balloon-pci
    - virtio-blk-pci
    - virtio-gpu-pci
    - virtio-iommu-pci
    - virtio-mem-pci
    - virtio-net-pci
    - virtio-scsi-pci

 - 'win2k-install-hack' property of 'ide-hd' added
 - 'aw-bits', 'granule', properties of 'virtio-iommu-pci' added
 - 'ebpf-rss-fds' property of 'virtio-net-pci' added

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2024-04-03 10:41:45 +02:00
Rayhan Faizel
6c62ee7933 tests: Add testcase for usb-net
Add small test case to demonstrate use of usb-net with user networking
backend.

Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-04-03 10:40:32 +02:00
Rayhan Faizel
e18c69bcd8 conf: Automatically assign address to usb-net device
This patch will allow usb-net devices to be automatically assigned a USB
address (and skip any attempt to assign a PCI one).

Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-04-03 10:40:14 +02:00
Denis V. Lunev
d37a4aa69c remote: properly initialize objects in ACL helpers
Commit 2ecdf25929 was intended to
implement two things: reduce stack usage inside ACL helpers and
minimally initialize virDomainDef object to avoid passing garbage
inside validation framework. Though original commit has not
touched other ACL helpers.

This patch adds proper clauses to
    remoteRelayNetworkEventCheckACL
    remoteRelayStoragePoolEventCheckACL
    remoteRelayNodeDeviceEventCheckACL
    remoteRelaySecretEventCheckACL

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-04-03 09:34:35 +02:00
Brett Holman
b902cfece0 virsysinfo: Try reading DMI table
Add DMI support for risc-v and mips. Attempt to read dmidecode and
fall back to old behavior if that fails.

The SMBIOS specification[1] officially supports both RISC-V and LoongArch.
Some mips-based Loongson-3 processors also have SMBIOS.

[1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.7.0.pdf

Signed-off-by: Brett Holman <brett.holman@canonical.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2024-04-02 16:58:47 -06:00
Jonathon Jongsma
21af003084 qemu: enable display/ramfb for vfio pci hostdevs
Implement display="on" and ramfb="on" for vfio PCI host devices in qemu.
This enables passthrough PCI devices for display just like we did for
mdevs.

Resolves: https://issues.redhat.com/browse/RHEL-28808

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-02 11:45:54 -05:00
Jonathon Jongsma
092f933a62 conf: allow display and ramfb for vfio pci hostdevs
We already allow the user to specify display="on" and ramfb="on" for
mdev host devices. But newer GPU models will no longer use the mdev
framework, so we should enable this same functionality for other
non-mdev passthrough PCI devices.

Resolves: https://issues.redhat.com/browse/RHEL-28808

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-02 11:45:54 -05:00
Andrea Bolognani
16d37076be virsh: Show 'connected to console' message later
Right now, we display the message before actually attempting
to connect to the VM console. That operation, however, can
fail for a number of reasons: for example, is the VM doesn't
have a serial device, the output ends up looking like

  $ virsh console cirros
  Connected to domain 'cirros'
  Escape character is ^] (Ctrl + ])
  error: internal error: cannot find character device <null>

The initial message is misleading. Change things so that it's
only printed if we actually successfully connected to the VM
console.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-04-02 18:26:35 +02:00
Peter Krempa
1e853a64dd tests: Drop 'test-lib.sh'
We no longer have any shell-based tests that use it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
1f82833251 virshtest: Adapt virsh-uriprecedence test case
Reimplement the virsh-uriprecedence test case in virshtest. To do this
we need to add infrastructure to pass extra environment variables to the
tested virsh.

The user config files are shipped in repo rather than created in the
script.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
e57ce7fb45 tests: Reimplement 'libvirtd-fail' case directly in meson
The test simply invokes libvirtd and expects it to fail. We can do that
directly in meson without the need for a wrapper script.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
8f10dd32af tests: Re-implement '(virsh|virt-admin)-self-test' directly in meson
The self-test command for both virsh and virt-admin is self contained
and directly reports success, thus we don't actually need to run a shell
wrapper around it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
c92c63a5a3 virshtest: Adapt 'libvirtd-pool'
The test case is a fairly simple invocation of pool-create-as which can
be done easily from 'virshtest'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
3ace963662 virshtest: Adapt 'virsh-read-bufsiz' and 'virsh-read-non-seekable'
Test both situations (reading from non-regular file and reading a file
larger than (arbitrary) buffer size) via 'virshtest'.

To feed the pipe we need to create a thread that does it, but otherwise
it's fairly straightforward.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
60cc7bd1c0 virshtest: Adapt 'virsh-checkpoint' test
Invoke the majority of the command via DO_TEST_SCRIPT in 'virshtest'.
Some adaptation was needed to avoid printing of tables with volatile
data such as checkpoint creation time, which were converted to list
names-only.

To proprely test redefinition we store XMLs rather than taking them from
the defined checkpoints and use them separately to test redefinition of
checkpoint XMLs. This makes use of the 'cd' command in non-interactive
mode.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
c8d5703150 virshtest: Adapt 'virsh-snapshot' test
Invoke the majority of the command via DO_TEST_SCRIPT in 'virshtest'.
Some adaptation was needed to avoid printing of tables with volatile
data such as snapshot creation time, which were converted to list
names-only.

To proprely test redefinition we store XMLs rather than taking them from
the defined snapshots and use them separately to test redefinition of
snapshot XMLs. This makes use of the 'cd' command in non-interactive
mode.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
eb82c632e3 vsh: Allow non-interactive use of 'cd' command
For testing purposes it will come handy to change the directory from a
batch-mode script. Remove the check forbidding use of the 'cd' command
in batch mode.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
6193c4656e virsh: Fix '--name' and '--parent' used together in '(snapshot|checkpoint)-list' command
Until now when '--name' was used the parent was not printed and the
option was ignored. One option would be to declare the options mutually
exclusive, but for testing it may come handy to print both the snapshot
name and parent. Adjust the code to print them tab-separated and adjust
the docs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
a068dec641 virshtest: Adapt 'virsh-start' and 'virsh-undefine' tests as 'lifecycle' case
The 'virsh-start' case simply tried to start an already running VM. This
can be easily tested together with the tests for undefining a VM.

For this test the test driver config with multiple VMs comes handy as we
need to test 3 situations when we undefine and stop the VM.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
6bc71ed27c virshtest: Adapt 'virsh-schedinfo'
It's a simple virsh invocation which can be done in 'virshtest'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
090ae2b46c virshtest: Adapt 'virsh-int-overflow'
It's a simple test case invoking one virsh command thus it can be moved
to 'virshtest'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
d8e2220c9a virshtest: Adapt 'virsh-vcpupin' test
As all cases are negative we can test them all in one virsh run.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
630b229bc9 qemuxmlconftest: Adapt XMLs from 'virsh-cpuset' and 'virsh-define-dev-segfault' cases
Rather than using 'virsh define' for the tests use the XML (or idea what
the XML is testing) and use them as 'qemuxmlconftest' cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
c96ac614a8 virshtest: Reimplement 'virsh-output' test
Adapt the 'tests/virsh-output-commands' file from 'virsh-output' test as
a source. Apart from expanding the bash function to each command, I've
also had to drop the negative tests for argument population, as a
command parsing error aborts the execution of the script right away
rather than just reporting the error.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
06f816cb7b virshtest: Adapt 'event' option arg handling tests from 'virsh-optparse'
Move the argument parsing tests excercising 'virsh event' options
from 'virsh-optparse' to 'virshtest'.

As the test invokes 'virsh event' with a timeout and thus waits for one
second pointlessly the patch also adds infrastructure to mark individual
cases as expensive and is skipped normally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
2aec9b399b virshtest: Adapt numeric option arg handling tests from 'virsh-optparse'
Move the argument parsing tests excercising various numeric options
(except 'virsh event') from 'virsh-optparse' to 'virshtest'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
6a2712262e virshtest: Adapt 'snapshot-create-as' arg handling tests from 'virsh-optparse'
Move the argument parsing tests excercising 'virsh snapshot-create-as'
from 'virsh-optparse' to 'virshtest'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
1b3f148866 virshtest: Adapt argument parsing tests from 'virsh-optparse'
Move the argument parsing tests excercising 'virsh setvcpus' from
'virsh-optparse' to 'virshtest'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
52fc03ef21 virshtest: Drop support for testing against hardcoded strings
Now that all tests were converted, this is no longer needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
cf0d80344e virshtest: Adapt 'iothread' tests to DO_TEST_SCRIPT
Adapt the tests to be invoked in one run. Note that multiple fake VMs
were used for the distinct tests so that they don't influence each
other.

This is the final coversion of tests to run in batch mode which halved
the runtime of 'virshtest' on my machine (1.11s vs 2.33s).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
b65f3a01a8 virshtest: Adapt 'blkiotune' tests to DO_TEST_SCRIPT
The query and update can be tested in one run and validated against
files rather than hardcoded strings.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
a5e203417a virshtest: Adapt tests for domain id lookup and state query to DO_TEST_SCRIPT
All of the commands can be tested in one 'virsh' run in batch mode and
tested against a file rather than hardcoded strings.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
4b8581b8ef virshtest: Replace list and nodeinfo tests by equivalent VIR_TEST_SCRIPT variant
Add the basic list and info commands into a script and run it via
VIR_TEST_RUN_SCRIPT to simplify the code and save up on 'virsh'
instances exec'd for the test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
e8e79e38e5 virshtest: Drop string form of expected output data of "echo" tests
Now that the output is tested against files these are not needed any
more. The brief existence of both proved that the output is identical.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
d15b79a35c virshtest: Test against output files ("echo" tests)
Managing output files is much simpler especially with
VIR_TEST_REGENERATE_OUTPUT compared to putting the expected string blobs
into the C source file.

For now the output is tested both against the hardcoded strings as well
as the output files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
c63b5ee98b virshtest: Prepare for simpler testing - echo tests
Embedding the expected output in a C source code makes it very hard to
extend tests. In order to be able to test the outputs against data in
files on disk we need better naming of the tests themselves.

Use virTestCounterNext/Reset with appropriate tags to give reasonable
names to the 'virsh echo' tests' and prepare the 'DO_TEST' macro for
wider use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
5fd0653a39 virshtest: Adapt some 'escaping' tests via DO_TEST_SCRIPT
Express what's possible via a "virsh script" rather than invoking
separate virsh for each one.

We need to keep a few for parity as the argument parser behaves
differently when processing argv-like input compared to a string.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
f3d205ad44 virshtest: Drop some redundant 'echo' cases
Both argument passing and multiple command handling is already tested in
the 'multiple commands' cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
7fca0d4d52 virshtest: Adapt 'echo --split' tests to DO_TEST_SCRIPT
Optimize invocation of the tests to share one 'virsh' binary as they
don't influence each other.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00