libgit_c_args += '-DHAVE_FSMONITOR_DAEMON_BACKEND'
libgit_c_args += '-DHAVE_FSMONITOR_OS_SETTINGS'
- libgit_sources += [
+ compat_sources += [
'compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c',
- 'compat/fsmonitor/fsm-ipc-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-ipc-' + fsmonitor_os + '.c',
'compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c',
'compat/fsmonitor/fsm-path-utils-' + fsmonitor_backend + '.c',
- 'compat/fsmonitor/fsm-settings-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-settings-' + fsmonitor_os + '.c',
]
endif
build_options_config.set_quoted('FSMONITOR_DAEMON_BACKEND', fsmonitor_backend)
directory_to_file &&
- test-tool fsmonitor-client query --token 0 &&
-
- grep "^event: dir1$" .git/trace
+ retry_grep "^event: dir1$" .git/trace
'
+ test_expect_success 'rapid nested directory creation' '
+ test_when_finished "git fsmonitor--daemon stop; rm -rf rapid" &&
+
+ start_daemon --tf "$PWD/.git/trace" &&
+
+ # Rapidly create nested directories to exercise race conditions
+ # where directory watches may be added concurrently during
+ # event processing and recursive scanning.
+ for i in $(test_seq 1 20)
+ do
+ mkdir -p "rapid/nested/dir$i/subdir/deep" || return 1
+ done &&
+
+ # Give the daemon time to process all events
+ sleep 1 &&
+
+ test-tool fsmonitor-client query --token 0 &&
+
+ # Verify daemon is still running (did not crash)
+ git fsmonitor--daemon status
+ '
+
# The next few test cases exercise the token-resync code. When filesystem
# drops events (because of filesystem velocity or because the daemon isn't
# polling fast enough), we need to discard the cached data (relative to the