[PATCH 1/4] tests: Fix opendir mocks on macOS

Roman Bolshakov posted 4 patches 4 years ago
There is a newer version of this series
[PATCH 1/4] tests: Fix opendir mocks on macOS
Posted by Roman Bolshakov 4 years ago
opendir() mocks need to search for decorated function with $INODE64
suffix, like stat mocks.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
---
 tests/virfilewrapper.c | 4 ++++
 tests/virpcimock.c     | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/tests/virfilewrapper.c b/tests/virfilewrapper.c
index 0500a3617e..ca2356b5c9 100644
--- a/tests/virfilewrapper.c
+++ b/tests/virfilewrapper.c
@@ -56,7 +56,11 @@ static void init_syms(void)
     VIR_MOCK_REAL_INIT(access);
     VIR_MOCK_REAL_INIT(mkdir);
     VIR_MOCK_REAL_INIT(open);
+# ifdef __APPLE__
+    VIR_MOCK_REAL_INIT_ALIASED(opendir, "opendir$INODE64");
+# else
     VIR_MOCK_REAL_INIT(opendir);
+# endif
     VIR_MOCK_REAL_INIT(execv);
     VIR_MOCK_REAL_INIT(execve);
 }
diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index 5cd688c825..686f894e99 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -935,7 +935,11 @@ init_syms(void)
     VIR_MOCK_REAL_INIT(__open_2);
 # endif /* ! __GLIBC__ */
     VIR_MOCK_REAL_INIT(close);
+# ifdef __APPLE__
+    VIR_MOCK_REAL_INIT_ALIASED(opendir, "opendir$INODE64");
+# else
     VIR_MOCK_REAL_INIT(opendir);
+# endif
     VIR_MOCK_REAL_INIT(virFileCanonicalizePath);
 }
 
-- 
2.29.2


Re: [PATCH 1/4] tests: Fix opendir mocks on macOS
Posted by Michal Privoznik 4 years ago
On 11/8/20 10:24 PM, Roman Bolshakov wrote:
> opendir() mocks need to search for decorated function with $INODE64
> suffix, like stat mocks.
> 
> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
> ---
>   tests/virfilewrapper.c | 4 ++++
>   tests/virpcimock.c     | 4 ++++
>   2 files changed, 8 insertions(+)
> 

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal