Message ID | 1466698330-6021-3-git-send-email-armbru@redhat.com |
---|---|
State | New |
Headers | show |
On 23/06/2016 18:12, Markus Armbruster wrote: > For each header "FOO.h", the test checks whether > > #include "qemu/osdep.h" > #include "FOO.h" > #include "FOO.h" > > compiles. A large number of headers don't pass this test, by design > or by accident. These are all excluded with a blacklist for now. Add > make target check-blacklisted-headers to help with examinating how > they fail. Can we replace the blacklist with a fixed-format /* FIXME */ comment? Paolo > Signed-off-by: Markus Armbruster <armbru@redhat.com> > --- > tests/Makefile.include | 426 +++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 426 insertions(+) > > diff --git a/tests/Makefile.include b/tests/Makefile.include > index a2ed83b..e20f437 100644 > --- a/tests/Makefile.include > +++ b/tests/Makefile.include > @@ -413,6 +413,421 @@ test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \ > $(test-obj-y): QEMU_INCLUDES += -Itests > QEMU_CFLAGS += -I$(SRC_PATH)/tests > > +# All headers > +headers := $(filter %.h, $(shell cd $(SRC_PATH) && git ls-files) $(GENERATED_HEADERS)) > +# Headers that need more than just #include "qemu/osdep.h" to compile > +blacklisted-headers := \ > + audio/audio_int.h \ > + audio/audio_template.h \ > + audio/audio_win_int.h \ > + audio/dsound_template.h \ > + audio/mixeng_template.h \ > + audio/rate_template.h \ > + block/qcow2.h \ > + block/raw-aio.h \ > + block/vhdx.h \ > + bsd-user/i386/target_signal.h \ > + bsd-user/i386/target_syscall.h \ > + bsd-user/qemu.h \ > + bsd-user/sparc/target_signal.h \ > + bsd-user/sparc/target_syscall.h \ > + bsd-user/sparc64/target_signal.h \ > + bsd-user/sparc64/target_syscall.h \ > + bsd-user/syscall_defs.h \ > + bsd-user/x86_64/target_signal.h \ > + bsd-user/x86_64/target_syscall.h \ > + disas/libvixl/vixl/a64/assembler-a64.h \ > + disas/libvixl/vixl/a64/constants-a64.h \ > + disas/libvixl/vixl/a64/cpu-a64.h \ > + disas/libvixl/vixl/a64/decoder-a64.h \ > + disas/libvixl/vixl/a64/disasm-a64.h \ > + disas/libvixl/vixl/a64/instructions-a64.h \ > + disas/libvixl/vixl/code-buffer.h \ > + disas/libvixl/vixl/compiler-intrinsics.h \ > + disas/libvixl/vixl/globals.h \ > + disas/libvixl/vixl/invalset.h \ > + disas/libvixl/vixl/platform.h \ > + disas/libvixl/vixl/utils.h \ > + fpu/softfloat-macros.h \ > + fpu/softfloat-specialize.h \ > + hw/9pfs/9p-synth.h \ > + hw/9pfs/9p-xattr.h \ > + hw/audio/fmopl.h \ > + hw/audio/hda-codec-common.h \ > + hw/audio/lm4549.h \ > + hw/block/nvme.h \ > + hw/block/xen_blkif.h \ > + hw/cris/boot.h \ > + hw/display/cirrus_vga_rop.h \ > + hw/display/cirrus_vga_rop2.h \ > + hw/display/milkymist-vgafb_template.h \ > + hw/display/omap_lcd_template.h \ > + hw/display/pl110_template.h \ > + hw/display/pxa2xx_template.h \ > + hw/display/sm501_template.h \ > + hw/display/tc6393xb_template.h \ > + hw/display/vga-helpers.h \ > + hw/display/vga_int.h \ > + hw/i386/intel_iommu_internal.h \ > + hw/ide/ahci.h \ > + hw/lm32/lm32.h \ > + hw/lm32/lm32_hwsetup.h \ > + hw/lm32/milkymist-hw.h \ > + hw/microblaze/boot.h \ > + hw/net/e1000e_core.h \ > + hw/net/e1000x_common.h \ > + hw/net/ne2000.h \ > + hw/net/pcnet.h \ > + hw/net/rocker/rocker_desc.h \ > + hw/net/rocker/rocker_fp.h \ > + hw/net/rocker/rocker_of_dpa.h \ > + hw/net/rocker/rocker_tlv.h \ > + hw/net/rocker/rocker_world.h \ > + hw/net/vmware_utils.h \ > + hw/ppc/ppc405.h \ > + hw/s390x/ipl.h \ > + hw/s390x/s390-pci-inst.h \ > + hw/s390x/s390-virtio.h \ > + hw/scsi/mptsas.h \ > + hw/scsi/viosrp.h \ > + hw/tpm/tpm_int.h \ > + hw/tpm/tpm_tis.h \ > + hw/usb/desc.h \ > + hw/usb/quirks.h \ > + hw/xtensa/bootparam.h \ > + include/block/write-threshold.h \ > + include/disas/disas.h \ > + include/exec/cpu-all.h \ > + include/exec/cpu-defs.h \ > + include/exec/cpu_ldst.h \ > + include/exec/cpu_ldst_template.h \ > + include/exec/cpu_ldst_useronly_template.h \ > + include/exec/cputlb.h \ > + include/exec/exec-all.h \ > + include/exec/gen-icount.h \ > + include/exec/helper-gen.h \ > + include/exec/helper-proto.h \ > + include/exec/helper-tcg.h \ > + include/exec/ioport.h \ > + include/exec/memory-internal.h \ > + include/exec/ram_addr.h \ > + include/exec/softmmu-semi.h \ > + include/exec/tb-hash.h \ > + include/exec/user/abitypes.h \ > + include/exec/user/thunk.h \ > + include/hw/acpi/piix4.h \ > + include/hw/acpi/tco.h \ > + include/hw/arm/allwinner-a10.h \ > + include/hw/arm/bcm2836.h \ > + include/hw/arm/digic.h \ > + include/hw/arm/fsl-imx25.h \ > + include/hw/arm/fsl-imx31.h \ > + include/hw/arm/fsl-imx6.h \ > + include/hw/arm/sharpsl.h \ > + include/hw/arm/xlnx-zynqmp.h \ > + include/hw/block/fdc.h \ > + include/hw/block/flash.h \ > + include/hw/char/escc.h \ > + include/hw/char/pl011.h \ > + include/hw/char/xilinx_uartlite.h \ > + include/hw/cris/etraxfs.h \ > + include/hw/cris/etraxfs_dma.h \ > + include/hw/elf_ops.h \ > + include/hw/empty_slot.h \ > + include/hw/i2c/aspeed_i2c.h \ > + include/hw/i2c/i2c-ddc.h \ > + include/hw/i2c/pm_smbus.h \ > + include/hw/i386/apic_internal.h \ > + include/hw/i386/intel_iommu.h \ > + include/hw/i386/ioapic_internal.h \ > + include/hw/input/hid.h \ > + include/hw/intc/allwinner-a10-pic.h \ > + include/hw/isa/i8257.h \ > + include/hw/isa/vt82c686.h \ > + include/hw/kvm/clock.h \ > + include/hw/mips/bios.h \ > + include/hw/mips/cpudevs.h \ > + include/hw/mips/mips.h \ > + include/hw/misc/mips_cmgcr.h \ > + include/hw/misc/mips_cpc.h \ > + include/hw/misc/mips_itu.h \ > + include/hw/net/allwinner_emac.h \ > + include/hw/nvram/openbios_firmware_abi.h \ > + include/hw/pci-host/apb.h \ > + include/hw/pci-host/spapr.h \ > + include/hw/pci/pci_bus.h \ > + include/hw/pci/pcie_aer.h \ > + include/hw/ppc/ppc.h \ > + include/hw/ppc/ppc4xx.h \ > + include/hw/ppc/spapr.h \ > + include/hw/ppc/spapr_cpu_core.h \ > + include/hw/ppc/spapr_vio.h \ > + include/hw/ppc/xics.h \ > + include/hw/sparc/grlib.h \ > + include/hw/sparc/sparc32_dma.h \ > + include/hw/ssi/xilinx_spips.h \ > + include/hw/timer/allwinner-a10-pit.h \ > + include/hw/timer/aspeed_timer.h \ > + include/hw/timer/i8254_internal.h \ > + include/hw/timer/m48t59.h \ > + include/hw/virtio/virtio-access.h \ > + include/hw/virtio/virtio-input.h \ > + include/hw/virtio/virtio-rng.h \ > + include/libdecnumber/decNumberLocal.h \ > + include/migration/cpu.h \ > + include/monitor/hmp-target.h \ > + include/qemu/ratelimit.h \ > + include/qemu/thread-win32.h \ > + include/sysemu/balloon.h \ > + include/sysemu/cpus.h \ > + include/sysemu/dump.h \ > + include/sysemu/iothread.h \ > + include/sysemu/kvm_int.h \ > + include/sysemu/memory_mapping.h \ > + include/sysemu/os-win32.h \ > + include/sysemu/tpm.h \ > + include/sysemu/xen-mapcache.h \ > + include/trace-tcg.h \ > + include/ui/egl-context.h \ > + include/ui/egl-helpers.h \ > + include/ui/gtk.h \ > + include/ui/input.h \ > + include/ui/pixel_ops.h \ > + include/ui/sdl2.h \ > + include/ui/spice-display.h \ > + linux-headers/asm-arm64/kvm.h \ > + linux-headers/asm-mips/unistd.h \ > + linux-headers/asm-powerpc/kvm_para.h \ > + linux-user/aarch64/target_cpu.h \ > + linux-user/aarch64/target_signal.h \ > + linux-user/aarch64/target_structs.h \ > + linux-user/aarch64/termbits.h \ > + linux-user/alpha/target_cpu.h \ > + linux-user/alpha/target_signal.h \ > + linux-user/alpha/target_structs.h \ > + linux-user/alpha/target_syscall.h \ > + linux-user/alpha/termbits.h \ > + linux-user/arm/nwfpe/fpa11.h \ > + linux-user/arm/nwfpe/fpopcode.h \ > + linux-user/arm/target_cpu.h \ > + linux-user/arm/target_signal.h \ > + linux-user/arm/target_structs.h \ > + linux-user/arm/target_syscall.h \ > + linux-user/arm/termbits.h \ > + linux-user/cris/target_cpu.h \ > + linux-user/cris/target_signal.h \ > + linux-user/cris/target_structs.h \ > + linux-user/cris/termbits.h \ > + linux-user/flat.h \ > + linux-user/i386/target_cpu.h \ > + linux-user/i386/target_signal.h \ > + linux-user/i386/target_structs.h \ > + linux-user/i386/target_syscall.h \ > + linux-user/i386/termbits.h \ > + linux-user/ioctls.h \ > + linux-user/m68k/target_cpu.h \ > + linux-user/m68k/target_signal.h \ > + linux-user/m68k/target_structs.h \ > + linux-user/m68k/target_syscall.h \ > + linux-user/m68k/termbits.h \ > + linux-user/microblaze/target_cpu.h \ > + linux-user/microblaze/target_signal.h \ > + linux-user/microblaze/target_structs.h \ > + linux-user/microblaze/termbits.h \ > + linux-user/mips/target_cpu.h \ > + linux-user/mips/target_signal.h \ > + linux-user/mips/target_structs.h \ > + linux-user/mips/target_syscall.h \ > + linux-user/mips/termbits.h \ > + linux-user/mips64/syscall_nr.h \ > + linux-user/mips64/target_cpu.h \ > + linux-user/mips64/target_signal.h \ > + linux-user/mips64/target_structs.h \ > + linux-user/mips64/target_syscall.h \ > + linux-user/mips64/termbits.h \ > + linux-user/openrisc/target_cpu.h \ > + linux-user/openrisc/target_signal.h \ > + linux-user/openrisc/target_structs.h \ > + linux-user/openrisc/target_syscall.h \ > + linux-user/openrisc/termbits.h \ > + linux-user/ppc/syscall_nr.h \ > + linux-user/ppc/target_cpu.h \ > + linux-user/ppc/target_signal.h \ > + linux-user/ppc/target_structs.h \ > + linux-user/ppc/target_syscall.h \ > + linux-user/ppc/termbits.h \ > + linux-user/qemu.h \ > + linux-user/s390x/target_cpu.h \ > + linux-user/s390x/target_signal.h \ > + linux-user/s390x/target_structs.h \ > + linux-user/s390x/target_syscall.h \ > + linux-user/s390x/termbits.h \ > + linux-user/sh4/target_cpu.h \ > + linux-user/sh4/target_signal.h \ > + linux-user/sh4/target_structs.h \ > + linux-user/sh4/termbits.h \ > + linux-user/socket.h \ > + linux-user/sparc/target_cpu.h \ > + linux-user/sparc/target_signal.h \ > + linux-user/sparc/target_structs.h \ > + linux-user/sparc/target_syscall.h \ > + linux-user/sparc/termbits.h \ > + linux-user/sparc64/target_cpu.h \ > + linux-user/sparc64/target_signal.h \ > + linux-user/sparc64/target_structs.h \ > + linux-user/sparc64/target_syscall.h \ > + linux-user/sparc64/termbits.h \ > + linux-user/syscall_defs.h \ > + linux-user/syscall_types.h \ > + linux-user/tilegx/target_cpu.h \ > + linux-user/tilegx/target_signal.h \ > + linux-user/tilegx/target_structs.h \ > + linux-user/tilegx/target_syscall.h \ > + linux-user/unicore32/target_cpu.h \ > + linux-user/unicore32/target_signal.h \ > + linux-user/unicore32/target_structs.h \ > + linux-user/unicore32/target_syscall.h \ > + linux-user/unicore32/termbits.h \ > + linux-user/x86_64/target_cpu.h \ > + linux-user/x86_64/target_signal.h \ > + linux-user/x86_64/target_structs.h \ > + linux-user/x86_64/target_syscall.h \ > + linux-user/x86_64/termbits.h \ > + pc-bios/optionrom/optionrom.h \ > + pc-bios/s390-ccw/bootmap.h \ > + pc-bios/s390-ccw/cio.h \ > + pc-bios/s390-ccw/iplb.h \ > + pc-bios/s390-ccw/s390-ccw.h \ > + pc-bios/s390-ccw/scsi.h \ > + pc-bios/s390-ccw/virtio-scsi.h \ > + pc-bios/s390-ccw/virtio.h \ > + qemu-options-wrapper.h \ > + qga/guest-agent-core.h \ > + qga/service-win32.h \ > + qga/vss-win32/requester.h \ > + qga/vss-win32/vss-common.h \ > + replay/replay-internal.h \ > + scripts/cocci-macro-file.h \ > + slirp/bootp.h \ > + slirp/ip.h \ > + slirp/ip6_icmp.h \ > + slirp/ip_icmp.h \ > + slirp/main.h \ > + slirp/mbuf.h \ > + slirp/misc.h \ > + slirp/sbuf.h \ > + slirp/socket.h \ > + slirp/tcp.h \ > + slirp/tcp_timer.h \ > + slirp/tcp_var.h \ > + slirp/tcpip.h \ > + slirp/tftp.h \ > + slirp/udp.h \ > + softmmu_template.h \ > + target-alpha/cpu.h \ > + target-alpha/helper.h \ > + target-arm/arm_ldst.h \ > + target-arm/cpu.h \ > + target-arm/helper-a64.h \ > + target-arm/helper.h \ > + target-arm/internals.h \ > + target-arm/kvm_arm.h \ > + target-arm/op_addsub.h \ > + target-arm/translate.h \ > + target-cris/cpu.h \ > + target-cris/helper.h \ > + target-cris/mmu.h \ > + target-i386/cc_helper_template.h \ > + target-i386/cpu-qom.h \ > + target-i386/cpu.h \ > + target-i386/helper.h \ > + target-i386/hyperv.h \ > + target-i386/kvm_i386.h \ > + target-i386/ops_sse.h \ > + target-i386/ops_sse_header.h \ > + target-i386/shift_helper_template.h \ > + target-lm32/cpu.h \ > + target-lm32/helper.h \ > + target-m68k/cpu.h \ > + target-m68k/helper.h \ > + target-microblaze/cpu.h \ > + target-microblaze/helper.h \ > + target-microblaze/mmu.h \ > + target-mips/cpu-qom.h \ > + target-mips/cpu.h \ > + target-mips/helper.h \ > + target-mips/kvm_mips.h \ > + target-mips/mips-defs.h \ > + target-moxie/cpu.h \ > + target-moxie/helper.h \ > + target-moxie/machine.h \ > + target-moxie/mmu.h \ > + target-openrisc/cpu.h \ > + target-openrisc/exception.h \ > + target-openrisc/helper.h \ > + target-ppc/cpu-models.h \ > + target-ppc/cpu-qom.h \ > + target-ppc/cpu.h \ > + target-ppc/helper.h \ > + target-ppc/helper_regs.h \ > + target-ppc/kvm_ppc.h \ > + target-ppc/mmu-hash32.h \ > + target-ppc/mmu-hash64.h \ > + target-s390x/cpu.h \ > + target-s390x/helper.h \ > + target-sh4/cpu.h \ > + target-sh4/helper.h \ > + target-sparc/cpu-qom.h \ > + target-sparc/cpu.h \ > + target-sparc/helper.h \ > + target-tilegx/cpu.h \ > + target-tilegx/helper.h \ > + target-tricore/cpu.h \ > + target-tricore/helper.h \ > + target-tricore/tricore-defs.h \ > + target-tricore/tricore-opcodes.h \ > + target-unicore32/cpu.h \ > + target-unicore32/helper.h \ > + target-xtensa/cpu.h \ > + target-xtensa/helper.h \ > + target-xtensa/overlay_tool.h \ > + tcg/mips/tcg-target.h \ > + tcg/tcg-be-ldst.h \ > + tcg/tcg-be-null.h \ > + tcg/tcg-op.h \ > + tcg/tcg-opc.h \ > + tcg/tcg-runtime.h \ > + tcg/tcg.h \ > + tests/crypto-tls-x509-helpers.h \ > + tests/multiboot/libc.h \ > + tests/multiboot/multiboot.h \ > + tests/tcg/cris/crisutils.h \ > + tests/tcg/cris/sys.h \ > + tests/tcg/mips/mips64-dsp/io.h \ > + tests/tcg/mips/mips64-dspr2/io.h \ > + tests/tcg/test-i386-muldiv.h \ > + tests/tcg/test-i386-shift.h \ > + tests/tcg/test-i386.h \ > + trace/control-internal.h \ > + trace/generated-tcg-tracers.h \ > + trace/mem-internal.h \ > + trace/mem.h \ > + trace/simple.h \ > + translate-all.h \ > + ui/curses_keys.h \ > + ui/sdl2-keymap.h \ > + ui/sdl_keysym.h \ > + ui/sdl_zoom.h \ > + ui/sdl_zoom_template.h \ > + ui/vgafont.h \ > + ui/vnc-auth-sasl.h \ > + ui/vnc-auth-vencrypt.h \ > + ui/vnc-enc-hextile-template.h \ > + ui/vnc-jobs.h \ > + ui/vnc-ws.h \ > + ui/vnc_keysym.h > +checked-headers := $(filter-out $(blacklisted-headers), $(headers)) > +-include $(patsubst %.h,tests/headers/%.d, $(checked-headers)) > > # Deps that are common to various different sets of tests below > test-util-obj-y = libqemuutil.a libqemustub.a > @@ -647,6 +1062,7 @@ check-help: > @echo " make check-unit Run qobject tests" > @echo " make check-qapi-schema Run QAPI schema tests" > @echo " make check-block Run block tests" > + @echo " make check-headers Run header sanity tests" > @echo " make check-report.html Generates an HTML test report" > @echo " make check-clean Clean the tests" > @echo > @@ -728,8 +1144,18 @@ $(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/%.json > @perl -p -e 's|\Q$(SRC_PATH)\E/||g' $*.test.err | diff -q $(SRC_PATH)/$*.err - > @diff -q $(SRC_PATH)/$*.exit $*.test.exit > > +# Header sanity checking > + > +tests/headers/%.c: tests/header-test-template.c > + @mkdir -p $(dir $@) > + @sed 's,@header@,$(subst tests/headers/,,$(@:.c=.h)),' <$< >$@ > + > # Consolidated targets > > +.PHONY: check-headers check-blacklisted-headers > +check-headers: $(patsubst %.h,tests/headers/%.o, $(checked-headers)) > +check-blacklisted-headers: $(patsubst %.h,tests/headers/%.o, $(blacklisted-headers)) > + > .PHONY: check-qapi-schema check-qtest check-unit check check-clean > check-qapi-schema: $(patsubst %,check-%, $(check-qapi-schema-y)) > check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS)) >
On 23 June 2016 at 17:40, Paolo Bonzini <pbonzini@redhat.com> wrote: > On 23/06/2016 18:12, Markus Armbruster wrote: >> For each header "FOO.h", the test checks whether >> >> #include "qemu/osdep.h" >> #include "FOO.h" >> #include "FOO.h" >> >> compiles. A large number of headers don't pass this test, by design >> or by accident. These are all excluded with a blacklist for now. Add >> make target check-blacklisted-headers to help with examinating how >> they fail. > > Can we replace the blacklist with a fixed-format /* FIXME */ comment? Ooh. I was going to suggest moving the blacklist into its own file, but a magic comment is a better idea, less chance of merge conflicts. Rather than listing "check-headers" specifically in the help, I suggest we have a more generic "check-source" for running code style/etc checks on the sources (of which check-headers is the only one at first). Then we have a good place to put new style type checks in future without requiring everybody to change the command lines they're using to invoke them. thanks -- PMM
On 06/23/2016 10:12 AM, Markus Armbruster wrote: > For each header "FOO.h", the test checks whether > > #include "qemu/osdep.h" > #include "FOO.h" > #include "FOO.h" > > compiles. A large number of headers don't pass this test, by design > or by accident. These are all excluded with a blacklist for now. Add > make target check-blacklisted-headers to help with examinating how s/examinating/examining/ > they fail. > > Signed-off-by: Markus Armbruster <armbru@redhat.com> > --- > tests/Makefile.include | 426 +++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 426 insertions(+) > > diff --git a/tests/Makefile.include b/tests/Makefile.include > index a2ed83b..e20f437 100644 > --- a/tests/Makefile.include > +++ b/tests/Makefile.include > @@ -413,6 +413,421 @@ test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \ > $(test-obj-y): QEMU_INCLUDES += -Itests > QEMU_CFLAGS += -I$(SRC_PATH)/tests > > +# All headers > +headers := $(filter %.h, $(shell cd $(SRC_PATH) && git ls-files) $(GENERATED_HEADERS)) Hard-coded to only work on a git checkout, but I guess that's okay.
Peter Maydell <peter.maydell@linaro.org> writes: > On 23 June 2016 at 17:40, Paolo Bonzini <pbonzini@redhat.com> wrote: >> On 23/06/2016 18:12, Markus Armbruster wrote: >>> For each header "FOO.h", the test checks whether >>> >>> #include "qemu/osdep.h" >>> #include "FOO.h" >>> #include "FOO.h" >>> >>> compiles. A large number of headers don't pass this test, by design >>> or by accident. These are all excluded with a blacklist for now. Add >>> make target check-blacklisted-headers to help with examinating how >>> they fail. >> >> Can we replace the blacklist with a fixed-format /* FIXME */ comment? Great idea, will do! > Ooh. I was going to suggest moving the blacklist into its own > file, but a magic comment is a better idea, less chance of > merge conflicts. > > Rather than listing "check-headers" specifically in the help, > I suggest we have a more generic "check-source" for running > code style/etc checks on the sources (of which check-headers > is the only one at first). Then we have a good place to put > new style type checks in future without requiring everybody > to change the command lines they're using to invoke them. Sure.
Eric Blake <eblake@redhat.com> writes: > On 06/23/2016 10:12 AM, Markus Armbruster wrote: >> For each header "FOO.h", the test checks whether >> >> #include "qemu/osdep.h" >> #include "FOO.h" >> #include "FOO.h" >> >> compiles. A large number of headers don't pass this test, by design >> or by accident. These are all excluded with a blacklist for now. Add >> make target check-blacklisted-headers to help with examinating how > > s/examinating/examining/ > >> they fail. >> >> Signed-off-by: Markus Armbruster <armbru@redhat.com> >> --- >> tests/Makefile.include | 426 +++++++++++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 426 insertions(+) >> >> diff --git a/tests/Makefile.include b/tests/Makefile.include >> index a2ed83b..e20f437 100644 >> --- a/tests/Makefile.include >> +++ b/tests/Makefile.include >> @@ -413,6 +413,421 @@ test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \ >> $(test-obj-y): QEMU_INCLUDES += -Itests >> QEMU_CFLAGS += -I$(SRC_PATH)/tests >> >> +# All headers >> +headers := $(filter %.h, $(shell cd $(SRC_PATH) && git ls-files) $(GENERATED_HEADERS)) > > Hard-coded to only work on a git checkout, but I guess that's okay. I'll mention it in the commit message.
diff --git a/tests/Makefile.include b/tests/Makefile.include index a2ed83b..e20f437 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -413,6 +413,421 @@ test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \ $(test-obj-y): QEMU_INCLUDES += -Itests QEMU_CFLAGS += -I$(SRC_PATH)/tests +# All headers +headers := $(filter %.h, $(shell cd $(SRC_PATH) && git ls-files) $(GENERATED_HEADERS)) +# Headers that need more than just #include "qemu/osdep.h" to compile +blacklisted-headers := \ + audio/audio_int.h \ + audio/audio_template.h \ + audio/audio_win_int.h \ + audio/dsound_template.h \ + audio/mixeng_template.h \ + audio/rate_template.h \ + block/qcow2.h \ + block/raw-aio.h \ + block/vhdx.h \ + bsd-user/i386/target_signal.h \ + bsd-user/i386/target_syscall.h \ + bsd-user/qemu.h \ + bsd-user/sparc/target_signal.h \ + bsd-user/sparc/target_syscall.h \ + bsd-user/sparc64/target_signal.h \ + bsd-user/sparc64/target_syscall.h \ + bsd-user/syscall_defs.h \ + bsd-user/x86_64/target_signal.h \ + bsd-user/x86_64/target_syscall.h \ + disas/libvixl/vixl/a64/assembler-a64.h \ + disas/libvixl/vixl/a64/constants-a64.h \ + disas/libvixl/vixl/a64/cpu-a64.h \ + disas/libvixl/vixl/a64/decoder-a64.h \ + disas/libvixl/vixl/a64/disasm-a64.h \ + disas/libvixl/vixl/a64/instructions-a64.h \ + disas/libvixl/vixl/code-buffer.h \ + disas/libvixl/vixl/compiler-intrinsics.h \ + disas/libvixl/vixl/globals.h \ + disas/libvixl/vixl/invalset.h \ + disas/libvixl/vixl/platform.h \ + disas/libvixl/vixl/utils.h \ + fpu/softfloat-macros.h \ + fpu/softfloat-specialize.h \ + hw/9pfs/9p-synth.h \ + hw/9pfs/9p-xattr.h \ + hw/audio/fmopl.h \ + hw/audio/hda-codec-common.h \ + hw/audio/lm4549.h \ + hw/block/nvme.h \ + hw/block/xen_blkif.h \ + hw/cris/boot.h \ + hw/display/cirrus_vga_rop.h \ + hw/display/cirrus_vga_rop2.h \ + hw/display/milkymist-vgafb_template.h \ + hw/display/omap_lcd_template.h \ + hw/display/pl110_template.h \ + hw/display/pxa2xx_template.h \ + hw/display/sm501_template.h \ + hw/display/tc6393xb_template.h \ + hw/display/vga-helpers.h \ + hw/display/vga_int.h \ + hw/i386/intel_iommu_internal.h \ + hw/ide/ahci.h \ + hw/lm32/lm32.h \ + hw/lm32/lm32_hwsetup.h \ + hw/lm32/milkymist-hw.h \ + hw/microblaze/boot.h \ + hw/net/e1000e_core.h \ + hw/net/e1000x_common.h \ + hw/net/ne2000.h \ + hw/net/pcnet.h \ + hw/net/rocker/rocker_desc.h \ + hw/net/rocker/rocker_fp.h \ + hw/net/rocker/rocker_of_dpa.h \ + hw/net/rocker/rocker_tlv.h \ + hw/net/rocker/rocker_world.h \ + hw/net/vmware_utils.h \ + hw/ppc/ppc405.h \ + hw/s390x/ipl.h \ + hw/s390x/s390-pci-inst.h \ + hw/s390x/s390-virtio.h \ + hw/scsi/mptsas.h \ + hw/scsi/viosrp.h \ + hw/tpm/tpm_int.h \ + hw/tpm/tpm_tis.h \ + hw/usb/desc.h \ + hw/usb/quirks.h \ + hw/xtensa/bootparam.h \ + include/block/write-threshold.h \ + include/disas/disas.h \ + include/exec/cpu-all.h \ + include/exec/cpu-defs.h \ + include/exec/cpu_ldst.h \ + include/exec/cpu_ldst_template.h \ + include/exec/cpu_ldst_useronly_template.h \ + include/exec/cputlb.h \ + include/exec/exec-all.h \ + include/exec/gen-icount.h \ + include/exec/helper-gen.h \ + include/exec/helper-proto.h \ + include/exec/helper-tcg.h \ + include/exec/ioport.h \ + include/exec/memory-internal.h \ + include/exec/ram_addr.h \ + include/exec/softmmu-semi.h \ + include/exec/tb-hash.h \ + include/exec/user/abitypes.h \ + include/exec/user/thunk.h \ + include/hw/acpi/piix4.h \ + include/hw/acpi/tco.h \ + include/hw/arm/allwinner-a10.h \ + include/hw/arm/bcm2836.h \ + include/hw/arm/digic.h \ + include/hw/arm/fsl-imx25.h \ + include/hw/arm/fsl-imx31.h \ + include/hw/arm/fsl-imx6.h \ + include/hw/arm/sharpsl.h \ + include/hw/arm/xlnx-zynqmp.h \ + include/hw/block/fdc.h \ + include/hw/block/flash.h \ + include/hw/char/escc.h \ + include/hw/char/pl011.h \ + include/hw/char/xilinx_uartlite.h \ + include/hw/cris/etraxfs.h \ + include/hw/cris/etraxfs_dma.h \ + include/hw/elf_ops.h \ + include/hw/empty_slot.h \ + include/hw/i2c/aspeed_i2c.h \ + include/hw/i2c/i2c-ddc.h \ + include/hw/i2c/pm_smbus.h \ + include/hw/i386/apic_internal.h \ + include/hw/i386/intel_iommu.h \ + include/hw/i386/ioapic_internal.h \ + include/hw/input/hid.h \ + include/hw/intc/allwinner-a10-pic.h \ + include/hw/isa/i8257.h \ + include/hw/isa/vt82c686.h \ + include/hw/kvm/clock.h \ + include/hw/mips/bios.h \ + include/hw/mips/cpudevs.h \ + include/hw/mips/mips.h \ + include/hw/misc/mips_cmgcr.h \ + include/hw/misc/mips_cpc.h \ + include/hw/misc/mips_itu.h \ + include/hw/net/allwinner_emac.h \ + include/hw/nvram/openbios_firmware_abi.h \ + include/hw/pci-host/apb.h \ + include/hw/pci-host/spapr.h \ + include/hw/pci/pci_bus.h \ + include/hw/pci/pcie_aer.h \ + include/hw/ppc/ppc.h \ + include/hw/ppc/ppc4xx.h \ + include/hw/ppc/spapr.h \ + include/hw/ppc/spapr_cpu_core.h \ + include/hw/ppc/spapr_vio.h \ + include/hw/ppc/xics.h \ + include/hw/sparc/grlib.h \ + include/hw/sparc/sparc32_dma.h \ + include/hw/ssi/xilinx_spips.h \ + include/hw/timer/allwinner-a10-pit.h \ + include/hw/timer/aspeed_timer.h \ + include/hw/timer/i8254_internal.h \ + include/hw/timer/m48t59.h \ + include/hw/virtio/virtio-access.h \ + include/hw/virtio/virtio-input.h \ + include/hw/virtio/virtio-rng.h \ + include/libdecnumber/decNumberLocal.h \ + include/migration/cpu.h \ + include/monitor/hmp-target.h \ + include/qemu/ratelimit.h \ + include/qemu/thread-win32.h \ + include/sysemu/balloon.h \ + include/sysemu/cpus.h \ + include/sysemu/dump.h \ + include/sysemu/iothread.h \ + include/sysemu/kvm_int.h \ + include/sysemu/memory_mapping.h \ + include/sysemu/os-win32.h \ + include/sysemu/tpm.h \ + include/sysemu/xen-mapcache.h \ + include/trace-tcg.h \ + include/ui/egl-context.h \ + include/ui/egl-helpers.h \ + include/ui/gtk.h \ + include/ui/input.h \ + include/ui/pixel_ops.h \ + include/ui/sdl2.h \ + include/ui/spice-display.h \ + linux-headers/asm-arm64/kvm.h \ + linux-headers/asm-mips/unistd.h \ + linux-headers/asm-powerpc/kvm_para.h \ + linux-user/aarch64/target_cpu.h \ + linux-user/aarch64/target_signal.h \ + linux-user/aarch64/target_structs.h \ + linux-user/aarch64/termbits.h \ + linux-user/alpha/target_cpu.h \ + linux-user/alpha/target_signal.h \ + linux-user/alpha/target_structs.h \ + linux-user/alpha/target_syscall.h \ + linux-user/alpha/termbits.h \ + linux-user/arm/nwfpe/fpa11.h \ + linux-user/arm/nwfpe/fpopcode.h \ + linux-user/arm/target_cpu.h \ + linux-user/arm/target_signal.h \ + linux-user/arm/target_structs.h \ + linux-user/arm/target_syscall.h \ + linux-user/arm/termbits.h \ + linux-user/cris/target_cpu.h \ + linux-user/cris/target_signal.h \ + linux-user/cris/target_structs.h \ + linux-user/cris/termbits.h \ + linux-user/flat.h \ + linux-user/i386/target_cpu.h \ + linux-user/i386/target_signal.h \ + linux-user/i386/target_structs.h \ + linux-user/i386/target_syscall.h \ + linux-user/i386/termbits.h \ + linux-user/ioctls.h \ + linux-user/m68k/target_cpu.h \ + linux-user/m68k/target_signal.h \ + linux-user/m68k/target_structs.h \ + linux-user/m68k/target_syscall.h \ + linux-user/m68k/termbits.h \ + linux-user/microblaze/target_cpu.h \ + linux-user/microblaze/target_signal.h \ + linux-user/microblaze/target_structs.h \ + linux-user/microblaze/termbits.h \ + linux-user/mips/target_cpu.h \ + linux-user/mips/target_signal.h \ + linux-user/mips/target_structs.h \ + linux-user/mips/target_syscall.h \ + linux-user/mips/termbits.h \ + linux-user/mips64/syscall_nr.h \ + linux-user/mips64/target_cpu.h \ + linux-user/mips64/target_signal.h \ + linux-user/mips64/target_structs.h \ + linux-user/mips64/target_syscall.h \ + linux-user/mips64/termbits.h \ + linux-user/openrisc/target_cpu.h \ + linux-user/openrisc/target_signal.h \ + linux-user/openrisc/target_structs.h \ + linux-user/openrisc/target_syscall.h \ + linux-user/openrisc/termbits.h \ + linux-user/ppc/syscall_nr.h \ + linux-user/ppc/target_cpu.h \ + linux-user/ppc/target_signal.h \ + linux-user/ppc/target_structs.h \ + linux-user/ppc/target_syscall.h \ + linux-user/ppc/termbits.h \ + linux-user/qemu.h \ + linux-user/s390x/target_cpu.h \ + linux-user/s390x/target_signal.h \ + linux-user/s390x/target_structs.h \ + linux-user/s390x/target_syscall.h \ + linux-user/s390x/termbits.h \ + linux-user/sh4/target_cpu.h \ + linux-user/sh4/target_signal.h \ + linux-user/sh4/target_structs.h \ + linux-user/sh4/termbits.h \ + linux-user/socket.h \ + linux-user/sparc/target_cpu.h \ + linux-user/sparc/target_signal.h \ + linux-user/sparc/target_structs.h \ + linux-user/sparc/target_syscall.h \ + linux-user/sparc/termbits.h \ + linux-user/sparc64/target_cpu.h \ + linux-user/sparc64/target_signal.h \ + linux-user/sparc64/target_structs.h \ + linux-user/sparc64/target_syscall.h \ + linux-user/sparc64/termbits.h \ + linux-user/syscall_defs.h \ + linux-user/syscall_types.h \ + linux-user/tilegx/target_cpu.h \ + linux-user/tilegx/target_signal.h \ + linux-user/tilegx/target_structs.h \ + linux-user/tilegx/target_syscall.h \ + linux-user/unicore32/target_cpu.h \ + linux-user/unicore32/target_signal.h \ + linux-user/unicore32/target_structs.h \ + linux-user/unicore32/target_syscall.h \ + linux-user/unicore32/termbits.h \ + linux-user/x86_64/target_cpu.h \ + linux-user/x86_64/target_signal.h \ + linux-user/x86_64/target_structs.h \ + linux-user/x86_64/target_syscall.h \ + linux-user/x86_64/termbits.h \ + pc-bios/optionrom/optionrom.h \ + pc-bios/s390-ccw/bootmap.h \ + pc-bios/s390-ccw/cio.h \ + pc-bios/s390-ccw/iplb.h \ + pc-bios/s390-ccw/s390-ccw.h \ + pc-bios/s390-ccw/scsi.h \ + pc-bios/s390-ccw/virtio-scsi.h \ + pc-bios/s390-ccw/virtio.h \ + qemu-options-wrapper.h \ + qga/guest-agent-core.h \ + qga/service-win32.h \ + qga/vss-win32/requester.h \ + qga/vss-win32/vss-common.h \ + replay/replay-internal.h \ + scripts/cocci-macro-file.h \ + slirp/bootp.h \ + slirp/ip.h \ + slirp/ip6_icmp.h \ + slirp/ip_icmp.h \ + slirp/main.h \ + slirp/mbuf.h \ + slirp/misc.h \ + slirp/sbuf.h \ + slirp/socket.h \ + slirp/tcp.h \ + slirp/tcp_timer.h \ + slirp/tcp_var.h \ + slirp/tcpip.h \ + slirp/tftp.h \ + slirp/udp.h \ + softmmu_template.h \ + target-alpha/cpu.h \ + target-alpha/helper.h \ + target-arm/arm_ldst.h \ + target-arm/cpu.h \ + target-arm/helper-a64.h \ + target-arm/helper.h \ + target-arm/internals.h \ + target-arm/kvm_arm.h \ + target-arm/op_addsub.h \ + target-arm/translate.h \ + target-cris/cpu.h \ + target-cris/helper.h \ + target-cris/mmu.h \ + target-i386/cc_helper_template.h \ + target-i386/cpu-qom.h \ + target-i386/cpu.h \ + target-i386/helper.h \ + target-i386/hyperv.h \ + target-i386/kvm_i386.h \ + target-i386/ops_sse.h \ + target-i386/ops_sse_header.h \ + target-i386/shift_helper_template.h \ + target-lm32/cpu.h \ + target-lm32/helper.h \ + target-m68k/cpu.h \ + target-m68k/helper.h \ + target-microblaze/cpu.h \ + target-microblaze/helper.h \ + target-microblaze/mmu.h \ + target-mips/cpu-qom.h \ + target-mips/cpu.h \ + target-mips/helper.h \ + target-mips/kvm_mips.h \ + target-mips/mips-defs.h \ + target-moxie/cpu.h \ + target-moxie/helper.h \ + target-moxie/machine.h \ + target-moxie/mmu.h \ + target-openrisc/cpu.h \ + target-openrisc/exception.h \ + target-openrisc/helper.h \ + target-ppc/cpu-models.h \ + target-ppc/cpu-qom.h \ + target-ppc/cpu.h \ + target-ppc/helper.h \ + target-ppc/helper_regs.h \ + target-ppc/kvm_ppc.h \ + target-ppc/mmu-hash32.h \ + target-ppc/mmu-hash64.h \ + target-s390x/cpu.h \ + target-s390x/helper.h \ + target-sh4/cpu.h \ + target-sh4/helper.h \ + target-sparc/cpu-qom.h \ + target-sparc/cpu.h \ + target-sparc/helper.h \ + target-tilegx/cpu.h \ + target-tilegx/helper.h \ + target-tricore/cpu.h \ + target-tricore/helper.h \ + target-tricore/tricore-defs.h \ + target-tricore/tricore-opcodes.h \ + target-unicore32/cpu.h \ + target-unicore32/helper.h \ + target-xtensa/cpu.h \ + target-xtensa/helper.h \ + target-xtensa/overlay_tool.h \ + tcg/mips/tcg-target.h \ + tcg/tcg-be-ldst.h \ + tcg/tcg-be-null.h \ + tcg/tcg-op.h \ + tcg/tcg-opc.h \ + tcg/tcg-runtime.h \ + tcg/tcg.h \ + tests/crypto-tls-x509-helpers.h \ + tests/multiboot/libc.h \ + tests/multiboot/multiboot.h \ + tests/tcg/cris/crisutils.h \ + tests/tcg/cris/sys.h \ + tests/tcg/mips/mips64-dsp/io.h \ + tests/tcg/mips/mips64-dspr2/io.h \ + tests/tcg/test-i386-muldiv.h \ + tests/tcg/test-i386-shift.h \ + tests/tcg/test-i386.h \ + trace/control-internal.h \ + trace/generated-tcg-tracers.h \ + trace/mem-internal.h \ + trace/mem.h \ + trace/simple.h \ + translate-all.h \ + ui/curses_keys.h \ + ui/sdl2-keymap.h \ + ui/sdl_keysym.h \ + ui/sdl_zoom.h \ + ui/sdl_zoom_template.h \ + ui/vgafont.h \ + ui/vnc-auth-sasl.h \ + ui/vnc-auth-vencrypt.h \ + ui/vnc-enc-hextile-template.h \ + ui/vnc-jobs.h \ + ui/vnc-ws.h \ + ui/vnc_keysym.h +checked-headers := $(filter-out $(blacklisted-headers), $(headers)) +-include $(patsubst %.h,tests/headers/%.d, $(checked-headers)) # Deps that are common to various different sets of tests below test-util-obj-y = libqemuutil.a libqemustub.a @@ -647,6 +1062,7 @@ check-help: @echo " make check-unit Run qobject tests" @echo " make check-qapi-schema Run QAPI schema tests" @echo " make check-block Run block tests" + @echo " make check-headers Run header sanity tests" @echo " make check-report.html Generates an HTML test report" @echo " make check-clean Clean the tests" @echo @@ -728,8 +1144,18 @@ $(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/%.json @perl -p -e 's|\Q$(SRC_PATH)\E/||g' $*.test.err | diff -q $(SRC_PATH)/$*.err - @diff -q $(SRC_PATH)/$*.exit $*.test.exit +# Header sanity checking + +tests/headers/%.c: tests/header-test-template.c + @mkdir -p $(dir $@) + @sed 's,@header@,$(subst tests/headers/,,$(@:.c=.h)),' <$< >$@ + # Consolidated targets +.PHONY: check-headers check-blacklisted-headers +check-headers: $(patsubst %.h,tests/headers/%.o, $(checked-headers)) +check-blacklisted-headers: $(patsubst %.h,tests/headers/%.o, $(blacklisted-headers)) + .PHONY: check-qapi-schema check-qtest check-unit check check-clean check-qapi-schema: $(patsubst %,check-%, $(check-qapi-schema-y)) check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
For each header "FOO.h", the test checks whether #include "qemu/osdep.h" #include "FOO.h" #include "FOO.h" compiles. A large number of headers don't pass this test, by design or by accident. These are all excluded with a blacklist for now. Add make target check-blacklisted-headers to help with examinating how they fail. Signed-off-by: Markus Armbruster <armbru@redhat.com> --- tests/Makefile.include | 426 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 426 insertions(+)