From: Halil Pasic <pasic@linux.vnet.ibm.com>
To: quintela@redhat.com, Jianjun Duan <duanj@linux.vnet.ibm.com>
Cc: veroniabahaa@gmail.com, peter.maydell@linaro.org,
dgilbert@redhat.com, mdroth@linux.vnet.ibm.com, mst@redhat.com,
mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org,
mreitz@redhat.com, blauwirbel@gmail.com, amit.shah@redhat.com,
qemu-ppc@nongnu.org, kraxel@redhat.com, kwolf@redhat.com,
dmitry@daynix.com, pbonzini@redhat.com, rth@twiddle.net,
leon.alrae@imgtec.com, aurelien@aurel32.net,
david@gibson.dropbear.id.au
Subject: Re: [Qemu-devel] [QEMU PATCH v10 3/3] tests/migration: Add test for QTAILQ migration
Date: Thu, 3 Nov 2016 13:22:00 +0100 [thread overview]
Message-ID: <cda939fc-7da7-89a3-dfcc-8c81f214bce1@linux.vnet.ibm.com> (raw)
In-Reply-To: <87funa88fz.fsf@emacs.mitica>
On 11/02/2016 11:47 AM, Juan Quintela wrote:
> Jianjun Duan <duanj@linux.vnet.ibm.com> wrote:
>> Add a test for QTAILQ migration to tests/test-vmstate.c.
>>
>> Signed-off-by: Jianjun Duan <duanj@linux.vnet.ibm.com>
>
> Reviewed-by: Juan Quintela <quintela@redhat.com>
>
Empty QTAILQ seems to be broken. Have written a small
test to prove my point. It May even make sense to have such
a test in the test-suite (some prettyfication might be
necessary though).
Halil
-----------------------8<-------------------------------------
>From 4323c308c5f56ed86eb0a5bb6027bca4617ecc8c Mon Sep 17 00:00:00 2001
From: Halil Pasic <pasic@linux.vnet.ibm.com>
Date: Thu, 3 Nov 2016 13:07:05 +0100
Subject: [PATCH] tests/test-vmstate.c: add test empty qtailq
Add test for empty qtailq.
Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
--
For fixup.
---
tests/test-vmstate.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c
index a992408..789f07a 100644
--- a/tests/test-vmstate.c
+++ b/tests/test-vmstate.c
@@ -126,6 +126,14 @@ static int load_vmstate_one(const VMStateDescription *desc, void *obj,
return ret;
}
+static void load_vmstate_one_obj(const VMStateDescription *vmsd, void *obj,
+ int version_id)
+{
+ QEMUFile *fload = open_test_file(false);
+
+ SUCCESS(vmstate_load_state(fload, vmsd, obj, version_id));
+ qemu_fclose(fload);
+}
static int load_vmstate(const VMStateDescription *desc,
void *obj, void *obj_clone,
@@ -633,6 +641,25 @@ static void test_load_q(void)
qemu_fclose(fload);
}
+
+static void test_sl_empty_q(void)
+{
+ TestQtailq obj_q = {
+ .i16 = -512,
+ .i32 = 70000,
+ };
+ TestQtailq tgt = {.q = {.tqh_first = (void *)1}};
+
+ QTAILQ_INIT(&obj_q.q);
+
+ save_vmstate(&vmstate_q, &obj_q);
+ load_vmstate_one_obj(&vmstate_q, &tgt, 1);
+ g_assert_cmpint(tgt.i16, ==, obj_q.i16);
+ g_assert_cmpint(tgt.i32, ==, obj_q.i32);
+ g_assert_cmpint(QTAILQ_EMPTY(&(tgt.q)),!=, false);
+
+}
+
int main(int argc, char **argv)
{
temp_fd = mkstemp(temp_file);
@@ -649,6 +676,7 @@ int main(int argc, char **argv)
g_test_add_func("/vmstate/field_exists/save/skip", test_save_skip);
g_test_add_func("/vmstate/qtailq/save/saveq", test_save_q);
g_test_add_func("/vmstate/qtailq/load/loadq", test_load_q);
+ g_test_add_func("/vmstate/qtailq/empty", test_sl_empty_q);
g_test_run();
close(temp_fd);
--
1.7.1
next prev parent reply other threads:[~2016-11-03 12:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-31 19:53 [Qemu-devel] [QEMU PATCH v10 0/3] migration: migrate QTAILQ Jianjun Duan
2016-10-31 19:53 ` [Qemu-devel] [QEMU PATCH v10 1/3] migration: extend VMStateInfo Jianjun Duan
2016-11-02 10:40 ` Juan Quintela
2016-11-02 16:54 ` Jianjun Duan
2016-11-03 10:18 ` Juan Quintela
2016-10-31 19:53 ` [Qemu-devel] [QEMU PATCH v10 2/3] migration: migrate QTAILQ Jianjun Duan
2016-11-02 10:45 ` Juan Quintela
2016-11-02 16:38 ` Paolo Bonzini
2016-11-03 11:14 ` Halil Pasic
2016-11-03 11:32 ` Halil Pasic
2016-11-02 17:05 ` Jianjun Duan
2016-10-31 19:53 ` [Qemu-devel] [QEMU PATCH v10 3/3] tests/migration: Add test for QTAILQ migration Jianjun Duan
2016-11-02 10:47 ` Juan Quintela
2016-11-03 12:22 ` Halil Pasic [this message]
2016-11-03 16:47 ` Jianjun Duan
2016-11-03 17:17 ` Halil Pasic
2016-11-03 18:40 ` Jianjun Duan
2016-11-03 18:51 ` Halil Pasic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cda939fc-7da7-89a3-dfcc-8c81f214bce1@linux.vnet.ibm.com \
--to=pasic@linux.vnet.ibm.com \
--cc=amit.shah@redhat.com \
--cc=aurelien@aurel32.net \
--cc=blauwirbel@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=dgilbert@redhat.com \
--cc=dmitry@daynix.com \
--cc=duanj@linux.vnet.ibm.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=leon.alrae@imgtec.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=quintela@redhat.com \
--cc=rth@twiddle.net \
--cc=veroniabahaa@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).