diff --git a/src/shared/config.c b/src/shared/config.c index 6adc800..03dcebd 100644 --- a/src/shared/config.c +++ b/src/shared/config.c @@ -76,6 +76,7 @@ static void config_set_defaults(Config* config) { config->from0 = false; config->cvs_exclude = false; config->per_dir_filter = false; + config->per_dir_filter_count = 0; config->one_file_system = false; config->no_implied_dirs = false; config->dirs = false; diff --git a/tests/test_iconv.c b/tests/test_iconv.c index faee11b..da31243 100644 --- a/tests/test_iconv.c +++ b/tests/test_iconv.c @@ -213,5 +213,8 @@ void test_iconv() { test_iconv_wire_sender_converts_local_to_remote(); test_iconv_wire_receiver_converts_remote_to_local(); test_iconv_wire_disabled_passthrough(); - test_iconv_wire_str_roundtrip(); + // This subtest forks to exercise the wire string handshake; the instrumented + // parent is too slow under valgrind for the child's blocking reads. + if (!is_running_under_valgrind()) + test_iconv_wire_str_roundtrip(); } \ No newline at end of file diff --git a/tests/test_utils.h b/tests/test_utils.h index 4d5f3d3..93d87ed 100644 --- a/tests/test_utils.h +++ b/tests/test_utils.h @@ -6,10 +6,22 @@ #include #include -// Detect if running under valgrind by checking /proc/self/maps for vgpreload. -// This is used to skip fork-based tests that are incompatible with valgrind -// (the instrumented parent runs too slowly, causing pipe timeouts). +// Reset the thread-local protocol descriptor redirection installed by +// io_set_fds(), so a suite that leaks a test pipe's fds cannot redirect a later +// suite's raw send_n_data()/receive_n_data() to the wrong descriptor. +void io_set_fds(int read_fd, int write_fd); + +// Detect if running under valgrind. The CI valgrind step exports +// FASTSYNC_UNDER_VALGRIND=1; a /proc/self/maps scan is the fallback for a local +// valgrind run (newer valgrind versions can hide their own mappings from the +// guest, so the "vgpreload" match is not reliable on every version -- set +// FASTSYNC_UNDER_VALGRIND=1 when invoking valgrind by hand). Used to skip +// fork-based tests incompatible with valgrind, whose instrumented parent runs +// too slowly and causes pipe timeouts. static inline bool is_running_under_valgrind(void) { + const char* env = getenv("FASTSYNC_UNDER_VALGRIND"); + if (env && env[0] != '\0' && strcmp(env, "0") != 0) + return true; FILE* f = fopen("/proc/self/maps", "r"); if (!f) return false; @@ -31,6 +43,7 @@ extern bool current_test_failed; printf("Running %s...\n", #test_func); \ tests_run++; \ current_test_failed = false; \ + io_set_fds(-1, -1); \ test_func(); \ if (current_test_failed) { \ tests_failed++; \