]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: Avoid gnulib replacements in mocks
authorRoman Bolshakov <r.bolshakov@yadro.com>
Wed, 21 Aug 2019 16:13:22 +0000 (19:13 +0300)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 23 Aug 2019 10:26:26 +0000 (11:26 +0100)
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@yadro.com>
tests/virfilewrapper.c
tests/virmockstathelpers.c

index 067cb30657e377d5d1f7cf423cc18d0242b0cad3..160cd571e0bf0f20e3f7dd91a36e575b14cf395c 100644 (file)
@@ -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;
index 485063be8498f2c8f0858ae9c2acf3c304938153..0e13ce60b7cd764e5ee33c0bab775e4d08bf1b83 100644 (file)
@@ -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;