qtest: Prepare PCI NIC tests
cover qtest: Prepare PCI NIC tests
Hello Stefan,
As discussed late last year, this series starts preparing tests to cover optional NICs. They don't do any functional tests but assure that QOM/PCI refactorings don't break the basic usage of these devices.
pcnet-test.c is intended to handle sparc's lance as well.
virtio-net is missing among others (is there any ongoing work on virtio qtests?!), but I thought I'd get this out as a start. My goal will be to have every optional device in 2.0 covered by such basic tests. Hopefully it will also encourage people to write functional tests later on and to copy these stubs for new devices!
Regards,
Andreas
Andreas Färber (5):
tests: Add e1000 qtest
tests: Add vmxnet3 qtest
tests: Add rtl8139 qtest
tests: Add PC-Net qtest
tests: Add eepro100 qtest
tests/Makefile | 22 +++++++++++++++++++ tests/e1000-test.c | 35 +++++++++++++++++++++++++++++ tests/eepro100-test.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/pcnet-test.c | 35 +++++++++++++++++++++++++++++ tests/rtl8139-test.c | 35 +++++++++++++++++++++++++++++ tests/vmxnet3-test.c | 35 +++++++++++++++++++++++++++++ 6 files changed, 223 insertions(+) create mode 100644 tests/e1000-test.c create mode 100644 tests/eepro100-test.c create mode 100644 tests/pcnet-test.c create mode 100644 tests/rtl8139-test.c create mode 100644 tests/vmxnet3-test.c
Signature · 1 line
1.8.4.5
PATCH 1/5 tests: Add e1000 qtest
--- tests/Makefile | 7 +++++++ tests/e1000-test.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 tests/e1000-test.c
tests/Makefile +7 -0
@@ -64,6 +64,10 @@ check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh # All QTests for now are POSIX-only, but the dependencies are # really in libqtest, not in the testcases themselves. + +check-qtest-pci-y += tests/e1000-test$(EXESUF) +gcov-files-pci-y += hw/net/e1000.c + check-qtest-i386-y = tests/endianness-test$(EXESUF) check-qtest-i386-y += tests/fdc-test$(EXESUF) gcov-files-i386-y = hw/fdc.c
@@ -77,6 +81,8 @@ check-qtest-i386-y += tests/i440fx-test$(EXESUF) check-qtest-i386-y += tests/fw_cfg-test$(EXESUF) check-qtest-i386-y += tests/blockdev-test$(EXESUF) check-qtest-i386-y += tests/qdev-monitor-test$(EXESUF) +check-qtest-i386-y += $(check-qtest-pci-y) +gcov-files-i386-y += $(gcov-files-pci-y) check-qtest-x86_64-y = $(check-qtest-i386-y) gcov-files-i386-y += i386-softmmu/hw/mc146818rtc.c gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
@@ -196,6 +202,7 @@ tests/acpi-test$(EXESUF): tests/acpi-test.o $(libqos-obj-y) tests/tmp105-test$(EXESUF): tests/tmp105-test.o $(libqos-omap-obj-y) tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y) tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y) +tests/e1000-test$(EXESUF): tests/e1000-test.o tests/qom-test$(EXESUF): tests/qom-test.o tests/blockdev-test$(EXESUF): tests/blockdev-test.o $(libqos-pc-obj-y) tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y)
tests/e1000-test.c new file +35 -0
@@ -0,0 +1,35 @@ +/* +* QTest testcase for e1000 NIC +* +* Copyright (c) 2013-2014 SUSE LINUX Products GmbH +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ +#include "libqtest.h" + +#include <glib.h> +#include <string.h> +#include "qemu/osdep.h" + +static void nop (void ) +{ +} + +int main (int argc,char **argv) +{ +QTestState *s; +int ret; + +g_test_init (&argc, &argv,NULL ); +qtest_add_func ("/e1000/nop" , nop); + + s =qtest_start ("-device e1000" ); + ret =g_test_run (); + +if (s) { +qtest_quit (s); + } + +return ret; +}
Signature · 1 line
1.8.4.5
Re: [Qemu-devel] [PATCH qom-next 1/5] tests: Add e1000 qtest
tests/e1000-test.c line 13
Quoted 5 lines · Andreas Färber
tests/e1000-test.c new file +5
-0+#include "libqtest.h" + +#include <glib.h> +#include <string.h> +#include "qemu/osdep.h"
Please put <system.h> includes before "user.h" includes. That way we can be sure our macros don't mess up system headers.
tests/e1000-test.c line 17
Quoted 4 lines
tests/e1000-test.c new file +4
-0+ +static void nop (void ) +{ +}
I suggest a comment here to explain the point of this test:
/* The point of this test case is just to instantiate the device */
Re: [Qemu-devel] [PATCH qom-next 1/5] tests: Add e1000 qtest
Am 07.02.2014 16:48, schrieb Stefan Hajnoczi:
Quoted 9 lines · Andreas Färber
tests/e1000-test.c line 13
Quoted 5 lines
tests/e1000-test.c new file +5
-0+#include "libqtest.h" + +#include <glib.h> +#include <string.h> +#include "qemu/osdep.h" Please put <
system.h> includes before "user.h" includes. That way we can be sure our macros don't mess up system headers.
You are right in this case, but to my defense I copied this from another file. ;) You'll find the "libqtest.h"-first pattern in:
endianness-test.cfw_cfg-test.ci440fx-test.cm48t59-test.cqom-test.crtc-test.ctmp105-test.c
To make it clearer which example to copy from, feel free to submit a patch cleaning those up.
NB in general it can be a valid technique to place a single "user.h" in user.c before the usual <system> and "user" headers to assure that it does not depend on external includes, but clearly that's not the case here.
Quoted 7 lines
tests/e1000-test.c line 17
Quoted 4 lines
tests/e1000-test.c new file +4
-0+ +static void nop (void ) +{ +}I suggest a comment here to explain the point of this test:
/* The point of this test case is just to instantiate the device */
Thanks, will add a TODO.
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH qom-next 1/5] tests: Add e1000 qtest
Quoted 22 lines · Andreas Färber
Am 07.02.2014 16:48, schrieb Stefan Hajnoczi:
Quoted 9 lines · Andreas Färber
tests/e1000-test.c line 13
Quoted 5 lines
tests/e1000-test.c new file +5
-0+#include "libqtest.h" + +#include <glib.h> +#include <string.h> +#include "qemu/osdep.h" Please put <
system.h> includes before "user.h" includes. That way we can be sure our macros don't mess up system headers.You are right in this case, but to my defense I copied this from another file. ;) You'll find the "libqtest.h"-first pattern in:
endianness-test.cfw_cfg-test.ci440fx-test.cm48t59-test.cqom-test.crtc-test.ctmp105-test.c
Quoted 2 lines
To make it clearer which example to copy from, feel free to submit a patch cleaning those up.
Okay, I will. Thanks!
Stefan
PATCH 2/5 tests: Add vmxnet3 qtest
In reply to Andreas Färber--- tests/Makefile | 5 +++++ tests/vmxnet3-test.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 tests/vmxnet3-test.c
tests/Makefile +5 -0
@@ -83,6 +83,10 @@ check-qtest-i386-y += tests/blockdev-test$(EXESUF) check-qtest-i386-y += tests/qdev-monitor-test$(EXESUF) check-qtest-i386-y += $(check-qtest-pci-y) gcov-files-i386-y += $(gcov-files-pci-y) +check-qtest-i386-y += tests/vmxnet3-test$(EXESUF) +gcov-files-i386-y += hw/net/vmxnet3.c +gcov-files-i386-y += hw/net/vmxnet_rx_pkt.c +gcov-files-i386-y += hw/net/vmxnet_tx_pkt.c check-qtest-x86_64-y = $(check-qtest-i386-y) gcov-files-i386-y += i386-softmmu/hw/mc146818rtc.c gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
@@ -203,6 +207,7 @@ tests/tmp105-test$(EXESUF): tests/tmp105-test.o $(libqos-omap-obj-y) tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y) tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y) tests/e1000-test$(EXESUF): tests/e1000-test.o +tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o tests/qom-test$(EXESUF): tests/qom-test.o tests/blockdev-test$(EXESUF): tests/blockdev-test.o $(libqos-pc-obj-y) tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y)
tests/vmxnet3-test.c new file +35 -0
@@ -0,0 +1,35 @@ +/* +* QTest testcase for vmxnet3 NIC +* +* Copyright (c) 2013-2014 SUSE LINUX Products GmbH +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ +#include "libqtest.h" + +#include <glib.h> +#include <string.h> +#include "qemu/osdep.h" + +static void nop (void ) +{ +} + +int main (int argc,char **argv) +{ +QTestState *s; +int ret; + +g_test_init (&argc, &argv,NULL ); +qtest_add_func ("/vmxnet3/nop" , nop); + + s =qtest_start ("-device vmxnet3" ); + ret =g_test_run (); + +if (s) { +qtest_quit (s); + } + +return ret; +}
Signature · 1 line
1.8.4.5
PATCH 3/5 tests: Add rtl8139 qtest
In reply to Andreas Färber--- tests/Makefile | 3 +++ tests/rtl8139-test.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 tests/rtl8139-test.c
tests/Makefile +3 -0
@@ -67,6 +67,8 @@ check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh check-qtest-pci-y += tests/e1000-test$(EXESUF) gcov-files-pci-y += hw/net/e1000.c +check-qtest-pci-y += tests/rtl8139-test$(EXESUF) +gcov-files-pci-y += hw/net/rtl8139.c check-qtest-i386-y = tests/endianness-test$(EXESUF) check-qtest-i386-y += tests/fdc-test$(EXESUF)
@@ -207,6 +209,7 @@ tests/tmp105-test$(EXESUF): tests/tmp105-test.o $(libqos-omap-obj-y) tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y) tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y) tests/e1000-test$(EXESUF): tests/e1000-test.o +tests/rtl8139-test$(EXESUF): tests/rtl8139-test.o tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o tests/qom-test$(EXESUF): tests/qom-test.o tests/blockdev-test$(EXESUF): tests/blockdev-test.o $(libqos-pc-obj-y)
tests/rtl8139-test.c new file +35 -0
@@ -0,0 +1,35 @@ +/* +* QTest testcase for Realtek 8139 NIC +* +* Copyright (c) 2013-2014 SUSE LINUX Products GmbH +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ +#include "libqtest.h" + +#include <glib.h> +#include <string.h> +#include "qemu/osdep.h" + +static void nop (void ) +{ +} + +int main (int argc,char **argv) +{ +QTestState *s; +int ret; + +g_test_init (&argc, &argv,NULL ); +qtest_add_func ("/rtl8139/nop" , nop); + + s =qtest_start ("-device rtl8139" ); + ret =g_test_run (); + +if (s) { +qtest_quit (s); + } + +return ret; +}
Signature · 1 line
1.8.4.5
PATCH 4/5 tests: Add PC-Net qtest
In reply to Andreas FärberTest PCI only for now.
--- tests/Makefile | 4 ++++ tests/pcnet-test.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 tests/pcnet-test.c
tests/Makefile +4 -0
@@ -69,6 +69,9 @@ check-qtest-pci-y += tests/e1000-test$(EXESUF) gcov-files-pci-y += hw/net/e1000.c check-qtest-pci-y += tests/rtl8139-test$(EXESUF) gcov-files-pci-y += hw/net/rtl8139.c +check-qtest-pci-y += tests/pcnet-test$(EXESUF) +gcov-files-pci-y += hw/net/pcnet.c +gcov-files-pci-y += hw/net/pcnet-pci.c check-qtest-i386-y = tests/endianness-test$(EXESUF) check-qtest-i386-y += tests/fdc-test$(EXESUF)
@@ -210,6 +213,7 @@ tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y) tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y) tests/e1000-test$(EXESUF): tests/e1000-test.o tests/rtl8139-test$(EXESUF): tests/rtl8139-test.o +tests/pcnet-test$(EXESUF): tests/pcnet-test.o tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o tests/qom-test$(EXESUF): tests/qom-test.o tests/blockdev-test$(EXESUF): tests/blockdev-test.o $(libqos-pc-obj-y)
tests/pcnet-test.c new file +35 -0
@@ -0,0 +1,35 @@ +/* +* QTest testcase for PC-Net NIC +* +* Copyright (c) 2013-2014 SUSE LINUX Products GmbH +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ +#include "libqtest.h" + +#include <glib.h> +#include <string.h> +#include "qemu/osdep.h" + +static void pci_nop (void ) +{ +} + +int main (int argc,char **argv) +{ +QTestState *s; +int ret; + +g_test_init (&argc, &argv,NULL ); +qtest_add_func ("/pcnet/pci/nop" , pci_nop); + + s =qtest_start ("-device pcnet" ); + ret =g_test_run (); + +if (s) { +qtest_quit (s); + } + +return ret; +}
Signature · 1 line
1.8.4.5
PATCH 5/5 tests: Add eepro100 qtest
In reply to Andreas Färber--- tests/Makefile | 3 +++ tests/eepro100-test.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 tests/eepro100-test.c
tests/Makefile +3 -0
@@ -72,6 +72,8 @@ gcov-files-pci-y += hw/net/rtl8139.c check-qtest-pci-y += tests/pcnet-test$(EXESUF) gcov-files-pci-y += hw/net/pcnet.c gcov-files-pci-y += hw/net/pcnet-pci.c +check-qtest-pci-y += tests/eepro100-test$(EXESUF) +gcov-files-pci-y += hw/net/eepro100.c check-qtest-i386-y = tests/endianness-test$(EXESUF) check-qtest-i386-y += tests/fdc-test$(EXESUF)
@@ -214,6 +216,7 @@ tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y) tests/e1000-test$(EXESUF): tests/e1000-test.o tests/rtl8139-test$(EXESUF): tests/rtl8139-test.o tests/pcnet-test$(EXESUF): tests/pcnet-test.o +tests/eepro100-test$(EXESUF): tests/eepro100-test.o tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o tests/qom-test$(EXESUF): tests/qom-test.o tests/blockdev-test$(EXESUF): tests/blockdev-test.o $(libqos-pc-obj-y)
tests/eepro100-test.c new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
1.8.4.5
Quoted 29 lines · Andreas Färber
Hello Stefan,
As discussed late last year, this series starts preparing tests to cover optional NICs. They don't do any functional tests but assure that QOM/PCI refactorings don't break the basic usage of these devices.
pcnet-test.cis intended to handle sparc's lance as well.virtio-net is missing among others (is there any ongoing work on virtio qtests?!), but I thought I'd get this out as a start. My goal will be to have every optional device in 2.0 covered by such basic tests. Hopefully it will also encourage people to write functional tests later on and to copy these stubs for new devices!
Regards,
AndreasCc Stefan Hajnoczi <[email protected]>Cc Anthony Liguori <[email protected]>Cc Paolo Bonzini <[email protected]>Cc Peter Maydell <[email protected]>Andreas Färber (5):
tests: Add e1000 qtest
tests: Add vmxnet3 qtest
tests: Add rtl8139 qtest
tests: Add PC-Net qtest
tests: Add eepro100 qtest
Quoted 12 lines
tests/Makefile | 22 +++++++++++++++++++ tests/e1000-test.c | 35 +++++++++++++++++++++++++++++ tests/eepro100-test.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/pcnet-test.c | 35 +++++++++++++++++++++++++++++ tests/rtl8139-test.c | 35 +++++++++++++++++++++++++++++ tests/vmxnet3-test.c | 35 +++++++++++++++++++++++++++++ 6 files changed, 223 insertions(+) create mode 100644 tests/e1000-test.c create mode 100644 tests/eepro100-test.c create mode 100644 tests/pcnet-test.c create mode 100644 tests/rtl8139-test.c create mode 100644 tests/vmxnet3-test.c
Not much going on here, should be easy to merge. I did leave comments on the first patch, they apply to all other patches in the series as well.