From patchwork Mon Apr 1 16:47:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 161546 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp687809jan; Mon, 1 Apr 2019 09:47:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZgIXIe2CLQPyZpqAlWiLawJXJUkW4XQ9SlozAvl09rJ36PI60oO3xb57eiLlhoX0ZN6Q5 X-Received: by 2002:a37:a412:: with SMTP id n18mr48324304qke.321.1554137273695; Mon, 01 Apr 2019 09:47:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554137273; cv=none; d=google.com; s=arc-20160816; b=ExJBDKsfPqeDNKzMsIRc/c0qkzVboo92fX29KbR+ppUfahcZrtOm3ujy8G0Qj77thL pjHVHsZYPfbqa3Gorr3DLcUaHWSYAoZeX8FyLgpqLWO+04WNZ8wg2pq9qjxrhL8JyCaF k8i0BI2aBXQelmzo1hjFuvoSNCykMqt8dDEnc0nnwzV0btTm1eQjSkVByXvUqva6g/ST zN8vr0EfzvLTwH+qPoUr0S73AEsY5R3h95lFRpJbJfHhKkWskj94gKjUvADx1CqXHrea uOs3cYiLtn+Z65Kq7DqS1MQLZydpCX04huKob7gZ8kJIJXp9OW5zJB+JoJOQ6Lj7d/tg okRg== 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=msX+7TO6yABxS0M4P3F5+GCrpeEtYe0HQyDxerSsazo=; b=ZiLH4zTu1dtd73DYlUTXNRc+DfAX2yy1o2efXTM7lIoDGO6fUAW3++KH2H515tCkYn sx/k7FhF+4ErRnrW93Hj/riTpbu7DLLewTz/W/jdxS8CNaoTayTXJoN+Q6x8b8IQ3ffp Ktvfum2Wz9V34NggqPyRUVSFJerU6IcwYB5hCfijddt8IN6csaL969/p7/3tmysFyEmf bVZJgHXX9KnK/pd47MeC9+SOr4gEq6h7XfCHRWqEeJuovUkXBR4CD497vLjHKtNqzKVg yHm+QyPK31efnmoQPqP2qSL1i1q5e+aSMftWU6dbpS7F6b6aKSvbCI8pqJwrMK7d0urE yONw== 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 h13si2482019qtr.67.2019.04.01.09.47.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 09:47:53 -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-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 65FE07F746; Mon, 1 Apr 2019 16:47:52 +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 3E896BA93; Mon, 1 Apr 2019 16:47:52 +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 F2921180338A; Mon, 1 Apr 2019 16:47:51 +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 x31GlbdB026695 for ; Mon, 1 Apr 2019 12:47:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 405805C27C; Mon, 1 Apr 2019 16:47:37 +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 CFEC15C25A; Mon, 1 Apr 2019 16:47:36 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:21 -0400 Message-Id: <360558146ac0c43c7779c522d0b4d90078ccd950.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 05/12] tests: qemuxml2argv: add testInfoSetPaths 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 01 Apr 2019 16:47:52 +0000 (UTC) This moves infile and outfile building outside the test case, which better fits the pattern of qemuxml2xmltest. It also lets us drop the qemuxml2argtest-specific 'suffix' from testInfo Signed-off-by: Cole Robinson --- tests/qemuxml2argvtest.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) -- 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index ff7bacf8db..a3fee41ea9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -298,7 +298,6 @@ typedef enum { struct testInfo { const char *name; - const char *suffix; char *infile; char *outfile; virQEMUCapsPtr qemuCaps; @@ -431,7 +430,6 @@ testCompareXMLToArgv(const void *data) struct testInfo *info = (void *) data; char *migrateURI = NULL; char *actualargv = NULL; - const char *suffix = info->suffix; unsigned int flags = info->flags; unsigned int parseFlags = info->parseFlags; int ret = -1; @@ -448,9 +446,6 @@ testCompareXMLToArgv(const void *data) if (!(conn = virGetConnect())) goto cleanup; - if (!suffix) - suffix = ""; - conn->secretDriver = &fakeSecretDriver; conn->storageDriver = &fakeStorageDriver; conn->nwfilterDriver = &fakeNWFilterDriver; @@ -471,12 +466,6 @@ testCompareXMLToArgv(const void *data) if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0) goto cleanup; - if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml", - abs_srcdir, info->name) < 0 || - virAsprintf(&info->outfile, "%s/qemuxml2argvdata/%s%s.args", - abs_srcdir, info->name, suffix) < 0) - goto cleanup; - if (info->migrateFrom && !(migrateURI = qemuMigrationDstGetURI(info->migrateFrom, info->migrateFd))) @@ -758,6 +747,17 @@ testInfoClear(struct testInfo *info) virObjectUnref(info->qemuCaps); } +static int +testInfoSetPaths(struct testInfo *info, const char *suffix) +{ + if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml", + abs_srcdir, info->name) < 0 || + virAsprintf(&info->outfile, "%s/qemuxml2argvdata/%s%s.args", + abs_srcdir, info->name, suffix ? suffix : "") < 0) + return -1; + return 0; +} + # define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX" static int @@ -883,11 +883,12 @@ mymain(void) do { \ static struct testInfo info = { \ .name = _name, \ - .suffix = _suffix, \ }; \ if (testInfoSetArgs(&info, capslatest, \ __VA_ARGS__, ARG_END) < 0) \ return EXIT_FAILURE; \ + if (testInfoSetPaths(&info, _suffix)) \ + return EXIT_FAILURE; \ if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \ testCompareXMLToArgv, &info) < 0) \ ret = -1; \