diff options
-rw-r--r-- | lib/common/BoxPlatform.h | 2 | ||||
-rw-r--r-- | lib/intercept/intercept.h | 5 | ||||
-rw-r--r-- | test/bbackupd/testbbackupd.cpp | 12 |
3 files changed, 14 insertions, 5 deletions
diff --git a/lib/common/BoxPlatform.h b/lib/common/BoxPlatform.h index 3ae929ef..28822aa8 100644 --- a/lib/common/BoxPlatform.h +++ b/lib/common/BoxPlatform.h @@ -51,6 +51,8 @@ #define PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE #endif + #define PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE + // Disable memory testing under Darwin, it just doesn't like it very much. #ifdef __APPLE__ // TODO: We really should get some decent leak detection code. diff --git a/lib/intercept/intercept.h b/lib/intercept/intercept.h index b1122434..bc6557f3 100644 --- a/lib/intercept/intercept.h +++ b/lib/intercept/intercept.h @@ -9,6 +9,7 @@ #ifndef INTERCEPT_H #define INTERCEPT_H +#ifndef PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE #include <dirent.h> @@ -35,8 +36,12 @@ extern "C" void intercept_setup_error(const char *filename, unsigned int errorafter, int errortoreturn, int syscalltoerror); +void intercept_setup_delay(const char *filename, unsigned int delay_after, + int delay_ms, int syscall_to_delay, int num_delays); +bool intercept_triggered(); void intercept_setup_readdir_hook(const char *dirname, readdir_t hookfn); void intercept_setup_lstat_hook (const char *filename, lstat_t hookfn); +#endif // !PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE #endif // !INTERCEPT_H diff --git a/test/bbackupd/testbbackupd.cpp b/test/bbackupd/testbbackupd.cpp index 8a1c711f..d1bf4a98 100644 --- a/test/bbackupd/testbbackupd.cpp +++ b/test/bbackupd/testbbackupd.cpp @@ -9,6 +9,7 @@ #include "Box.h" +#include <dirent.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> @@ -509,11 +510,6 @@ void do_interrupted_restore(const TLSContext &context, int64_t restoredirid) } } -void intercept_setup_delay(const char *filename, unsigned int delay_after, - int delay_ms, int syscall_to_delay, int num_delays); - -bool intercept_triggered(); - int start_internal_daemon() { // ensure that no child processes end up running tests! @@ -598,7 +594,9 @@ int lstat_test_hook(const char *file_name, struct stat *buf); struct dirent *readdir_test_hook_1(DIR *dir) { +#ifndef PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE intercept_setup_readdir_hook(NULL, readdir_test_hook_2); +#endif return NULL; } @@ -609,8 +607,10 @@ struct dirent *readdir_test_hook_2(DIR *dir) { if (time(NULL) >= readdir_stop_time) { +#ifndef PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE intercept_setup_readdir_hook(NULL, NULL); intercept_setup_lstat_hook (NULL, NULL); +#endif // we will not be called again. } @@ -626,7 +626,9 @@ struct dirent *readdir_test_hook_2(DIR *dir) snprintf(stat_hook_filename, sizeof(stat_hook_filename), "testfiles/TestDir1/spacetest/d1/test.%d", readdir_test_counter); +#ifndef PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE intercept_setup_lstat_hook(stat_hook_filename, lstat_test_hook); +#endif return &readdir_test_dirent; } |