Skip to contentSkip to conversation

qtest/libqos/meson: Restrict architecture specific objects

PATCH In review Philippe Mathieu-Daudé 2 participants 2 messages Mar 14, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qtest/libqos/meson: Restrict architecture specific objects

Various libqos files are architecture specific.
Restrict the ARM/PPC/X86 units to their targets.

---
 tests/qtest/libqos/meson.build | 51 ++++++++++++++++++++++------------
 1 file changed, 34 insertions(+), 17 deletions(-)
tests/qtest/libqos/meson.build +34 -17
index 1cddf5bdaa1..817c2cc2c20 100644
@@ -1,4 +1,8 @@
-libqos_srcs = files('../libqtest.c',
+libqos_ss = ss.source_set()
+
+libqos_ss.add(genh)
+
+libqos_ss.add(files('../libqtest.c',
         'qgraph.c',
         'qos_external.c',
         'pci.c',
@@ -6,18 +10,6 @@
         'malloc.c',
         'libqos.c',
 
-        # spapr
-        'malloc-spapr.c',
-        'libqos-spapr.c',
-        'rtas.c',
-        'pci-spapr.c',
-
-        # pc
-        'pci-pc.c',
-        'malloc-pc.c',
-        'libqos-pc.c',
-        'ahci.c',
-
         # usb
         'usb.c',
 
@@ -39,7 +31,28 @@
         'virtio-rng.c',
         'virtio-scsi.c',
         'virtio-serial.c',
+))
 
+libqos_ss.add(when: 'TARGET_I386', if_true: files(
+        'pci-pc.c',
+        'malloc-pc.c',
+        'libqos-pc.c',
+
+        'ahci.c',
+
+        # qgraph machines:
+        'x86_64_pc-machine.c',
+))
+libqos_ss.add(when: 'TARGET_PPC64', if_true: files(
+        'malloc-spapr.c',
+        'libqos-spapr.c',
+        'rtas.c',
+        'pci-spapr.c',
+
+        # qgraph machines:
+        'ppc64_pseries-machine.c',
+))
+libqos_ss.add(when: 'TARGET_ARM', if_true: files(
         # qgraph machines:
         'aarch64-xlnx-zcu102-machine.c',
         'arm-imx25-pdk-machine.c',
@@ -49,11 +62,15 @@
         'arm-smdkc210-machine.c',
         'arm-virt-machine.c',
         'arm-xilinx-zynq-a9-machine.c',
-        'ppc64_pseries-machine.c',
-        'x86_64_pc-machine.c',
-)
+))
+libqos_ss.add(when: 'TARGET_AARCH64', if_true: files(
+        # qgraph machines:
+        'aarch64-xlnx-zcu102-machine.c',
+))
 
-libqos = static_library('qos', libqos_srcs + genh,
+libqos_ss = libqos_ss.apply(config_host, strict: false)
+
+libqos = static_library('qos', libqos_ss.sources() + genh,
                         name_suffix: 'fa',
                         build_by_default: false)
 
Signature · 1 line
2.26.2
#1 lore raw
Quoted 5 lines · Philippe Mathieu-Daudé

Various libqos files are architecture specific.
Restrict the ARM/PPC/X86 units to their targets.

---

I thought qos-test is reused for all the machines, and all the arch checking is done at runtime. Also, are these variables actually defined when building tests? There seem to be some link failures:

ninja -jnproc tests/qtest/qos-test
clang-11 -o tests/qtest/qos-test ...
/usr/bin/ld: tests/qtest/qos-test.p/virtio-blk-test.c.o: in function `pci_hotplug':
undefined reference to `qpci_unplug_acpi_device_test

-Alex

Quoted 88 lines
 tests/qtest/libqos/meson.build | 51 ++++++++++++++++++++++------------
 1 file changed, 34 insertions(+), 17 deletions(-)
tests/qtest/libqos/meson.build +34 -17
index 1cddf5bdaa1..817c2cc2c20 100644
@@ -1,4 +1,8 @@
-libqos_srcs = files('../libqtest.c',
+libqos_ss = ss.source_set()
+
+libqos_ss.add(genh)
+
+libqos_ss.add(files('../libqtest.c',
         'qgraph.c',
         'qos_external.c',
         'pci.c',
@@ -6,18 +10,6 @@
         'malloc.c',
         'libqos.c',
 
-        # spapr
-        'malloc-spapr.c',
-        'libqos-spapr.c',
-        'rtas.c',
-        'pci-spapr.c',
-
-        # pc
-        'pci-pc.c',
-        'malloc-pc.c',
-        'libqos-pc.c',
-        'ahci.c',
-
         # usb
         'usb.c',
 
@@ -39,7 +31,28 @@
         'virtio-rng.c',
         'virtio-scsi.c',
         'virtio-serial.c',
+))
 
+libqos_ss.add(when: 'TARGET_I386', if_true: files(
+        'pci-pc.c',
+        'malloc-pc.c',
+        'libqos-pc.c',
+
+        'ahci.c',
+
+        # qgraph machines:
+        'x86_64_pc-machine.c',
+))
+libqos_ss.add(when: 'TARGET_PPC64', if_true: files(
+        'malloc-spapr.c',
+        'libqos-spapr.c',
+        'rtas.c',
+        'pci-spapr.c',
+
+        # qgraph machines:
+        'ppc64_pseries-machine.c',
+))
+libqos_ss.add(when: 'TARGET_ARM', if_true: files(
         # qgraph machines:
         'aarch64-xlnx-zcu102-machine.c',
         'arm-imx25-pdk-machine.c',
@@ -49,11 +62,15 @@
         'arm-smdkc210-machine.c',
         'arm-virt-machine.c',
         'arm-xilinx-zynq-a9-machine.c',
-        'ppc64_pseries-machine.c',
-        'x86_64_pc-machine.c',
-)
+))
+libqos_ss.add(when: 'TARGET_AARCH64', if_true: files(
+        # qgraph machines:
+        'aarch64-xlnx-zcu102-machine.c',
+))
 
-libqos = static_library('qos', libqos_srcs + genh,
+libqos_ss = libqos_ss.apply(config_host, strict: false)
+
+libqos = static_library('qos', libqos_ss.sources() + genh,
                         name_suffix: 'fa',
                         build_by_default: false)
 
Signature · 1 line
2.26.2