From patchwork Sat Jan 9 00:13:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 59419 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp860855lbb; Fri, 8 Jan 2016 16:16:16 -0800 (PST) X-Received: by 10.28.45.207 with SMTP id t198mr1584212wmt.32.1452298575947; Fri, 08 Jan 2016 16:16:15 -0800 (PST) Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com. [209.132.183.39]) by mx.google.com with ESMTPS id m2si178604732wje.1.2016.01.08.16.16.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Jan 2016 16:16:15 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.39 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 mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u090DUfx015821; Fri, 8 Jan 2016 19:13:31 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u090DUke002853 for ; Fri, 8 Jan 2016 19:13:30 -0500 Received: from colepc.redhat.com (ovpn-113-33.phx2.redhat.com [10.3.113.33]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u090DSuA014481; Fri, 8 Jan 2016 19:13:29 -0500 From: Cole Robinson To: libvirt-list@redhat.com Date: Fri, 8 Jan 2016 19:13:20 -0500 Message-Id: <70524bebab26f8a98b7acd69e9387676c5481b54.1452298382.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/6] 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. --- 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())