[PATCH 10/11] tests: Avoid gnulib replacements in mocks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



gnulib headers change stat, lstat and open to replacement functions,
even for function definitions. This effectively disables standard
library overrides in virfilewrapper and virmockstathelpers since they
are never reached.

Rename the functions and provide a declartion that uses correct
assembler name for the mocks.

This fixes firmware lookup in domaincapstest on macOS.

Signed-off-by: Roman Bolshakov <r.bolshakov@xxxxxxxxx>
---
 tests/virfilewrapper.c     |  5 +++++
 tests/virmockstathelpers.c | 10 ++++++++++
 2 files changed, 15 insertions(+)

diff --git a/tests/virfilewrapper.c b/tests/virfilewrapper.c
index 067cb30657..20cb2f4464 100644
--- a/tests/virfilewrapper.c
+++ b/tests/virfilewrapper.c
@@ -157,7 +157,12 @@ int access(const char *path, int mode)
     return real_access(newpath ? newpath : path, mode);
 }
 
+#ifdef __APPLE__
+int _open(const char *path, int flags, ...) __asm("_open");
+int _open(const char *path, int flags, ...)
+#else
 int open(const char *path, int flags, ...)
+#endif
 {
     VIR_AUTOFREE(char *) newpath = NULL;
     va_list ap;
diff --git a/tests/virmockstathelpers.c b/tests/virmockstathelpers.c
index 1f6f831bed..4ddb0dfec1 100644
--- a/tests/virmockstathelpers.c
+++ b/tests/virmockstathelpers.c
@@ -192,7 +192,12 @@ static int virMockStatRedirect(const char *path, char **newpath);
 #endif
 
 #ifdef MOCK_STAT
+# ifdef __APPLE__
+int _stat(const char *path, struct stat *sb) __asm("_stat$INODE64");
+int _stat(const char *path, struct stat *sb)
+# else
 int stat(const char *path, struct stat *sb)
+# endif
 {
     VIR_AUTOFREE(char *) newpath = NULL;
 
@@ -262,8 +267,13 @@ __xstat64(int ver, const char *path, struct stat64 *sb)
 #endif
 
 #ifdef MOCK_LSTAT
+# ifdef __APPLE__
+int _lstat(const char *path, struct stat *sb) __asm("_lstat$INODE64");
+int _lstat(const char *path, struct stat *sb)
+# else
 int
 lstat(const char *path, struct stat *sb)
+# endif
 {
     VIR_AUTOFREE(char *) newpath = NULL;
 
-- 
2.22.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux