From nobody Wed May 1 23:46:13 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 1501688361991937.3653868012815; Wed, 2 Aug 2017 08:39:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 260E74E33D; Wed, 2 Aug 2017 15:39:20 +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 EEB3A80A87; Wed, 2 Aug 2017 15:39:19 +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 A586E4A469; Wed, 2 Aug 2017 15:39:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v72Fd2NS032242 for ; Wed, 2 Aug 2017 11:39:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4BE957F770; Wed, 2 Aug 2017 15:39:02 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id 86A497F76D; Wed, 2 Aug 2017 15:39:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 260E74E33D Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 2 Aug 2017 17:39:01 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 1/3] util: hash: Include stdbool.h in the header file 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 02 Aug 2017 15:39:20 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The functions declared in virhash.h return bool, but stdbool.h was not included. --- src/util/virhash.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/virhash.h b/src/util/virhash.h index 00b2550e7..5b24fc000 100644 --- a/src/util/virhash.h +++ b/src/util/virhash.h @@ -14,6 +14,7 @@ # define __VIR_HASH_H__ # include +# include /* * The hash table. --=20 2.13.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 1 23:46:13 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 15016883493965.595824741243973; Wed, 2 Aug 2017 08:39:09 -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 A234573A4A; Wed, 2 Aug 2017 15:39:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3B7B17F76D; Wed, 2 Aug 2017 15:39:06 +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 8B92D180B467; Wed, 2 Aug 2017 15:39:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v72Fd3sF032252 for ; Wed, 2 Aug 2017 11:39:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 45E077F771; Wed, 2 Aug 2017 15:39:03 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98FF37F76D; Wed, 2 Aug 2017 15:39:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A234573A4A Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 2 Aug 2017 17:39:02 +0200 Message-Id: <1b1ce55433aa6d7735b8706fcd70b0179327565d.1501688308.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 2/3] util: hash: Make virHashCodeGen mockable 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.26]); Wed, 02 Aug 2017 15:39:07 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Export the function from the util module so that dynamic linking can override it. --- src/libvirt_private.syms | 4 ++++ src/util/virhashcode.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 054315fb7..32ac0835e 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1774,6 +1774,10 @@ virHashUpdateEntry; virHashValueFree; +# util/virhashcode.h +virHashCodeGen; + + # util/virhook.h virHookCall; virHookInitialize; diff --git a/src/util/virhashcode.h b/src/util/virhashcode.h index 7732f816c..f8171df26 100644 --- a/src/util/virhashcode.h +++ b/src/util/virhashcode.h @@ -30,6 +30,7 @@ # include "internal.h" -uint32_t virHashCodeGen(const void *key, size_t len, uint32_t seed); +uint32_t virHashCodeGen(const void *key, size_t len, uint32_t seed) + ATTRIBUTE_NOINLINE; #endif /* __VIR_HASH_CODE_H__ */ --=20 2.13.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 1 23:46:13 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 1501688362307784.6761695686639; Wed, 2 Aug 2017 08:39:22 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3D1227F3F9; Wed, 2 Aug 2017 15:39:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0F885808EA; Wed, 2 Aug 2017 15:39:20 +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 B5F4A180B467; Wed, 2 Aug 2017 15:39:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v72Fd4so032262 for ; Wed, 2 Aug 2017 11:39:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id 470E97F760; Wed, 2 Aug 2017 15:39:04 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id 949EF7F770; Wed, 2 Aug 2017 15:39:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3D1227F3F9 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 2 Aug 2017 17:39:03 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 3/3] tests: deterministichash: Make hash tables arch-independent 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 02 Aug 2017 15:39:20 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" It turns out that our implementation of the hashing function is endian-dependent and thus if used on various architectures the testsuite may have different results. Work this around by mocking virHashCodeGen to something which does not use bit operations instead of just setting a deterministic seed. --- .../qemumonitorjson-nodename-relative.result | 24 +++++++++++-------= ---- .../qemumonitorjson-nodename-same-backing.result | 24 +++++++++++-------= ---- tests/virdeterministichashmock.c | 17 +++++++++++---- tests/virmacmaptestdata/simple2.json | 12 +++++------ 4 files changed, 43 insertions(+), 34 deletions(-) diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.re= sult b/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.result index 6c0c77618..5288319d3 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.result +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.result @@ -1,15 +1,3 @@ -drive-ide0-0-1 -filename : '/var/lib/libvirt/images/relsnap.qcow2' -format node : '#block1290' -format drv : 'qcow2' -storage node: '#block1107' -storage drv : 'file' - filename : '/var/lib/libvirt/images/base.qcow2' - format node : '#block927' - format drv : 'qcow2' - storage node: '#block800' - storage drv : 'file' - drive-ide0-0-0 filename : '/var/lib/libvirt/images/img3' format node : '#block118' @@ -31,3 +19,15 @@ storage drv : 'file' format drv : 'qcow2' storage node: '#block614' storage drv : 'file' + +drive-ide0-0-1 +filename : '/var/lib/libvirt/images/relsnap.qcow2' +format node : '#block1290' +format drv : 'qcow2' +storage node: '#block1107' +storage drv : 'file' + filename : '/var/lib/libvirt/images/base.qcow2' + format node : '#block927' + format drv : 'qcow2' + storage node: '#block800' + storage drv : 'file' diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backin= g.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing.= result index 87431f7ca..7b12a1746 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing.result +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing.result @@ -1,15 +1,3 @@ -drive-sata0-0-1 -filename : '/var/lib/libvirt/images/b.qcow2' -format node : '#block548' -format drv : 'qcow2' -storage node: '#block487' -storage drv : 'file' - filename : '/var/lib/libvirt/images/base.qcow2' - format node : '#block771' - format drv : 'qcow2' - storage node: '#block692' - storage drv : 'file' - drive-sata0-0-0 filename : '/var/lib/libvirt/images/a.qcow2' format node : '#block132' @@ -21,3 +9,15 @@ storage drv : 'file' format drv : 'qcow2' storage node: '#block224' storage drv : 'file' + +drive-sata0-0-1 +filename : '/var/lib/libvirt/images/b.qcow2' +format node : '#block548' +format drv : 'qcow2' +storage node: '#block487' +storage drv : 'file' + filename : '/var/lib/libvirt/images/base.qcow2' + format node : '#block771' + format drv : 'qcow2' + storage node: '#block692' + storage drv : 'file' diff --git a/tests/virdeterministichashmock.c b/tests/virdeterministichashm= ock.c index d01f1c9e4..cd80cfcb5 100644 --- a/tests/virdeterministichashmock.c +++ b/tests/virdeterministichashmock.c @@ -20,10 +20,19 @@ #include -#include "virrandom.h" +#include "util/virhashcode.h" -uint64_t virRandomBits(int nbits ATTRIBUTE_UNUSED) +uint32_t +virHashCodeGen(const void *key, + size_t len, + uint32_t seed ATTRIBUTE_UNUSED) { - return 4; /* chosen by fair dice roll. - guaranteed to be random. */ + const uint8_t *k =3D key; + uint32_t h =3D 0; + size_t i; + + for (i =3D 0; i < len; i++) + h +=3D k[i]; + + return h; } diff --git a/tests/virmacmaptestdata/simple2.json b/tests/virmacmaptestdata= /simple2.json index 91b2cde0c..52132c241 100644 --- a/tests/virmacmaptestdata/simple2.json +++ b/tests/virmacmaptestdata/simple2.json @@ -1,16 +1,16 @@ [ { - "domain": "f25", + "domain": "f24", "macs": [ - "00:11:22:33:44:55", - "aa:bb:cc:00:11:22" + "aa:bb:cc:dd:ee:ff", + "a1:b2:c3:d4:e5:f6" ] }, { - "domain": "f24", + "domain": "f25", "macs": [ - "aa:bb:cc:dd:ee:ff", - "a1:b2:c3:d4:e5:f6" + "00:11:22:33:44:55", + "aa:bb:cc:00:11:22" ] } ] --=20 2.13.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list