[libvirt PATCH] tests: Only mock $INODE64 symbols on x86_64 macOS

Andrea Bolognani posted 1 patch 3 years, 1 month ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20210205102756.335901-1-abologna@redhat.com
tests/virfilewrapper.c     | 2 +-
tests/virmockstathelpers.c | 4 ++--
tests/virpcimock.c         | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
[libvirt PATCH] tests: Only mock $INODE64 symbols on x86_64 macOS
Posted by Andrea Bolognani 3 years, 1 month ago
The version of macOS running on Apple Silicon doesn't need to
concern itself with backwards compatibility with 32-bit
applications, and so it could jettison all the symbol aliasing
shenanigans involved.

https://gitlab.com/libvirt/libvirt/-/issues/121

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 tests/virfilewrapper.c     | 2 +-
 tests/virmockstathelpers.c | 4 ++--
 tests/virpcimock.c         | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/virfilewrapper.c b/tests/virfilewrapper.c
index ca2356b5c9..1369cfb766 100644
--- a/tests/virfilewrapper.c
+++ b/tests/virfilewrapper.c
@@ -56,7 +56,7 @@ static void init_syms(void)
     VIR_MOCK_REAL_INIT(access);
     VIR_MOCK_REAL_INIT(mkdir);
     VIR_MOCK_REAL_INIT(open);
-# ifdef __APPLE__
+# if defined(__APPLE__) && defined(__x86_64__)
     VIR_MOCK_REAL_INIT_ALIASED(opendir, "opendir$INODE64");
 # else
     VIR_MOCK_REAL_INIT(opendir);
diff --git a/tests/virmockstathelpers.c b/tests/virmockstathelpers.c
index 830dfe1085..9344345baa 100644
--- a/tests/virmockstathelpers.c
+++ b/tests/virmockstathelpers.c
@@ -161,7 +161,7 @@ static void virMockStatInit(void)
     debug = getenv("VIR_MOCK_STAT_DEBUG");
 
 #ifdef MOCK_STAT
-# ifdef __APPLE__
+# if defined(__APPLE__) && defined(__x86_64__)
     VIR_MOCK_REAL_INIT_ALIASED(stat, "stat$INODE64");
 # else
     VIR_MOCK_REAL_INIT(stat);
@@ -181,7 +181,7 @@ static void virMockStatInit(void)
     fdebug("real __xstat64 %p\n", real___xstat64);
 #endif
 #ifdef MOCK_LSTAT
-# ifdef __APPLE__
+# if defined(__APPLE__) && defined(__x86_64__)
     VIR_MOCK_REAL_INIT_ALIASED(lstat, "lstat$INODE64");
 # else
     VIR_MOCK_REAL_INIT(lstat);
diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index f6280fc8b5..d1c6220c57 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -936,7 +936,7 @@ init_syms(void)
     VIR_MOCK_REAL_INIT(__open_2);
 # endif /* ! __GLIBC__ */
     VIR_MOCK_REAL_INIT(close);
-# ifdef __APPLE__
+# if defined(__APPLE__) && defined(__x86_64__)
     VIR_MOCK_REAL_INIT_ALIASED(opendir, "opendir$INODE64");
 # else
     VIR_MOCK_REAL_INIT(opendir);
-- 
2.26.2

Re: [libvirt PATCH] tests: Only mock $INODE64 symbols on x86_64 macOS
Posted by Roman Bolshakov 3 years, 1 month ago
On Fri, Feb 05, 2021 at 11:27:56AM +0100, Andrea Bolognani wrote:
> The version of macOS running on Apple Silicon doesn't need to
> concern itself with backwards compatibility with 32-bit
> applications, and so it could jettison all the symbol aliasing
> shenanigans involved.
> 
> https://gitlab.com/libvirt/libvirt/-/issues/121
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  tests/virfilewrapper.c     | 2 +-
>  tests/virmockstathelpers.c | 4 ++--
>  tests/virpcimock.c         | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 

Hi Andrea,

Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Tested-by: Roman Bolshakov <r.bolshakov@yadro.com>

Thanks,
Roman