Skip to contentSkip to conversation

QemuOpt: add unit tests

PATCH Superseded Leandro Dorileo 2 participants 4 messages Mar 25, 2014 – May 19, 2014 4 messages not in the archive

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 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.

---
 tests/Makefile         |   3 +
 tests/test-qemu-opts.c | 455 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 458 insertions(+)
 create mode 100644 tests/test-qemu-opts.c
tests/Makefile +3 -0
index 471b4c8..4814283 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-y += 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
 
@@ -272,6 +274,7 @@ 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/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 +455 -0

455 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw
Quoted 6 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.

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

Looks useful. I skipped this patch original because you and Chunyan were working on different versions of the QemuOpts conversion series and I wanted to wait until the dust settled on that.

tests/test-qemu-opts.c line 79

Quoted 12 lines
tests/test-qemu-opts.c new file +12 -0
+static void register_opts(void)
+{
+    qemu_add_opts(&opts_list_01);
+    qemu_add_opts(&opts_list_02);
+    qemu_add_opts(&opts_list_03);
+}
+
+static void test_find_unknown_opts(void)
+{
+    QemuOptsList *list;
+
+    register_opts();

Should this function be called once in main() instead? I think you keep adding the same opts lists again and again as the test cases execute.

#2 lore raw
Quoted 15 lines · Stefan Hajnoczi
Quoted 6 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.

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

Looks useful. I skipped this patch original because you and Chunyan were working on different versions of the QemuOpts conversion series and I wanted to wait until the dust settled on that.

Ok, no problem.

Quoted 16 lines

tests/test-qemu-opts.c line 79

Quoted 13 lines
tests/test-qemu-opts.c new file +12 -0
+static void register_opts(void)
+{
+    qemu_add_opts(&opts_list_01);
+    qemu_add_opts(&opts_list_02);
+    qemu_add_opts(&opts_list_03);
+}
+
+static void test_find_unknown_opts(void)
+{
+    QemuOptsList *list;
+
+    register_opts();

Should this function be called once in main() instead? I think you keep adding the same opts lists again and again as the test cases execute.

Yep, definitively. I'm sending v4 soon.

Thanks...

Signature · 1 line
Leandro Dorileo

A message that is not in the archive (sent off-list or not yet received): 20140428185502.GA6934@dorilex

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 20140428211704.GA12444@dorilex

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw
Quoted 26 lines · Markus Armbruster
Quoted 24 lines · Leandro Dorileo

Hi Andreas,

Quoted 21 lines · Andreas Färber

Am 28.04.2014 20:55, schrieb Leandro Dorileo:

Quoted 19 lines

ping?

Quoted 15 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.

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

I don't spot any test API or style issues; not familiar enough with QemuOpts to judge the tests though.

What maintainer would best suite to route this patch?

MAINTAINERS doesn't cover it. In the past year, patches went in via Anthony, Kevin, Luiz, or Stefan Hajnoczi. I'm cc'ing the ones from this list you missed.

Ok.

Quoted 6 lines

I read your patch. There's some redundant testing, some comments feel superfluous, and there's a spelling mistake or two. Coverage is far from perfect (QemuOpts has become ridiculously complex), but infinitely better than before :)

Redundant testing don't seem to be a problem in this case, the comments are intentionally verbose. My spell checker doesn't spot any spelling error - besides "defval" :)

Quoted 1 line

Let's take it as is.

I'm respining the patch changing what Stefan suggested.

Thanks...

Signature · 1 line
Leandro Dorileo