From nobody Thu May 15 07:22:21 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 152812127236282.52918819735282; Mon, 4 Jun 2018 07:07:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 547FDA53CA; Mon, 4 Jun 2018 14:07:50 +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 12E175D9CD; Mon, 4 Jun 2018 14:07:50 +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 940F94CA80; Mon, 4 Jun 2018 14:07:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w54Dx6Do002858 for ; Mon, 4 Jun 2018 09:59:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8E1D17C20; Mon, 4 Jun 2018 13:59:06 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3355A63F5C for ; Mon, 4 Jun 2018 13:59:06 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 4 Jun 2018 15:58:43 +0200 Message-Id: <110fa6b522fff3e8bf18a55717d7b684e72bbf61.1528120448.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/10] 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.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 04 Jun 2018 14:07:51 +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 633389f263..c3c814630e 100644 --- a/tests/qemucapabilitiestest.c +++ b/tests/qemucapabilitiestest.c @@ -81,6 +81,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); @@ -202,4 +204,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