X-Git-Url: https://repo.jachan.dev/qemu.git/blobdiff_plain/62a2b55e8d098d91908b17fc37cb1a4f2a854f8f..e95e05dab6607d9e86cd2eaa3ae4508bf7bb8fbb:/scripts/device-crash-test diff --git a/scripts/device-crash-test b/scripts/device-crash-test index 24c7bf5a16..305d0427af 100755 --- a/scripts/device-crash-test +++ b/scripts/device-crash-test @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2017 Red Hat Inc # @@ -24,8 +24,8 @@ Run QEMU with all combinations of -machine and -device types, check for crashes and unexpected errors. """ -import sys import os +import sys import glob import logging import traceback @@ -34,8 +34,8 @@ import random import argparse from itertools import chain -sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'scripts')) -from qemu import QEMUMachine +sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python')) +from qemu.machine import QEMUMachine logger = logging.getLogger('device-crash-test') dbg = logger.debug @@ -72,21 +72,6 @@ ERROR_WHITELIST = [ # devices that don't work out of the box because they require extra options to "-device DEV": # DEVICE | ERROR MESSAGE {'device':'.*-(i386|x86_64)-cpu', 'expected':True}, # CPU socket-id is not set - {'device':'ARM,bitband-memory', 'expected':True}, # source-memory property not set - {'device':'arm.cortex-a9-global-timer', 'expected':True}, # a9_gtimer_realize: num-cpu must be between 1 and 4 - {'device':'arm_mptimer', 'expected':True}, # num-cpu must be between 1 and 4 - {'device':'armv7m', 'expected':True}, # memory property was not set - {'device':'aspeed.scu', 'expected':True}, # Unknown silicon revision: 0x0 - {'device':'aspeed.sdmc', 'expected':True}, # Unknown silicon revision: 0x0 - {'device':'bcm2835-dma', 'expected':True}, # bcm2835_dma_realize: required dma-mr link not found: Property '.dma-mr' not found - {'device':'bcm2835-fb', 'expected':True}, # bcm2835_fb_realize: required vcram-base property not set - {'device':'bcm2835-mbox', 'expected':True}, # bcm2835_mbox_realize: required mbox-mr link not found: Property '.mbox-mr' not found - {'device':'bcm2835-peripherals', 'expected':True}, # bcm2835_peripherals_realize: required ram link not found: Property '.ram' not found - {'device':'bcm2835-property', 'expected':True}, # bcm2835_property_realize: required fb link not found: Property '.fb' not found - {'device':'bcm2835_gpio', 'expected':True}, # bcm2835_gpio_realize: required sdhci link not found: Property '.sdbus-sdhci' not found - {'device':'bcm2836', 'expected':True}, # bcm2836_realize: required ram link not found: Property '.ram' not found - {'device':'cfi.pflash01', 'expected':True}, # attribute "sector-length" not specified or zero. - {'device':'cfi.pflash02', 'expected':True}, # attribute "sector-length" not specified or zero. {'device':'icp', 'expected':True}, # icp_realize: required link 'xics' not found: Property '.xics' not found {'device':'ics', 'expected':True}, # ics_base_realize: required link 'xics' not found: Property '.xics' not found # "-device ide-cd" does work on more recent QEMU versions, so it doesn't have expected=True @@ -98,8 +83,6 @@ ERROR_WHITELIST = [ {'device':'isa-ipmi-bt', 'expected':True}, # IPMI device requires a bmc attribute to be set {'device':'isa-ipmi-kcs', 'expected':True}, # IPMI device requires a bmc attribute to be set {'device':'isa-parallel', 'expected':True}, # Can't create serial device, empty char device - {'device':'isa-serial', 'expected':True}, # Can't create serial device, empty char device - {'device':'ivshmem', 'expected':True}, # You must specify either 'shm' or 'chardev' {'device':'ivshmem-doorbell', 'expected':True}, # You must specify a 'chardev' {'device':'ivshmem-plain', 'expected':True}, # You must specify a 'memdev' {'device':'loader', 'expected':True}, # please include valid arguments @@ -109,10 +92,6 @@ ERROR_WHITELIST = [ {'device':'pc-dimm', 'expected':True}, # 'memdev' property is not set {'device':'pci-bridge', 'expected':True}, # Bridge chassis not specified. Each bridge is required to be assigned a unique chassis id > 0. {'device':'pci-bridge-seat', 'expected':True}, # Bridge chassis not specified. Each bridge is required to be assigned a unique chassis id > 0. - {'device':'pci-serial', 'expected':True}, # Can't create serial device, empty char device - {'device':'pci-serial-2x', 'expected':True}, # Can't create serial device, empty char device - {'device':'pci-serial-4x', 'expected':True}, # Can't create serial device, empty char device - {'device':'pxa2xx-dma', 'expected':True}, # channels value invalid {'device':'pxb', 'expected':True}, # Bridge chassis not specified. Each bridge is required to be assigned a unique chassis id > 0. {'device':'scsi-block', 'expected':True}, # drive property not set {'device':'scsi-disk', 'expected':True}, # drive property not set @@ -124,7 +103,7 @@ ERROR_WHITELIST = [ {'device':'tpm-tis', 'expected':True}, # tpm_tis: backend driver with id (null) could not be found {'device':'unimplemented-device', 'expected':True}, # property 'size' not specified or zero {'device':'usb-braille', 'expected':True}, # Property chardev is required - {'device':'usb-mtp', 'expected':True}, # x-root property must be configured + {'device':'usb-mtp', 'expected':True}, # rootdir property must be configured {'device':'usb-redir', 'expected':True}, # Parameter 'chardev' is missing {'device':'usb-serial', 'expected':True}, # Property chardev is required {'device':'usb-storage', 'expected':True}, # drive property not set @@ -149,7 +128,6 @@ ERROR_WHITELIST = [ {'device':'virtio-input-host-pci', 'expected':True}, # evdev property is required {'device':'xen-pvdevice', 'expected':True}, # Device ID invalid, it must always be supplied {'device':'vhost-vsock-ccw', 'expected':True}, # guest-cid property must be greater than 2 - {'device':'ALTR.timer', 'expected':True}, # "clock-frequency" property must be provided {'device':'zpci', 'expected':True}, # target must be defined {'device':'pnv-(occ|icp|lpc)', 'expected':True}, # required link 'xics' not found: Property '.xics' not found {'device':'powernv-cpu-.*', 'expected':True}, # pnv_core_realize: required link 'xics' not found: Property '.xics' not found @@ -203,26 +181,6 @@ ERROR_WHITELIST = [ # other exitcode=1 failures not listed above will just generate INFO messages: {'exitcode':1, 'loglevel':logging.INFO}, - # KNOWN CRASHES: - # Known crashes will generate error messages, but won't be fatal. - # Those entries must be removed once we fix the crashes. - {'exitcode':-6, 'log':r"Device 'serial0' is in use", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'log':r"qemu_net_client_setup: Assertion `!peer->peer' failed", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'log':r'RAMBlock "[\w.-]+" already registered', 'loglevel':logging.ERROR}, - {'exitcode':-6, 'log':r"find_ram_offset: Assertion `size != 0' failed.", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'log':r"add_cpreg_to_hashtable: code should not be reached", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'log':r"qemu_alloc_display: Assertion `surface->image != NULL' failed", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'log':r"Unexpected error in error_set_from_qdev_prop_error", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'log':r"Object .* is not an instance of type spapr-machine", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'log':r"Object .* is not an instance of type generic-pc-machine", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'log':r"Object .* is not an instance of type e500-ccsr", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'log':r"vmstate_register_with_alias_id: Assertion `!se->compat \|\| se->instance_id == 0' failed", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'device':'isa-fdc', 'loglevel':logging.ERROR, 'expected':True}, - {'exitcode':-11, 'device':'isa-serial', 'loglevel':logging.ERROR, 'expected':True}, - {'exitcode':-11, 'device':'mioe3680_pci', 'loglevel':logging.ERROR, 'expected':True}, - {'exitcode':-11, 'device':'pcm3680_pci', 'loglevel':logging.ERROR, 'expected':True}, - {'exitcode':-11, 'device':'kvaser_pci', 'loglevel':logging.ERROR, 'expected':True}, - # everything else (including SIGABRT and SIGSEGV) will be a fatal error: {'exitcode':None, 'fatal':True, 'loglevel':logging.FATAL}, ] @@ -558,7 +516,7 @@ def main(): tc[k] = v if len(binariesToTest(args, tc)) == 0: - print >>sys.stderr, "No QEMU binary found" + print("No QEMU binary found", file=sys.stderr) parser.print_usage(sys.stderr) return 1 @@ -600,7 +558,8 @@ def main(): logger.info("Skipped %d test cases", skipped) if args.debug: - stats = sorted([(len(wl_stats.get(i, [])), wl) for i, wl in enumerate(ERROR_WHITELIST)]) + stats = sorted([(len(wl_stats.get(i, [])), wl) for i, wl in + enumerate(ERROR_WHITELIST)], key=lambda x: x[0]) for count, wl in stats: dbg("whitelist entry stats: %d: %r", count, wl)