meson: link emulators without Makefile.target

The binaries move to the root directory, e.g. qemu-system-i386 or
qemu-arm.  This requires changes to qtests, CI, etc.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2020-08-03 17:04:25 +02:00
parent f556b4a10d
commit 64ed6f92ff
32 changed files with 181 additions and 344 deletions

View file

@ -1,39 +0,0 @@
QEMU_PROG_FUZZ=qemu-fuzz-$(TARGET_NAME)$(EXESUF)
fuzz-obj-y += tests/qtest/libqtest.o
fuzz-obj-y += $(libqos-obj-y)
fuzz-obj-y += tests/qtest/fuzz/fuzz.o # Fuzzer skeleton
fuzz-obj-y += tests/qtest/fuzz/fork_fuzz.o
fuzz-obj-y += tests/qtest/fuzz/qos_fuzz.o
fuzz-obj-y += tests/qtest/fuzz/qtest_wrappers.o
# Targets
fuzz-obj-$(CONFIG_PCI_I440FX) += tests/qtest/fuzz/i440fx_fuzz.o
fuzz-obj-$(CONFIG_VIRTIO_NET) += tests/qtest/fuzz/virtio_net_fuzz.o
fuzz-obj-$(CONFIG_SCSI) += tests/qtest/fuzz/virtio_scsi_fuzz.o
FUZZ_CFLAGS += -I$(SRC_PATH)/tests -I$(SRC_PATH)/tests/qtest
# Linker Script to force coverage-counters into known regions which we can mark
# shared
FUZZ_LDFLAGS += -Xlinker -T$(SRC_PATH)/tests/qtest/fuzz/fork_fuzz.ld
FUZZ_LDFLAGS += -Wl,-wrap,qtest_inb
FUZZ_LDFLAGS += -Wl,-wrap,qtest_inw
FUZZ_LDFLAGS += -Wl,-wrap,qtest_inl
FUZZ_LDFLAGS += -Wl,-wrap,qtest_outb
FUZZ_LDFLAGS += -Wl,-wrap,qtest_outw
FUZZ_LDFLAGS += -Wl,-wrap,qtest_outl
FUZZ_LDFLAGS += -Wl,-wrap,qtest_readb
FUZZ_LDFLAGS += -Wl,-wrap,qtest_readw
FUZZ_LDFLAGS += -Wl,-wrap,qtest_readl
FUZZ_LDFLAGS += -Wl,-wrap,qtest_readq
FUZZ_LDFLAGS += -Wl,-wrap,qtest_writeb
FUZZ_LDFLAGS += -Wl,-wrap,qtest_writew
FUZZ_LDFLAGS += -Wl,-wrap,qtest_writel
FUZZ_LDFLAGS += -Wl,-wrap,qtest_writeq
FUZZ_LDFLAGS += -Wl,-wrap,qtest_memread
FUZZ_LDFLAGS += -Wl,-wrap,qtest_bufread
FUZZ_LDFLAGS += -Wl,-wrap,qtest_memwrite
FUZZ_LDFLAGS += -Wl,-wrap,qtest_bufwrite
FUZZ_LDFLAGS += -Wl,-wrap,qtest_memset

View file

@ -17,8 +17,8 @@
#include "tests/qtest/libqos/pci.h"
#include "tests/qtest/libqos/pci-pc.h"
#include "fuzz.h"
#include "fuzz/qos_fuzz.h"
#include "fuzz/fork_fuzz.h"
#include "qos_fuzz.h"
#include "fork_fuzz.h"
#define I440FX_PCI_HOST_BRIDGE_CFG 0xcf8

View file

