From patchwork Thu Nov 3 12:22:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Halil Pasic X-Patchwork-Id: 9410753 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 285D06022E for ; Thu, 3 Nov 2016 12:22:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15D2B2AA51 for ; Thu, 3 Nov 2016 12:22:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A4512AA54; Thu, 3 Nov 2016 12:22:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A25BA2AA51 for ; Thu, 3 Nov 2016 12:22:35 +0000 (UTC) Received: from localhost ([::1]:60883 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c2H2R-0004CR-0o for patchwork-qemu-devel@patchwork.kernel.org; Thu, 03 Nov 2016 08:22:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49651) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c2H27-0004CH-W8 for qemu-devel@nongnu.org; Thu, 03 Nov 2016 08:22:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c2H23-0006D1-Mn for qemu-devel@nongnu.org; Thu, 03 Nov 2016 08:22:15 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:42310) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c2H23-0006Cs-Cy for qemu-devel@nongnu.org; Thu, 03 Nov 2016 08:22:11 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uA3CJJmU110152 for ; Thu, 3 Nov 2016 08:22:10 -0400 Received: from e06smtp09.uk.ibm.com (e06smtp09.uk.ibm.com [195.75.94.105]) by mx0a-001b2d01.pphosted.com with ESMTP id 26fy4ek8yp-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 03 Nov 2016 08:22:09 -0400 Received: from localhost by e06smtp09.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 3 Nov 2016 12:22:07 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp09.uk.ibm.com (192.168.101.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 3 Nov 2016 12:22:04 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id D0BBD1B08023; Thu, 3 Nov 2016 12:24:13 +0000 (GMT) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uA3CM3XY28508398; Thu, 3 Nov 2016 12:22:03 GMT Received: from d06av04.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id uA3CM1mQ030498; Thu, 3 Nov 2016 06:22:03 -0600 Received: from oc3836556865.ibm.com (dyn-9-152-224-118.boeblingen.de.ibm.com [9.152.224.118]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id uA3CM0uY030482; Thu, 3 Nov 2016 06:22:00 -0600 To: quintela@redhat.com, Jianjun Duan References: <1477943636-21024-1-git-send-email-duanj@linux.vnet.ibm.com> <1477943636-21024-4-git-send-email-duanj@linux.vnet.ibm.com> <87funa88fz.fsf@emacs.mitica> From: Halil Pasic Date: Thu, 3 Nov 2016 13:22:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <87funa88fz.fsf@emacs.mitica> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16110312-0036-0000-0000-000002524E67 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16110312-0037-0000-0000-0000131AE17D Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-03_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611030233 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: Re: [Qemu-devel] [QEMU PATCH v10 3/3] tests/migration: Add test for QTAILQ migration X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: veroniabahaa@gmail.com, peter.maydell@linaro.org, mst@redhat.com, qemu-devel@nongnu.org, mark.cave-ayland@ilande.co.uk, dgilbert@redhat.com, mdroth@linux.vnet.ibm.com, blauwirbel@gmail.com, dmitry@daynix.com, qemu-ppc@nongnu.org, kraxel@redhat.com, david@gibson.dropbear.id.au, pbonzini@redhat.com, amit.shah@redhat.com, kwolf@redhat.com, mreitz@redhat.com, leon.alrae@imgtec.com, aurelien@aurel32.net, rth@twiddle.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP On 11/02/2016 11:47 AM, Juan Quintela wrote: > Jianjun Duan wrote: >> Add a test for QTAILQ migration to tests/test-vmstate.c. >> >> Signed-off-by: Jianjun Duan > > Reviewed-by: Juan Quintela > 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 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 --- 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);