From patchwork Fri Jan 8 19:49:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 59409 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp757668lbb; Fri, 8 Jan 2016 11:52:59 -0800 (PST) X-Received: by 10.194.79.201 with SMTP id l9mr136218042wjx.151.1452282778995; Fri, 08 Jan 2016 11:52:58 -0800 (PST) Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com. [209.132.183.37]) by mx.google.com with ESMTPS id s14si19591563wju.7.2016.01.08.11.52.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Jan 2016 11:52:58 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u08Jo0g2017337; Fri, 8 Jan 2016 14:50:00 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u08JnwHn028632 for ; Fri, 8 Jan 2016 14:49:58 -0500 Received: from colepc.redhat.com (ovpn-113-33.phx2.redhat.com [10.3.113.33]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u08Jnwfs004787; Fri, 8 Jan 2016 14:49:58 -0500 From: Cole Robinson To: libvirt-list@redhat.com Date: Fri, 8 Jan 2016 14:49:56 -0500 Message-Id: <0a48e8e1defd3a69140be2e1df815142c515e37c.1452282562.git.crobinso@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2] tests: Add newlines with VIR_TEST_REGENERATE_OUTPUT 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: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com Since test files are formatted predictably nowadays, we can make VIR_TEST_REGENERATE_OUTPUT handle most cases for us with a simple replacement. test-wrap-argv.pl is still canon, but this bit makes it easier to confirm test output changes during active development. --- v2: Rebase on .git master tests/testutils.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) -- 2.5.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/tests/testutils.c b/tests/testutils.c index 6645d61..0091fcd 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -469,10 +469,19 @@ virtTestDifferenceFullInternal(FILE *stream, actualStart = actual; actualEnd = actual + (strlen(actual)-1); - if (regenerate && virTestGetRegenerate() > 0) { + if (regenerate && (virTestGetRegenerate() > 0) && expectName && actual) { + char *regencontent; + + /* Try to properly indent qemu argv files */ + if (!(regencontent = virStringReplace(actual, " -", " \\\n-"))) + return -1; + if (expectName && actual && - virFileWriteStr(expectName, actual, 0666) < 0) + virFileWriteStr(expectName, regencontent, 0666) < 0) { + VIR_FREE(regencontent); return -1; + } + VIR_FREE(regencontent); } if (!virTestGetDebug())