@ -0,0 +1,35 @@
specific_fuzz_ss.add(files('fuzz.c', 'fork_fuzz.c', 'qos_fuzz.c',
'qtest_wrappers.c'), qos)
# Targets
specific_fuzz_ss.add(when: 'CONFIG_I440FX', if_true: files('i440fx_fuzz.c'))
specific_fuzz_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('virtio_net_fuzz.c'))
specific_fuzz_ss.add(when: 'CONFIG_VIRTIO_SCSI', if_true: files('virtio_scsi_fuzz.c'))
# unfortunately declare_dependency does not support link_depends, so
# this will be duplicated in meson.build
fork_fuzz = declare_dependency(
link_args: ['-fsanitize=fuzzer',
'-Wl,-T,' + (meson.current_source_dir() / 'fork_fuzz.ld'),
'-Wl,-wrap,qtest_inb',
'-Wl,-wrap,qtest_inw',
'-Wl,-wrap,qtest_inl',
'-Wl,-wrap,qtest_outb',
'-Wl,-wrap,qtest_outw',
'-Wl,-wrap,qtest_outl',
'-Wl,-wrap,qtest_readb',
'-Wl,-wrap,qtest_readw',
'-Wl,-wrap,qtest_readl',
'-Wl,-wrap,qtest_readq',
'-Wl,-wrap,qtest_writeb',
'-Wl,-wrap,qtest_writew',
'-Wl,-wrap,qtest_writel',
'-Wl,-wrap,qtest_writeq',
'-Wl,-wrap,qtest_memread',
'-Wl,-wrap,qtest_bufread',
'-Wl,-wrap,qtest_memwrite',
'-Wl,-wrap,qtest_bufwrite',
'-Wl,-wrap,qtest_memset']
)
specific_fuzz_ss.add(fork_fuzz)

View file

@ -12,7 +12,7 @@
*/
#include "qemu/osdep.h"
#include "cpu.h"
#include "hw/core/cpu.h"
#include "exec/ioport.h"
#include "fuzz.h"

View file

@ -61,7 +61,8 @@ static void virtio_net_fuzz_multi(QTestState *s,
* backend. Otherwise, always place the input on a virtqueue.
*/
if (vqa.rx && sockfds_initialized) {
write(sockfds[0], Data, vqa.length);
int ignored = write(sockfds[0], Data, vqa.length);
(void) ignored;
} else {
vqa.rx = 0;
uint64_t req_addr = guest_alloc(t_alloc, vqa.length);

View file

@ -12,10 +12,10 @@
#include "qemu/osdep.h"
#include "tests/qtest/libqtest.h"
#include "libqos/virtio-scsi.h"
#include "libqos/virtio.h"
#include "libqos/virtio-pci.h"
#include "tests/qtest/libqos/libqtest.h"
#include "tests/qtest/libqos/virtio-scsi.h"
#include "tests/qtest/libqos/virtio.h"
#include "tests/qtest/libqos/virtio-pci.h"
#include "standard-headers/linux/virtio_ids.h"
#include "standard-headers/linux/virtio_pci.h"
#include "standard-headers/linux/virtio_scsi.h"

View file

@ -226,7 +226,7 @@ typedef void *(*QOSBeforeTest) (GString *cmd_line, void *arg);
* my_test <--consumed_by-- my_interface <--produces--+
*
* Assuming there the binary is
* QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64
* QTEST_QEMU_BINARY=./qemu-system-x86_64
* a valid test path will be:
* "/x86_64/pc/other_node/my_driver/my_interface/my_test".
*

View file

@ -234,7 +234,7 @@ foreach dir : target_dirs
qtest_env = environment()
qtest_env.set('QTEST_QEMU_IMG', './qemu-img')
qtest_env.set('G_TEST_DBUS_DAEMON', meson.source_root() / 'tests/dbus-vmstate-daemon.sh')
qtest_env.set('QTEST_QEMU_BINARY', '@0@-softmmu/qemu-system-@0@'.format(target_base))
qtest_env.set('QTEST_QEMU_BINARY', './qemu-system-' + target_base)
foreach test : qtests
# Executables are shared across targets, declare them only the first time we

View file

@ -31,7 +31,7 @@ int main(int argc, char *argv[])
g_test_init(&argc, &argv, NULL);
if (strcmp(arch, "ppc64")) {
g_printerr("RTAS requires ppc64-softmmu/qemu-system-ppc64\n");
g_printerr("RTAS requires qemu-system-ppc64\n");
exit(EXIT_FAILURE);
}
qtest_add_func("rtas/get-time-of-day", test_rtas_get_time_of_day);