From nobody Mon Feb 9 17:34:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1612432506; cv=none; d=zohomail.com; s=zohoarc; b=JhGSPzksat5i81E0hkmYEIxfKS6j9IrH39rT6DRn7yfZC7jgmnwE7BZ1NJJqTZeBlHglzIge4OzV8XmWwhLFeMDh+ib3offvpb/JJfVwo5wFV8jNKxI6KqtOolGqdJs1WATlidQR3KL9zMohv1iNlLCgC14PFa0zc9D+RqpUZ4g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612432506; 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=6od0H9Tri6kPdrt5yXf5oi4CAD7PA0mvRdvpJMkdmzw=; b=ciqK8Q+2w5529z0RqA6ymn9tvsx+TqBHXKvKgbi1uVrvhcBcf8j1NC9ra3R1gdwLapuhYskKJI0lyL5yyZUQhtQiiy9i9OQrHIAXui5RLsUbbUDEpDj/bTcVtFlEb5mfIQjH1qpqaY63DLDFJav+oS3mVDx0JSeFJo8MPk3uwWk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612432506574616.4460122423924; Thu, 4 Feb 2021 01:55:06 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-602-jM3v87MsPVC8T3UQF8tVGA-1; Thu, 04 Feb 2021 04:54:40 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0240B801960; Thu, 4 Feb 2021 09:54:35 +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 99FFA10016F9; Thu, 4 Feb 2021 09:54:33 +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 60BB958074; Thu, 4 Feb 2021 09:54:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1149s7Wa026508 for ; Thu, 4 Feb 2021 04:54:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id 32524131EF; Thu, 4 Feb 2021 09:54:07 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.192.200]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8A22618E4F for ; Thu, 4 Feb 2021 09:54:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612432505; 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=6od0H9Tri6kPdrt5yXf5oi4CAD7PA0mvRdvpJMkdmzw=; b=gbyqkzGpz9d/BXc1BaSy5ACeXwKuUMCbncRxrto3bT2u6BmxqJqMFR5C/zmnoOXu88nDCH VBaQy7YMoproXOf7kl6R0kdmSOECxinjpTgXMbtb4+BIr8i79C5VsUfoCA66ltP+J+5H+O cogWG2s6j98IH2r6gLNg3thrJASQKEc= X-MC-Unique: jM3v87MsPVC8T3UQF8tVGA-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 2/2] tests: Improve macOS stat() mocking logic Date: Thu, 4 Feb 2021 10:53:56 +0100 Message-Id: <20210204095356.160505-3-abologna@redhat.com> In-Reply-To: <20210204095356.160505-1-abologna@redhat.com> References: <20210204095356.160505-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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) Content-Type: text/plain; charset="utf-8" We should not mock stat64() when building on Apple Silicon, because the declaration is not present in the header file. Detect this situation and handle it gracefully. https://gitlab.com/libvirt/libvirt/-/issues/121 Signed-off-by: Andrea Bolognani --- tests/virmockstathelpers.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/virmockstathelpers.c b/tests/virmockstathelpers.c index 97f628368d..830dfe1085 100644 --- a/tests/virmockstathelpers.c +++ b/tests/virmockstathelpers.c @@ -57,7 +57,9 @@ * * On macOS stat() and lstat() are resolved to _stat$INODE64 and * _lstat$INODE64, respectively. stat(2) man page also declares that - * stat64(), lstat64() and fstat64() are deprecated. + * stat64(), lstat64() and fstat64() are deprecated, and when + * building on Apple Silicon (aarch64) those functions are missing + * from the header altogether and should not be mocked. * * With all this in mind the list of functions we have to mock will depend * on several factors @@ -111,9 +113,13 @@ # endif /* WITH___LXSTAT_DECL */ #else /* __APPLE__ */ # define MOCK_STAT -# define MOCK_STAT64 +# if defined(WITH_STAT64_DECL) +# define MOCK_STAT64 +# endif # define MOCK_LSTAT -# define MOCK_LSTAT64 +# if defined(WITH_LSTAT64_DECL) +# define MOCK_LSTAT64 +# endif #endif =20 #ifdef MOCK_STAT --=20 2.26.2