Skip to contentSkip to conversation

QemuOpt: add unit tests

PATCH Applied Leandro Dorileo 2 participants 2 messages May 19, 2014 – May 20, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 QemuOpt: add unit tests

Cover basic aspects and API usage for QemuOpt. The current implementation covers the API's planned to be changed by Chunyan Liu in his QEMUOptionParameter replacement/cleanup job.

Other APIs should be covered in future improvements.

---

Notes:
V4:
+ call register_opts() only once (pointed by Stefan);

V3:
+ fix a typo (s/dinamically/dynamically/);

V2:
+ fixed comments;
+ make use of g_assert_cmpstr();
+ use error_abort instead of a local_err for qemu_opts_absorb_qdict();
+ asserts on QemuOptsList (empty and list name);
+ added test_qemu_opt_unset();
+ asserts on qemu_opt_*_set() return;
+ added test_qemu_opts_reset();
+ added test_qemu_opts_set();

 tests/Makefile         |   3 +
 tests/test-qemu-opts.c | 438 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 441 insertions(+)
 create mode 100644 tests/test-qemu-opts.c
tests/Makefile +3 -0
index 9f7ca61..8f71e0d 100644
@@ -60,6 +60,8 @@ check-unit-y += tests/test-qdev-global-props$(EXESUF)
 check-unit-y += tests/check-qom-interface$(EXESUF)
 gcov-files-check-qom-interface-y = qom/object.c
 check-unit-$(CONFIG_POSIX) += tests/test-vmstate$(EXESUF)
+check-unit-y += tests/test-qemu-opts$(EXESUF)
+gcov-files-test-qemu-opts-y = qom/test-qemu-opts.c
 
 check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
 
@@ -319,6 +321,7 @@ tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o
 tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
 tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o
 tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
+tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o libqemuutil.a libqemustub.a
 
 # QTest rules
 
tests/test-qemu-opts.c new file +438 -0

438 lines not on this page · raw message

Signature · 1 line
1.9.2
#1 lore raw
Quoted 26 lines · Leandro Dorileo

Cover basic aspects and API usage for QemuOpt. The current implementation covers the API's planned to be changed by Chunyan Liu in his QEMUOptionParameter replacement/cleanup job.

Other APIs should be covered in future improvements.

---

Notes:
V4:
+ call register_opts() only once (pointed by Stefan);

V3:
+ fix a typo (s/dinamically/dynamically/);

V2:
+ fixed comments;
+ make use of g_assert_cmpstr();
+ use error_abort instead of a local_err for qemu_opts_absorb_qdict();
+ asserts on QemuOptsList (empty and list name);
+ added test_qemu_opt_unset();
+ asserts on qemu_opt_*_set() return;
+ added test_qemu_opts_reset();
+ added test_qemu_opts_set();

Quoted 4 lines
 tests/Makefile         |   3 +
 tests/test-qemu-opts.c | 438 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 441 insertions(+)
 create mode 100644 tests/test-qemu-opts.c

Great, thanks for writing this test case. It's good to have this here before applying Chunyan's patches.

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan