From nobody Sun Feb 8 10:33:25 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.74 as permitted sender) client-ip=170.10.133.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651820408; cv=none; d=zohomail.com; s=zohoarc; b=hsFsHpi5TkwdvifjjJ7aMXLWqXcPq4ZS7q8/AuLrYt20d2hZERobHV1tX6aq+kGw9tEys5YBSXC9Ru1uW18QEzwgAnN5ll6ZmAmRoeq62YX5MPQFPinPE6YyS/4dYsmfhj+THi3xl9HeQxhcRtSkkYUTtU2KVOlm1Ac4X59Fx2w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651820408; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fC8GAx69sinN8DqywBR4gEZe7XNo5O5yCHFEXB4Qizk=; b=nj7idSEZowjRciTGej426SbVggTbDvzqBHLQli/x1wDYDGNlmuzCz98KChnokZsnL/G5uCf8slWIZTkD/obTBkUU7S2u7VZgFBoG/M42CC4B4gsdaPUTfjJv2SVm6+VGoF2v+vgzW8aeNxgNJVl1Ag8xFLDZT+mZwDXQrjUG0hw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [170.10.133.74]) by mx.zohomail.com with SMTPS id 1651820408225470.90431788504156; Fri, 6 May 2022 00:00:08 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-630-yusy58D0MEyoYhcvf2SvwQ-1; Fri, 06 May 2022 02:59:39 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4F776188144E; Fri, 6 May 2022 06:59:34 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 46FB1C28124; Fri, 6 May 2022 06:59:33 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D40611947B87; Fri, 6 May 2022 06:59:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9D8AE1947056 for ; Fri, 6 May 2022 06:59:29 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 7E3A9C27E97; Fri, 6 May 2022 06:59:29 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2634BC27DB8 for ; Fri, 6 May 2022 06:59:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651820407; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=fC8GAx69sinN8DqywBR4gEZe7XNo5O5yCHFEXB4Qizk=; b=B94kSv+gV/T1wpp/+fU6E0GGcvKCIxk0MVd2IEAGCry0fnq6U3jCFWFd0uzwbxyGgH3BJU 02GUiINVjcVE92WnOMDoonaHN5B7CVg4BYMJYS3ewRMP5lqOiYYSmrC1PLiUorK7DC7Kx1 AnDSpKvd3VmJnzsawoyCT1TNb7yMgw8= X-MC-Unique: yusy58D0MEyoYhcvf2SvwQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/2] testutils: Write setter for virTestHostArch global variable Date: Fri, 6 May 2022 08:59:26 +0200 Message-Id: <31e45dfc822eb57868b7fd94d5df70e63b2153fe.1651820156.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651820409162100001 Content-Type: text/plain; charset="utf-8"; x-default="true" As of 47503cc859 we are statically linking libtest_utils.a into qemuhotplugmock.so (see the original commit for reasoning). However, this breaks ASAN on older clang because now qemuhotplugtest has two instances of virTestHostArch global variable. One that comes from the binary itself (which also links with libtest_utils.a) and the other from the mock. Resolve this by making the variable static and introducing getter and setter. Well, the former already exists (as virArchFromHost()) so only the latter is needed. Signed-off-by: Michal Privoznik --- tests/testutils.c | 7 ++++++- tests/testutils.h | 2 +- tests/testutilsqemu.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/testutils.c b/tests/testutils.c index 2b37c1965d..9d454c23bc 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -55,7 +55,7 @@ static size_t testCounter; static virBitmap *testBitmap; static virBitmap *failedTests; =20 -virArch virTestHostArch =3D VIR_ARCH_X86_64; +static virArch virTestHostArch =3D VIR_ARCH_X86_64; =20 virArch virArchFromHost(void) @@ -63,6 +63,11 @@ virArchFromHost(void) return virTestHostArch; } =20 +void +virTestSetHostArch(virArch arch) +{ + virTestHostArch =3D arch; +} =20 static int virTestUseTerminalColors(void) { diff --git a/tests/testutils.h b/tests/testutils.h index 13a154a5af..ff5661bb3f 100644 --- a/tests/testutils.h +++ b/tests/testutils.h @@ -35,7 +35,7 @@ # error Fix build system #endif =20 -extern virArch virTestHostArch; +void virTestSetHostArch(virArch arch); =20 int virTestRun(const char *title, int (*body)(const void *data), diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 105b41cbeb..53fb5f656d 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -307,7 +307,7 @@ qemuTestSetHostArch(virQEMUDriver *driver, if (arch =3D=3D VIR_ARCH_NONE) arch =3D VIR_ARCH_X86_64; =20 - virTestHostArch =3D arch; + virTestSetHostArch(arch); driver->hostarch =3D virArchFromHost(); driver->caps->host.arch =3D virArchFromHost(); qemuTestSetHostCPU(driver, arch, NULL); --=20 2.35.1