From patchwork Mon Apr 1 16:47:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 161549 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp687872jan; Mon, 1 Apr 2019 09:47:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwm2vYTqnVna8y1fj7wb4HVPji21aazKmjcwQsyrxeypy97zLcF4tszbdMLNG8voNbArkrb X-Received: by 2002:ac8:184b:: with SMTP id n11mr53937724qtk.210.1554137277662; Mon, 01 Apr 2019 09:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554137277; cv=none; d=google.com; s=arc-20160816; b=ZcBZf0tkmnZu2e3oPP1czFEauZk/qnpfWzc+/cp8vksnDimH641kmUhxKLw571P3YK tP0OSk59ebNq0CCs8WL3eujPWfqt1wzJjj7mNycv9xmQYIu85mHRKsgMuTIqI9ZXV6Ia HDjAlvjAr0TalihcOEa+UoK5V1xvRMgZQLjdp667xSeiZ5rxANWIPZl8Mu51RtsV7glE igNOCvzm7TXQPgNziMbFT8q0kLj1j2W2JPBwrxrzdRMpQNI+sk7DgkysLrOpeOEnUwB6 XbV0wL9u6JyTmyMy2PMkPWrq/0y8yg/FMKfYFpAJl04T4X/ZJSD2BLVlwqBEenqBtLbj lsGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=s/4DUu2k+HbvUv26ZEmPcCrspeOcC2BJf0K4RqssyIs=; b=vdRKRZiS+FuB/AxQnvn4BGN4OpwG0Fvy25o7Wm8tR78Hr7+ALJm9L8IfNl3/EhBImY ZebUPlmHpe0Sgz9dSeoMLAGHqQEVXbwyR6Ff1uHlG6uxz3sPcpPifJtxCR9yFJID5bRQ Zc9b0O57K0hVrwhWvidTgM1IPW++yJ/fFrCFGiY0UglZ4L5+FgRYRu4eh+BtgImNiutR dq7F0PpqrL9dwYgrmgmJL0Ilp6sQJepuS3LaE2/sbTj8H6GrFYWRanLoxMqhuhOXa//O OrqzfxiSZo58V2YdBGiRj4DxQP9p/swN/3WmIJdJSMWfVAwgsVdu94pYCFwV5Lrqrp2L ifmg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id y15si1517079qta.320.2019.04.01.09.47.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 09:47:57 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1997F5944D; Mon, 1 Apr 2019 16:47:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DE14187B9; Mon, 1 Apr 2019 16:47:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9CE281819AFF; Mon, 1 Apr 2019 16:47:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x31Glamh026682 for ; Mon, 1 Apr 2019 12:47:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id A247D5C27C; Mon, 1 Apr 2019 16:47:36 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-124-128.rdu2.redhat.com [10.10.124.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D1985C28C; Mon, 1 Apr 2019 16:47:35 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:20 -0400 Message-Id: <30eaad11068f933f64ac07af35495bb5b2953377.1554137098.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/12] tests: qemuxml2argv: Add info->{in, out}file X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 01 Apr 2019 16:47:56 +0000 (UTC) Track infile and outfile in testInfo. This is step towards moving path creation out of the test case, which will eventually help sharing more code with qemuxml2xmltest.c Signed-off-by: Cole Robinson --- tests/qemuxml2argvtest.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) -- 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Andrea Bolognani diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 0c0dcae197..ff7bacf8db 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -299,6 +299,8 @@ typedef enum { struct testInfo { const char *name; const char *suffix; + char *infile; + char *outfile; virQEMUCapsPtr qemuCaps; const char *migrateFrom; int migrateFd; @@ -427,8 +429,6 @@ static int testCompareXMLToArgv(const void *data) { struct testInfo *info = (void *) data; - char *xml = NULL; - char *args = NULL; char *migrateURI = NULL; char *actualargv = NULL; const char *suffix = info->suffix; @@ -471,9 +471,9 @@ testCompareXMLToArgv(const void *data) if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0) goto cleanup; - if (virAsprintf(&xml, "%s/qemuxml2argvdata/%s.xml", + if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml", abs_srcdir, info->name) < 0 || - virAsprintf(&args, "%s/qemuxml2argvdata/%s%s.args", + virAsprintf(&info->outfile, "%s/qemuxml2argvdata/%s%s.args", abs_srcdir, info->name, suffix) < 0) goto cleanup; @@ -486,7 +486,8 @@ testCompareXMLToArgv(const void *data) goto cleanup; parseFlags |= VIR_DOMAIN_DEF_PARSE_INACTIVE; - if (!(vm->def = virDomainDefParseFile(xml, driver.caps, driver.xmlopt, + if (!(vm->def = virDomainDefParseFile(info->infile, + driver.caps, driver.xmlopt, NULL, parseFlags))) { if (flags & FLAG_EXPECT_PARSE_ERROR) goto ok; @@ -502,7 +503,7 @@ testCompareXMLToArgv(const void *data) goto cleanup; if (!virDomainDefCheckABIStability(vm->def, vm->def, driver.xmlopt)) { - VIR_TEST_DEBUG("ABI stability check failed on %s", xml); + VIR_TEST_DEBUG("ABI stability check failed on %s", info->infile); goto cleanup; } @@ -570,7 +571,7 @@ testCompareXMLToArgv(const void *data) if (!(actualargv = virCommandToString(cmd, false))) goto cleanup; - if (virTestCompareToFile(actualargv, args) < 0) + if (virTestCompareToFile(actualargv, info->outfile) < 0) goto cleanup; ret = 0; @@ -600,8 +601,6 @@ testCompareXMLToArgv(const void *data) virSetConnectStorage(NULL); virObjectUnref(conn); VIR_FREE(migrateURI); - VIR_FREE(xml); - VIR_FREE(args); return ret; } @@ -754,6 +753,8 @@ testInfoSetArgs(struct testInfo *info, static void testInfoClear(struct testInfo *info) { + VIR_FREE(info->infile); + VIR_FREE(info->outfile); virObjectUnref(info->qemuCaps); }