libvirt/0003-tests-Re-introduce-stat-lstat-mocks-on-macOS.patch
DistroBaker 1e0bcdcdf3 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/libvirt.git#7eef88add4af32ea98ecdd40e5aa8f9634868185
2020-11-02 13:35:50 +00:00

62 lines
2.0 KiB
Diff

From c46299170bd318bc1ffc95da1774515634fd03d9 Mon Sep 17 00:00:00 2001
From: Roman Bolshakov <r.bolshakov@yadro.com>
Date: Sun, 18 Oct 2020 18:30:57 +0300
Subject: [PATCH 2/3] tests: Re-introduce stat/lstat mocks on macOS
Commit d6b17edd5163 ("tests: Lookup extended stat/lstat in mocks")
adds support for mocking of stat() and lstat() on macOS.
The change was broken because virmockstathelpers.c only follows glibc
logic and MOCK_STAT and MOCK_LSTAT are not getting defined on macOS.
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
tests/virmockstathelpers.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/tests/virmockstathelpers.c b/tests/virmockstathelpers.c
index 90b9ceedb6..5a71de24e9 100644
--- a/tests/virmockstathelpers.c
+++ b/tests/virmockstathelpers.c
@@ -55,6 +55,10 @@
* Unfortunately, because we are trying to mock replace the C library,
* we need to know about this internal impl detail.
*
+ * 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.
+ *
* With all this in mind the list of functions we have to mock will depend
* on several factors
*
@@ -68,8 +72,10 @@
-#if defined(WITH_STAT) && !defined(WITH___XSTAT) && !defined(WITH_STAT64)
-# define MOCK_STAT
+#if defined(WITH_STAT)
+# if !defined(WITH___XSTAT) && !defined(WITH_STAT64) || defined(__APPLE__)
+# define MOCK_STAT
+# endif
#endif
#if defined(WITH_STAT64) && !defined(WITH___XSTAT64)
# define MOCK_STAT64
@@ -80,8 +86,10 @@
#if defined(WITH___XSTAT64)
# define MOCK___XSTAT64
#endif
-#if defined(WITH_LSTAT) && !defined(WITH___LXSTAT) && !defined(WITH_LSTAT64)
-# define MOCK_LSTAT
+#if defined(WITH_LSTAT)
+# if !defined(WITH___LXSTAT) && !defined(WITH_LSTAT64) || defined(__APPLE__)
+# define MOCK_LSTAT
+# endif
#endif
#if defined(WITH_LSTAT64) && !defined(WITH___LXSTAT64)
# define MOCK_LSTAT64
--
2.28.0