From nobody Tue Dec 16 08:36:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1527841234220727.0076062938278; Fri, 1 Jun 2018 01:20:34 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9615225A1B; Fri, 1 Jun 2018 08:20:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 61B6B92AC9; Fri, 1 Jun 2018 08:20:32 +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 157F34CA8E; Fri, 1 Jun 2018 08:20:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w518KKR3028689 for ; Fri, 1 Jun 2018 04:20:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id AB0802166BC7; Fri, 1 Jun 2018 08:20:20 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4EF422166BB2 for ; Fri, 1 Jun 2018 08:20:20 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 1 Jun 2018 10:20:01 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 9/9] DO_NOT_APPLY: HACK: Regenerate qemucapabilitiestest data 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 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 01 Jun 2018 08:20:33 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Use the LD_PRELOAD .so library used in 'qemucapsprobe' to regenerate the files. The library is instrumented to write the replies to 'caps.json' and instrumentation in the test move it to the correct place. Use 'fix-files.sh' to do so as it's using a static variable to track the initial newline. --- fix-files.sh | 1 + tests/Makefile.am | 1 + tests/qemucapabilitiestest.c | 4 +++- tests/qemucapsprobemock.c | 11 +++++++++++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100755 fix-files.sh diff --git a/fix-files.sh b/fix-files.sh new file mode 100755 index 0000000000..93465b96db --- /dev/null +++ b/fix-files.sh @@ -0,0 +1 @@ +for i in `seq 0 50`; do VIR_TEST_RANGE=3D"$i" ./tests/qemucapabilitiestest= ; done diff --git a/tests/Makefile.am b/tests/Makefile.am index 1ce3dbb50f..a805b1b837 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -604,6 +604,7 @@ qemucapabilitiestest_SOURCES =3D \ testutilsqemu.c testutilsqemu.h \ $(NULL) qemucapabilitiestest_LDADD =3D libqemumonitortestutils.la \ + libqemutestdriver.la \ $(qemu_LDADDS) $(LDADDS) qemucapsprobe_SOURCES =3D \ diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c index cf94bc9d36..e554f089cc 100644 --- a/tests/qemucapabilitiestest.c +++ b/tests/qemucapabilitiestest.c @@ -78,6 +78,8 @@ testQemuCaps(const void *opaque) if (virTestCompareToFile(actual, capsFile) < 0) goto cleanup; + rename(abs_srcdir "/caps.json", repliesFile); + ret =3D 0; cleanup: VIR_FREE(repliesFile); @@ -199,4 +201,4 @@ mymain(void) return (ret =3D=3D 0) ? EXIT_SUCCESS : EXIT_FAILURE; } -VIR_TEST_MAIN(mymain) +VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/qemucapsprobemock.so") diff --git a/tests/qemucapsprobemock.c b/tests/qemucapsprobemock.c index 5936975505..9b691dcf0e 100644 --- a/tests/qemucapsprobemock.c +++ b/tests/qemucapsprobemock.c @@ -25,6 +25,7 @@ #include "internal.h" #include "viralloc.h" #include "virjson.h" +#include "virfile.h" #include "qemu/qemu_monitor.h" #include "qemu/qemu_monitor_json.h" @@ -38,19 +39,29 @@ } while (0) static bool first =3D true; +static const char *dumppath =3D abs_srcdir "/caps.json"; static void printLineSkipEmpty(const char *line, FILE *fp) { + FILE *fp2; const char *p; + if (!(fp2 =3D fopen(dumppath, "a"))) { + fprintf(stderr, "failed to open '%s'", dumppath); + abort(); + } + for (p =3D line; *p; p++) { if (p[0] =3D=3D '\n' && p[1] =3D=3D '\n') continue; fputc(*p, fp); + fputc(*p, fp2); } + + VIR_FORCE_FCLOSE(fp2); } --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list