Skip to contentSkip to conversation

tests: add pxe e1000 and virtio-pci tests

PATCH New Victor Kaplansky 1 participant 1 message Feb 14, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tests: add pxe e1000 and virtio-pci tests

The test is based on bios-tables-test.c. It creates a file with the boot sector image and loads it into a guest using PXE and TFTP functionality.

---
v2:
- added a one more test for virtio-pci device, so the test consists of two test cases now.
- following a proposal by Michael S. Tsirkin, code handling boot sector details was factored out to boot-sector.[ch] for usage by both pxe-test and bios-tables-test.

 tests/boot-sector.h      |  26 +++++++++++
 tests/bios-tables-test.c |  72 +++-------------------------
 tests/boot-sector.c      | 119 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/pxe-test.c         |  69 +++++++++++++++++++++++++++
 tests/Makefile           |   5 +-
 5 files changed, 224 insertions(+), 67 deletions(-)
 create mode 100644 tests/boot-sector.h
 create mode 100644 tests/boot-sector.c
 create mode 100644 tests/pxe-test.c
tests/boot-sector.h new file +26 -0
new file mode 100644
index 00000000..38be0290
@@ -0,0 +1,26 @@
+/*
+ * QEMU boot sector testing helpers.
+ *
+ * Copyright (c) 2016 Red Hat Inc.
+ *
+ * Authors:
+ *  Michael S. Tsirkin <[email protected]>
+ *  Victor Kaplansky <[email protected]>    
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef TEST_BOOT_SECTOR
+#define TEST_BOOT_SECTOR
+
+/* Create boot disk file.  */
+int boot_sector_init(const char *fname);
+
+/* Loop until signature in memory is OK.  */
+void boot_sector_test(void);
+
+/* unlink boot disk file.  */
+void boot_sector_cleanup(const char *fname);
+
+#endif /* TEST_BOOT_SECTOR */
tests/bios-tables-test.c +6 -66

115 lines not on this page · raw message

tests/boot-sector.c new file +119 -0

119 lines not on this page · raw message

tests/pxe-test.c new file +69 -0

69 lines not on this page · raw message

tests/Makefile +4 -1
index 650e654e..fc042f73 100644
@@ -173,6 +173,7 @@ check-qtest-i386-y += tests/hd-geo-test$(EXESUF)
 gcov-files-i386-y += hw/block/hd-geometry.c
 check-qtest-i386-y += tests/boot-order-test$(EXESUF)
 check-qtest-i386-y += tests/bios-tables-test$(EXESUF)
+check-qtest-i386-y += tests/pxe-test$(EXESUF)
 check-qtest-i386-y += tests/rtc-test$(EXESUF)
 check-qtest-i386-y += tests/ipmi-kcs-test$(EXESUF)
 check-qtest-i386-y += tests/ipmi-bt-test$(EXESUF)
@@ -518,7 +519,9 @@ tests/ipmi-kcs-test$(EXESUF): tests/ipmi-kcs-test.o
 tests/ipmi-bt-test$(EXESUF): tests/ipmi-bt-test.o
 tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o
 tests/boot-order-test$(EXESUF): tests/boot-order-test.o $(libqos-obj-y)
-tests/bios-tables-test$(EXESUF): tests/bios-tables-test.o $(libqos-obj-y)
+tests/bios-tables-test$(EXESUF): tests/bios-tables-test.o \
+	tests/boot-sector.o $(libqos-obj-y)
+tests/pxe-test$(EXESUF): tests/pxe-test.o tests/boot-sector.o $(libqos-obj-y)
 tests/tmp105-test$(EXESUF): tests/tmp105-test.o $(libqos-omap-obj-y)
 tests/ds1338-test$(EXESUF): tests/ds1338-test.o $(libqos-imx-obj-y)
 tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y)
Signature · 1 line
--Victor