diff mbox series

qtest/libqos/meson: Restrict architecture specific objects

Message ID 20210314225308.2582284-1-f4bug@amsat.org (mailing list archive)
State New, archived
Headers show
Series qtest/libqos/meson: Restrict architecture specific objects | expand

Commit Message

Philippe Mathieu-Daudé March 14, 2021, 10:53 p.m. UTC
Various libqos files are architecture specific.
Restrict the ARM/PPC/X86 units to their targets.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 tests/qtest/libqos/meson.build | 51 ++++++++++++++++++++++------------
 1 file changed, 34 insertions(+), 17 deletions(-)

Comments

Alexander Bulekov March 14, 2021, 11:25 p.m. UTC | #1
On 210314 2353, Philippe Mathieu-Daudé wrote:
> Various libqos files are architecture specific.
> Restrict the ARM/PPC/X86 units to their targets.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---

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 -j`nproc` 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

>  tests/qtest/libqos/meson.build | 51 ++++++++++++++++++++++------------
>  1 file changed, 34 insertions(+), 17 deletions(-)
> 
> diff --git a/tests/qtest/libqos/meson.build b/tests/qtest/libqos/meson.build
> index 1cddf5bdaa1..817c2cc2c20 100644
> --- a/tests/qtest/libqos/meson.build
> +++ b/tests/qtest/libqos/meson.build
> @@ -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)
>  
> -- 
> 2.26.2
>
diff mbox series

Patch

diff --git a/tests/qtest/libqos/meson.build b/tests/qtest/libqos/meson.build
index 1cddf5bdaa1..817c2cc2c20 100644
--- a/tests/qtest/libqos/meson.build
+++ b/tests/qtest/libqos/meson.build
@@ -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)