From patchwork Thu Feb 18 00:33:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Fehlig X-Patchwork-Id: 8344011 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C2208C0553 for ; Thu, 18 Feb 2016 00:37:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3B163203DC for ; Thu, 18 Feb 2016 00:37:08 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AA7E720320 for ; Thu, 18 Feb 2016 00:37:02 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aWCXm-0006t4-5j; Thu, 18 Feb 2016 00:34:06 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aWCXk-0006sZ-O5 for xen-devel@lists.xen.org; Thu, 18 Feb 2016 00:34:04 +0000 Received: from [85.158.139.211] by server-16.bemta-5.messagelabs.com id A9/4B-13828-B7115C65; Thu, 18 Feb 2016 00:34:03 +0000 X-Env-Sender: jfehlig@suse.com X-Msg-Ref: server-14.tower-206.messagelabs.com!1455755641!22855766!1 X-Originating-IP: [137.65.250.81] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 26362 invoked from network); 18 Feb 2016 00:34:03 -0000 Received: from smtp2.provo.novell.com (HELO smtp2.provo.novell.com) (137.65.250.81) by server-14.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 18 Feb 2016 00:34:03 -0000 Received: from talkeetna.gns.novell.com (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (NOT encrypted); Wed, 17 Feb 2016 17:33:56 -0700 From: Jim Fehlig To: libvirt-list@redhat.com Date: Wed, 17 Feb 2016 17:33:42 -0700 Message-Id: <1455755625-13329-2-git-send-email-jfehlig@suse.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1455755625-13329-1-git-send-email-jfehlig@suse.com> References: <1455755625-13329-1-git-send-email-jfehlig@suse.com> Cc: Jim Fehlig , xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH V2 1/4] xenconfig: replace text 'xm' with 'xl' in xlconfigtest X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP While at it, improve a few comments. No functional change. Signed-off-by: Jim Fehlig --- tests/xlconfigtest.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c index 4b2f28f..aa53ed8 100644 --- a/tests/xlconfigtest.c +++ b/tests/xlconfigtest.c @@ -1,5 +1,5 @@ /* - * xlconfigtest.c: Test backend for xl_internal config file handling + * xlconfigtest.c: Test xl.cfg(5) <-> domXML config conversions * * Copyright (C) 2007, 2010-2011, 2014 Red Hat, Inc. * Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. @@ -42,20 +42,22 @@ static virCapsPtr caps; static virDomainXMLOptionPtr xmlopt; + /* - * parses the xml, creates a domain def and compare with equivalent xm config + * Parses domXML to virDomainDef object, which is then converted to xl.cfg(5) + * config and compared with expected config. */ static int -testCompareParseXML(const char *xmcfg, const char *xml) +testCompareParseXML(const char *xlcfg, const char *xml) { - char *gotxmcfgData = NULL; + char *gotxlcfgData = NULL; virConfPtr conf = NULL; virConnectPtr conn = NULL; int wrote = 4096; int ret = -1; virDomainDefPtr def = NULL; - if (VIR_ALLOC_N(gotxmcfgData, wrote) < 0) + if (VIR_ALLOC_N(gotxlcfgData, wrote) < 0) goto fail; conn = virGetConnect(); @@ -73,17 +75,17 @@ testCompareParseXML(const char *xmcfg, const char *xml) if (!(conf = xenFormatXL(def, conn))) goto fail; - if (virConfWriteMem(gotxmcfgData, &wrote, conf) < 0) + if (virConfWriteMem(gotxlcfgData, &wrote, conf) < 0) goto fail; - gotxmcfgData[wrote] = '\0'; + gotxlcfgData[wrote] = '\0'; - if (virtTestCompareToFile(gotxmcfgData, xmcfg) < 0) + if (virtTestCompareToFile(gotxlcfgData, xlcfg) < 0) goto fail; ret = 0; fail: - VIR_FREE(gotxmcfgData); + VIR_FREE(gotxlcfgData); if (conf) virConfFree(conf); virDomainDefFree(def); @@ -91,13 +93,15 @@ testCompareParseXML(const char *xmcfg, const char *xml) return ret; } + /* - * parses the xl config, develops domain def and compares with equivalent xm config + * Parses xl.cfg(5) config to virDomainDef object, which is then converted to + * domXML and compared to expected XML. */ static int -testCompareFormatXML(const char *xmcfg, const char *xml) +testCompareFormatXML(const char *xlcfg, const char *xml) { - char *xmcfgData = NULL; + char *xlcfgData = NULL; char *gotxml = NULL; virConfPtr conf = NULL; int ret = -1; @@ -107,10 +111,10 @@ testCompareFormatXML(const char *xmcfg, const char *xml) conn = virGetConnect(); if (!conn) goto fail; - if (virtTestLoadFile(xmcfg, &xmcfgData) < 0) + if (virtTestLoadFile(xlcfg, &xlcfgData) < 0) goto fail; - if (!(conf = virConfReadMem(xmcfgData, strlen(xmcfgData), 0))) + if (!(conf = virConfReadMem(xlcfgData, strlen(xlcfgData), 0))) goto fail; if (!(def = xenParseXL(conf, caps, xmlopt))) @@ -128,7 +132,7 @@ testCompareFormatXML(const char *xmcfg, const char *xml) fail: if (conf) virConfFree(conf); - VIR_FREE(xmcfgData); + VIR_FREE(xlcfgData); VIR_FREE(gotxml); virDomainDefFree(def); virObjectUnref(conn);