On Sat, May 13, 2023 at 12:12:41AM +0200, Michal Prívozník wrote:
On 5/12/23 19:20, Michal Privoznik wrote:And I just thought of another alternative: diff --git i/tests/virmockstathelpers.c w/tests/virmockstathelpers.c index 5b1f3b08a7..8a76c5e369 100644 --- i/tests/virmockstathelpers.c +++ w/tests/virmockstathelpers.c @@ -118,20 +118,30 @@ # define MOCK_STAT # if defined(WITH_STAT64_DECL) # define MOCK_STAT64 # endif # define MOCK_LSTAT # if defined(WITH_LSTAT64_DECL) # define MOCK_LSTAT64 # endif #endif +#if !defined(MOCK_STAT) && !defined(MOCK_STAT64) && \ + !defined(MOCK___XSTAT) && !defined(MOCK___XSTAT64) +# define MOCK_STAT +#endif + +#if !defined(MOCK_LSTAT) && !defined(MOCK_LSTAT64) && \ + !defined(MOCK___LXSTAT) && !defined(MOCK___LXSTAT64) +# define MOCK_LSTAT +#endif + #ifdef MOCK_STAT static int (*real_stat)(const char *path, struct stat *sb); #endif #ifdef MOCK_STAT64 static int (*real_stat64)(const char *path, struct stat64 *sb); #endif #ifdef MOCK___XSTAT static int (*real___xstat)(int ver, const char *path, struct stat *sb); #endif #ifdef MOCK___XSTAT64 But I can't decide which is better.
I think this one is better because it basically says "if there's nothing to mock, then mock stat". It is more readable, but I wasn't sure whether it will also work on 32bit musl with largefile64. After some mental exercise I think it will. So this should be safe to push and I'll setup an environment for it in the meantime and will report results afterwards. Reviewed-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
Michal
Attachment:
signature.asc
Description: PGP signature