From nobody Mon Apr 29 01:06:02 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 150123864979413.135843158940588; Fri, 28 Jul 2017 03:44:09 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B24C1C051589; Fri, 28 Jul 2017 10:44:07 +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 4099C77C9A; Fri, 28 Jul 2017 10:44:07 +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 E2EE614B22; Fri, 28 Jul 2017 10:44:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6SAhkxn014135 for ; Fri, 28 Jul 2017 06:43:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id A3A1C785DD; Fri, 28 Jul 2017 10:43:46 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id F10057E5A4; Fri, 28 Jul 2017 10:43:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B24C1C051589 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 28 Jul 2017 12:43:44 +0200 Message-Id: <357f32214fd96759cdaa9c8b5fd47b0099442b9d.1501238505.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH v2 1/2] tests: utils: Allow NULL strings to be equal to empty file in virTestCompareToFile 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 28 Jul 2017 10:44:08 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Treat an NULL string equivalent to an empty string in virTestCompareToFile so that callers don't need to add additional logic in case when a test produces no output. --- tests/testutils.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/testutils.c b/tests/testutils.c index 40e9650fd..71692f1fa 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -777,6 +777,8 @@ int virTestDifferenceBin(FILE *stream, /* * @param strcontent: String input content * @param filename: File to compare strcontent against + * + * If @strcontent is NULL, it's treated as an empty string. */ int virTestCompareToFile(const char *strcontent, @@ -787,6 +789,9 @@ virTestCompareToFile(const char *strcontent, char *fixedcontent =3D NULL; const char *cmpcontent =3D strcontent; + if (!cmpcontent) + cmpcontent =3D ""; + if (virTestLoadFile(filename, &filecontent) < 0 && !virTestGetRegenera= te()) goto failure; --=20 2.13.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 01:06:02 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1501238634635561.4611709582434; Fri, 28 Jul 2017 03:43:54 -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 82C34F9911; Fri, 28 Jul 2017 10:43:52 +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 2EB0A6F42B; Fri, 28 Jul 2017 10:43:52 +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 9A6E03FCFB; Fri, 28 Jul 2017 10:43:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6SAhmC2014145 for ; Fri, 28 Jul 2017 06:43:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id C67C9785FE; Fri, 28 Jul 2017 10:43:48 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id 57729785DD; Fri, 28 Jul 2017 10:43:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 82C34F9911 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 28 Jul 2017 12:43:45 +0200 Message-Id: <16e7348a59c3e520346a2880cdf306f9795591a2.1501238505.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH v2 2/2] tests: qemumonitorjson: Old and empty test case for node name detection 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.27]); Fri, 28 Jul 2017 10:43:53 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Prior to qemu 2.5 the node names would not be generated, thus would be missing from 'query-blockstats' and 'query-named-block-nodes'. Test that the code correctly detects nothing. Additionally make sure that a VM without disks does not cause problems. The test case change is necessary as our test file checker does not play well with empty files. --- .../qemumonitorjson-nodename-empty-blockstats.json | 2 + ...qemumonitorjson-nodename-empty-named-nodes.json | 2 + .../qemumonitorjson-nodename-empty.result | 0 .../qemumonitorjson-nodename-old-blockstats.json | 160 +++++++++++++++++= ++++ .../qemumonitorjson-nodename-old-named-nodes.json | 2 + .../qemumonitorjson-nodename-old.result | 0 tests/qemumonitorjsontest.c | 2 + 7 files changed, 168 insertions(+) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-empt= y-blockstats.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-empt= y-named-nodes.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-empt= y.result create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-old-= blockstats.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-old-= named-nodes.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-old.= result diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-empty-block= stats.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-empty-block= stats.json new file mode 100644 index 000000000..0d4f101c7 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-empty-blockstats.j= son @@ -0,0 +1,2 @@ +[ +] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-empty-named= -nodes.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-empty-name= d-nodes.json new file mode 100644 index 000000000..0d4f101c7 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-empty-named-nodes.= json @@ -0,0 +1,2 @@ +[ +] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-empty.resul= t b/tests/qemumonitorjsondata/qemumonitorjson-nodename-empty.result new file mode 100644 index 000000000..e69de29bb diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-old-blockst= ats.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-old-blockstat= s.json new file mode 100644 index 000000000..26c14f9f2 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-old-blockstats.json @@ -0,0 +1,160 @@ +[ + { + "device": "drive-virtio-disk0", + "parent": { + "stats": { + "flush_total_time_ns": 0, + "wr_highest_offset": 32899072, + "wr_total_time_ns": 0, + "failed_wr_operations": 0, + "failed_rd_operations": 0, + "wr_merged": 0, + "wr_bytes": 0, + "timed_stats": [ + + ], + "failed_flush_operations": 0, + "account_invalid": false, + "rd_total_time_ns": 0, + "flush_operations": 0, + "wr_operations": 0, + "rd_merged": 0, + "rd_bytes": 0, + "invalid_flush_operations": 0, + "account_failed": false, + "rd_operations": 0, + "invalid_wr_operations": 0, + "invalid_rd_operations": 0 + } + }, + "stats": { + "flush_total_time_ns": 452246313, + "wr_highest_offset": 8072282112, + "wr_total_time_ns": 4803102521, + "failed_wr_operations": 0, + "failed_rd_operations": 0, + "wr_merged": 8, + "wr_bytes": 6517248, + "timed_stats": [ + + ], + "failed_flush_operations": 0, + "account_invalid": true, + "rd_total_time_ns": 11065169148, + "flush_operations": 10, + "wr_operations": 129, + "rd_merged": 77, + "rd_bytes": 76399104, + "invalid_flush_operations": 0, + "account_failed": true, + "idle_time_ns": 22663656304, + "rd_operations": 4038, + "invalid_wr_operations": 0, + "invalid_rd_operations": 0 + }, + "backing": { + "parent": { + "stats": { + "flush_total_time_ns": 0, + "wr_highest_offset": 0, + "wr_total_time_ns": 0, + "failed_wr_operations": 0, + "failed_rd_operations": 0, + "wr_merged": 0, + "wr_bytes": 0, + "timed_stats": [ + + ], + "failed_flush_operations": 0, + "account_invalid": false, + "rd_total_time_ns": 0, + "flush_operations": 0, + "wr_operations": 0, + "rd_merged": 0, + "rd_bytes": 0, + "invalid_flush_operations": 0, + "account_failed": false, + "rd_operations": 0, + "invalid_wr_operations": 0, + "invalid_rd_operations": 0 + } + }, + "stats": { + "flush_total_time_ns": 0, + "wr_highest_offset": 0, + "wr_total_time_ns": 0, + "failed_wr_operations": 0, + "failed_rd_operations": 0, + "wr_merged": 0, + "wr_bytes": 0, + "timed_stats": [ + + ], + "failed_flush_operations": 0, + "account_invalid": false, + "rd_total_time_ns": 0, + "flush_operations": 0, + "wr_operations": 0, + "rd_merged": 0, + "rd_bytes": 0, + "invalid_flush_operations": 0, + "account_failed": false, + "rd_operations": 0, + "invalid_wr_operations": 0, + "invalid_rd_operations": 0 + }, + "backing": { + "parent": { + "stats": { + "flush_total_time_ns": 0, + "wr_highest_offset": 0, + "wr_total_time_ns": 0, + "failed_wr_operations": 0, + "failed_rd_operations": 0, + "wr_merged": 0, + "wr_bytes": 0, + "timed_stats": [ + + ], + "failed_flush_operations": 0, + "account_invalid": false, + "rd_total_time_ns": 0, + "flush_operations": 0, + "wr_operations": 0, + "rd_merged": 0, + "rd_bytes": 0, + "invalid_flush_operations": 0, + "account_failed": false, + "rd_operations": 0, + "invalid_wr_operations": 0, + "invalid_rd_operations": 0 + } + }, + "stats": { + "flush_total_time_ns": 0, + "wr_highest_offset": 0, + "wr_total_time_ns": 0, + "failed_wr_operations": 0, + "failed_rd_operations": 0, + "wr_merged": 0, + "wr_bytes": 0, + "timed_stats": [ + + ], + "failed_flush_operations": 0, + "account_invalid": false, + "rd_total_time_ns": 0, + "flush_operations": 0, + "wr_operations": 0, + "rd_merged": 0, + "rd_bytes": 0, + "invalid_flush_operations": 0, + "account_failed": false, + "rd_operations": 0, + "invalid_wr_operations": 0, + "invalid_rd_operations": 0 + } + } + } + } +] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-old-named-n= odes.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-old-named-no= des.json new file mode 100644 index 000000000..0d4f101c7 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-old-named-nodes.js= on @@ -0,0 +1,2 @@ +[ +] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-old.result = b/tests/qemumonitorjsondata/qemumonitorjson-nodename-old.result new file mode 100644 index 000000000..e69de29bb diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index f2090a4ca..df3ef0a93 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2933,6 +2933,8 @@ mymain(void) DO_TEST_BLOCK_NODE_DETECT("blockjob"); DO_TEST_BLOCK_NODE_DETECT("luks"); DO_TEST_BLOCK_NODE_DETECT("iscsi"); + DO_TEST_BLOCK_NODE_DETECT("old"); + DO_TEST_BLOCK_NODE_DETECT("empty"); #undef DO_TEST_BLOCK_NODE_DETECT --=20 2.13.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list