../src/memory/lowmem-limit.c)
# lowmem-system unit test
ADD_MEMORY_TESTS(lowmem-system-test ""
- "-Wl,--wrap=opendir,--wrap=readdir,--wrap=closedir"
+ "-Wl,--wrap=opendir,--wrap=readdir,--wrap=closedir,--wrap=opendir64,--wrap=readdir64,--wrap=closedir64"
lowmem-system-test.cpp lowmem-system-mock.cpp lowmem-system-env.cpp lowmem-env.cpp lowmem-env-mock.cpp
../src/memory/lowmem-system.c)
# lowmem-dbus unit test
return __real_##name call_args; \
}
+/* Macro WRAP64 is used for wrapping the large-file versions of the base call.
+ *
+ * Its params are similar to WRAP (except global_object), but they call the base version of
+ * the call (so as to keep the queue of mocks intact, i.e. allow "__will_return(foo, x)"
+ * to return the value even inside foo64.
+ *
+ * Keep in mind this only really works when the base call is mocked as well. */
+#define WRAP64(rettype, name, def_args, call_args) \
+ extern "C" rettype __wrap_##name##64 def_args { \
+ return __wrap_##name call_args; \
+ }
+
/*
* Macro MOCK is used for redirecting function handlers for mocked functions from resourced
* to global_test_lowmem_limit_env static object.
MOCK_SYSTEM(guint, g_source_attach, (GSource *source, GMainContext *context), (source, context))
#define WRAP_SYSTEM(rettype, name, def_args, call_args) \
- WRAP(global_test_lowmem_system_env, rettype, name, def_args, call_args)
+ WRAP(global_test_lowmem_system_env, rettype, name, def_args, call_args) \
+ WRAP64(rettype, name, def_args, call_args)
WRAP_SYSTEM(DIR *, opendir, (const char *name), (name))
WRAP_SYSTEM(int, closedir, (DIR *dirp), (dirp))