new file mode 100644
@@ -0,0 +1,5 @@
+# Simply check if QEMU will run without errors using a CPU model:
+command-line: '$QEMU -S -cpu $CPU'
+expected-failures:
+ # "host" doesn't always work
+ - CPU: 'host'
new file mode 100644
@@ -0,0 +1,17 @@
+# This test specification will try device_add with all device types
+command-line: '$QEMU -S -machine $MACHINE,accel=$ACCEL'
+monitor-commands:
+- qmp:
+ - execute: 'device_add'
+ arguments:
+ driver: '$DEVICE'
+ id: 'test-device-for-$DEVICE'
+ - execute: 'device_del'
+ arguments:
+ id: 'test-device-for-$DEVICE'
+defaults:
+ MACHINE: 'none'
+ ACCEL: 'kvm:tcg'
+expected-failures:
+ - MACHINE: 'xenpv'
+ - MACHINE: 'xenfv'
new file mode 100644
@@ -0,0 +1,7 @@
+# this is a very simple test case generator that will run QEMU
+# using all combinations of -machine and -device.
+# This replaces scripts/device-crash-test.
+# TODO: use a $MACHINE_OPT variable to make -machine optional
+command-line: '$QEMU -S -machine $MACHINE,accel=$ACCEL -device $DEVICE'
+
+#TODO: represent the whitelist from device-crash-test script somehow
new file mode 100644
@@ -0,0 +1,3 @@
+# Just check if -device ...,help works:
+command-line: '$QEMU -device $DEVICE,help'
+qmp: false
new file mode 100644
@@ -0,0 +1,23 @@
+# This test specification is equivalent to "device/introspect/concrete" in
+# tests/device-introspect-test.c
+command-line: '$QEMU -S -machine $MACHINE,accel=$ACCEL'
+monitor-commands:
+- qmp:
+ - execute: 'device-list-properties'
+ arguments:
+ typename: '$DEVICE'
+- hmp: 'device_add $DEVICE,help'
+- hmp: 'info qom-tree'
+defaults:
+ MACHINE: 'none'
+ ACCEL: 'kvm:tcg'
+expected-failures:
+ - MACHINE: 'xenpv'
+ - MACHINE: 'xenfv'
+
+#TODO: the test runner could support something like:
+# extra-cases:
+# # like "device/introspect/none":
+# - DEVICE: 'nonexistent'
+# # like "device/introspect/abstract":
+# - DEVICE: 'device'
new file mode 100644
@@ -0,0 +1,10 @@
+# this test specification is equivalent to the
+# "device/introspect/list" test case in device-introspect-test.c
+command-line: '$QEMU -nodefaults -machine none'
+monitor-commands:
+- qmp:
+ - execute: qom-list-types
+ arguments:
+ implements: 'device'
+ abstract: true
+- hmp: 'device_add help'
new file mode 100644
@@ -0,0 +1,3 @@
+# just run $QEMU -help and ensure it won't crash
+command-line: '$QEMU -help'
+qmp: false
These test case specifications demonstrate what kind of tests can be specified using validator.py. Most of them can replace existing unit tests written in C, and device-crash-test.yaml can replace most of the functionality of scripts/device-crash-test. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- tests/validator/cpu.yaml | 5 +++++ tests/validator/device-add.yaml | 17 +++++++++++++++++ tests/validator/device-crash-test.yaml | 7 +++++++ tests/validator/device-help.yaml | 3 +++ tests/validator/device-introspect.yaml | 23 +++++++++++++++++++++++ tests/validator/device-list.yaml | 10 ++++++++++ tests/validator/just-help.yaml | 3 +++ 7 files changed, 68 insertions(+) create mode 100644 tests/validator/cpu.yaml create mode 100644 tests/validator/device-add.yaml create mode 100644 tests/validator/device-crash-test.yaml create mode 100644 tests/validator/device-help.yaml create mode 100644 tests/validator/device-introspect.yaml create mode 100644 tests/validator/device-list.yaml create mode 100644 tests/validator/just-help.yaml