-#!/usr/bin/env python2.7
+#!/usr/bin/env python3
#
# Copyright (c) 2017 Red Hat Inc
#
check for crashes and unexpected errors.
"""
-import sys
import os
+import sys
import glob
import logging
import traceback
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
# 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
{'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
{'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
{'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
{'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
# 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':-11, 'device':'gus', 'loglevel':logging.ERROR, 'expected':True},
- {'exitcode':-11, 'device':'isa-serial', 'loglevel':logging.ERROR, 'expected':True},
- {'exitcode':-11, 'device':'sb16', 'loglevel':logging.ERROR, 'expected':True},
- {'exitcode':-11, 'device':'cs4231a', 'loglevel':logging.ERROR, 'expected':True},
- {'exitcode':-11, 'machine':'isapc', 'device':'.*-iommu', 'loglevel':logging.ERROR, 'expected':True},
-
# everything else (including SIGABRT and SIGSEGV) will be a fatal error:
{'exitcode':None, 'fatal':True, 'loglevel':logging.FATAL},
]
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
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)