From nobody Thu May 15 07:24:27 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 1526992602693734.8748854732545; Tue, 22 May 2018 05:36:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2F2396A570; Tue, 22 May 2018 12:36:41 +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 896CA6017F; Tue, 22 May 2018 12:36:40 +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 9AB234CAA0; Tue, 22 May 2018 12:36:39 +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 w4MCa5Dx013716 for ; Tue, 22 May 2018 08:36:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0B4ED215CDAC; Tue, 22 May 2018 12:36:05 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87088215CDA7; Tue, 22 May 2018 12:36:04 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 22 May 2018 14:35:46 +0200 Message-Id: <69bf9b7363c51ba0063967fb0b8dd80b0e9e0416.1526992488.git.pkrempa@redhat.com> 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 Cc: Peter Krempa Subject: [libvirt] [PATCH 6/8] tests: Drop qemumonitortest 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 22 May 2018 12:36:41 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" No need to test the old stuff which will not be used any more. Signed-off-by: Peter Krempa Reviewed-by: J=EF=BF=BDn Tomko --- tests/Makefile.am | 11 +-- tests/qemumonitortest.c | 203 --------------------------------------------= ---- 2 files changed, 2 insertions(+), 212 deletions(-) delete mode 100644 tests/qemumonitortest.c diff --git a/tests/Makefile.am b/tests/Makefile.am index ac92190845..1ce3dbb50f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -282,7 +282,7 @@ endif WITH_LIBXL if WITH_QEMU test_programs +=3D qemuxml2argvtest qemuxml2xmltest \ qemuargv2xmltest domainsnapshotxml2xmltest \ - qemumonitortest qemumonitorjsontest qemuhotplugtest \ + qemumonitorjsontest qemuhotplugtest \ qemuagenttest qemucapabilitiestest qemucaps2xmltest \ qemumemlocktest \ qemucommandutiltest \ @@ -590,13 +590,6 @@ qemuargv2xmltest_SOURCES =3D \ testutils.c testutils.h qemuargv2xmltest_LDADD =3D $(qemu_LDADDS) $(LDADDS) -qemumonitortest_SOURCES =3D \ - qemumonitortest.c \ - testutils.c testutils.h \ - testutilsqemu.c testutilsqemu.h -qemumonitortest_LDADD =3D libqemumonitortestutils.la \ - $(qemu_LDADDS) $(LDADDS) - qemumonitorjsontest_SOURCES =3D \ qemumonitorjsontest.c \ testutils.c testutils.h \ @@ -691,7 +684,7 @@ qemumigparamstest_LDADD =3D libqemumonitortestutils.la \ else ! WITH_QEMU EXTRA_DIST +=3D qemuxml2argvtest.c qemuxml2xmltest.c qemuargv2xmltest.c \ domainsnapshotxml2xmltest.c \ - qemumonitortest.c testutilsqemu.c testutilsqemu.h \ + testutilsqemu.c testutilsqemu.h \ testutilsqemuschema.c testutilsqemuschema.h \ qemumonitorjsontest.c qemuhotplugtest.c \ qemuagenttest.c qemucapabilitiestest.c \ diff --git a/tests/qemumonitortest.c b/tests/qemumonitortest.c deleted file mode 100644 index 0231ce083e..0000000000 --- a/tests/qemumonitortest.c +++ /dev/null @@ -1,203 +0,0 @@ -#include - -#include -#include -#include -#include - -#include "testutils.h" - -#ifdef WITH_QEMU - -# include "internal.h" -# include "viralloc.h" -# include "qemu/qemu_monitor.h" -# include "qemu/qemu_monitor_text.h" -# include "qemumonitortestutils.h" -# include "testutilsqemu.h" - -# define VIR_FROM_THIS VIR_FROM_NONE - -struct testEscapeString -{ - const char *unescaped; - const char *escaped; -}; - -static struct testEscapeString escapeStrings[] =3D { - { "", "" }, - { " ", " " }, - { "\\", "\\\\" }, - { "\n", "\\n" }, - { "\r", "\\r" }, - { "\"", "\\\"" }, - { "\"\"\"\\\\\n\r\\\\\n\r\"\"\"", "\\\"\\\"\\\"\\\\\\\\\\n\\r\\\\\\\\\= \n\\r\\\"\\\"\\\"" }, - { "drive_add dummy file=3Dfoo\\", "drive_add dummy file=3Dfoo\\\\" }, - { "block info", "block info" }, - { "set_password \":\\\"\"", "set_password \\\":\\\\\\\"\\\"" }, -}; - -static int testEscapeArg(const void *data ATTRIBUTE_UNUSED) -{ - size_t i; - char *escaped =3D NULL; - for (i =3D 0; i < ARRAY_CARDINALITY(escapeStrings); ++i) { - escaped =3D qemuMonitorEscapeArg(escapeStrings[i].unescaped); - if (!escaped) { - VIR_TEST_DEBUG("\nUnescaped string [%s]\n", - escapeStrings[i].unescaped); - VIR_TEST_DEBUG("Expect result [%s]\n", - escapeStrings[i].escaped); - VIR_TEST_DEBUG("Actual result [(null)]\n"); - return -1; - } - if (STRNEQ(escapeStrings[i].escaped, escaped)) { - virTestDifference(stderr, escapeStrings[i].escaped, escaped); - VIR_FREE(escaped); - return -1; - } - VIR_FREE(escaped); - } - - return 0; -} - -static int testUnescapeArg(const void *data ATTRIBUTE_UNUSED) -{ - size_t i; - char *unescaped =3D NULL; - for (i =3D 0; i < ARRAY_CARDINALITY(escapeStrings); ++i) { - unescaped =3D qemuMonitorUnescapeArg(escapeStrings[i].escaped); - if (!unescaped) { - VIR_TEST_DEBUG("\nEscaped string [%s]\n", - escapeStrings[i].escaped); - VIR_TEST_DEBUG("Expect result [%s]\n", - escapeStrings[i].unescaped); - VIR_TEST_DEBUG("Actual result [(null)]\n"); - return -1; - } - if (STRNEQ(escapeStrings[i].unescaped, unescaped)) { - virTestDifference(stderr, escapeStrings[i].unescaped, unescape= d); - VIR_FREE(unescaped); - return -1; - } - VIR_FREE(unescaped); - } - - return 0; -} - -struct blockInfoData { - const char *dev; - qemuBlockStats data; -}; - -static const struct blockInfoData testBlockInfoData[] =3D -{ -/* NAME, rd_req, rd_bytes, wr_req, wr_bytes, rd_total_time, wr_total_time, - * flush_req, flush_total_time, capacity, physical, wr_highest_offset, - * wr_highest_offset_valid*/ - {"vda", {11, 12, 13, 14, 15, 16, 17, 18, 0, 0, 0, false}}, - {"vdb", {21, 22, 23, 24, 25, 26, 27, 28, 0, 0, 0, false}}, - {"vdc", {31, 32, 33, -1, 35, 36, 37, 38, 0, 0, 0, false}}, - {"vdd", {-1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, false}}, - {"vde", {41, 42, 43, 44, 45, 46, 47, 48, 0, 0, 0, false}} -}; - -static const char testBlockInfoReply[] =3D -"(qemu) info blockstats\r\n" -"vda: rd_operations=3D11 rd_bytes=3D12 wr_operations=3D13 wr_bytes=3D14 rd= _total_time_ns=3D15 wr_total_time_ns=3D16 flush_operations=3D17 flush_total= _time_ns=3D18\n" -"vdb: rd_total_time_ns=3D25 wr_total_time_ns=3D26 flush_operations=3D27 fl= ush_total_time_ns=3D28 rd_operations=3D21 rd_bytes=3D22 wr_operations=3D23 = wr_bytes=3D24 \n" -"drive-vdc: rd_operations=3D31 rd_bytes=3D32 wr_operations=3D33 rd_total_t= ime_ns=3D35 wr_total_time_ns=3D36 flush_operations=3D37 flush_total_time_ns= =3D38\n" -"vdd: \n" -"vde: rd_operations=3D41 rd_bytes=3D42 wr_operations=3D43 wr_bytes=3D44 rd= _total_time_ns=3D45 wr_total_time_ns=3D46 flush_operations=3D47 flush_total= _time_ns=3D48\n" -"(qemu) "; - -static int -testMonitorTextBlockInfo(const void *opaque) -{ - virDomainXMLOptionPtr xmlopt =3D (virDomainXMLOptionPtr) opaque; - qemuMonitorTestPtr test =3D qemuMonitorTestNewSimple(false, xmlopt); - virHashTablePtr blockstats =3D NULL; - size_t i; - int ret =3D -1; - - if (!test) - return -1; - - if (!(blockstats =3D virHashCreate(10, virHashValueFree))) - goto cleanup; - - if (qemuMonitorTestAddItem(test, "info", testBlockInfoReply) < 0) - goto cleanup; - - if (qemuMonitorTextGetAllBlockStatsInfo(qemuMonitorTestGetMonitor(test= ), - blockstats) < 0) - goto cleanup; - - for (i =3D 0; i < ARRAY_CARDINALITY(testBlockInfoData); i++) { - qemuBlockStatsPtr entry; - - if (!(entry =3D virHashLookup(blockstats, testBlockInfoData[i].dev= ))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "device '%s' was not found in text block stats = reply", - testBlockInfoData[i].dev); - goto cleanup; - } - - if (memcmp(entry, &testBlockInfoData[i].data, sizeof(qemuBlockStat= s)) !=3D 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "block stats for device '%s' differ", - testBlockInfoData[i].dev); - goto cleanup; - } - } - - ret =3D 0; - - cleanup: - qemuMonitorTestFree(test); - virHashFree(blockstats); - return ret; -} - - -static int -mymain(void) -{ - virQEMUDriver driver; - int result =3D 0; - - if (virThreadInitialize() < 0 || - qemuTestDriverInit(&driver) < 0) - return EXIT_FAILURE; - - virEventRegisterDefaultImpl(); - -# define DO_TEST(_name) \ - do { \ - if (virTestRun("qemu monitor "#_name, test##_name, \ - driver.xmlopt) < 0) { \ - result =3D -1; \ - } \ - } while (0) - - DO_TEST(EscapeArg); - DO_TEST(UnescapeArg); - DO_TEST(MonitorTextBlockInfo); - - qemuTestDriverFree(&driver); - - return result =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; -} - -VIR_TEST_MAIN(mymain) - -#else - -int main(void) -{ - return EXIT_AM_SKIP; -} - -#endif /* WITH_QEMU */ --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list