diff options
author | Jan Korous <jkorous@apple.com> | 2019-08-01 23:24:30 +0000 |
---|---|---|
committer | Jan Korous <jkorous@apple.com> | 2019-08-01 23:24:30 +0000 |
commit | 9debb024d44db54b9453459d3bd98d28c20a163f (patch) | |
tree | 9eedad994306a24bb1e8db0e482b4bac7c783827 /clang | |
parent | d544d1441d98308eeea98969c3311bbd24fd6b0f (diff) | |
download | bcm5719-llvm-9debb024d44db54b9453459d3bd98d28c20a163f.tar.gz bcm5719-llvm-9debb024d44db54b9453459d3bd98d28c20a163f.zip |
[DirectoryWatcher] Relax assumption to prevent test flakiness
llvm-svn: 367632
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp | 18 | ||||
-rw-r--r-- | clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp | 2 |
2 files changed, 19 insertions, 1 deletions
diff --git a/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp b/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp index 3df79ac48a4..ae3cb614163 100644 --- a/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp +++ b/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp @@ -25,6 +25,24 @@ static void stopFSEventStream(FSEventStreamRef); namespace { +/// This implementation is based on FSEvents API which implementation is +/// aggressively coallescing events. This can manifest as duplicate events. +/// +/// For example this scenario has been observed: +/// +/// create foo/bar +/// sleep 5 s +/// create DirectoryWatcherMac for dir foo +/// receive notification: bar EventKind::Modified +/// sleep 5 s +/// modify foo/bar +/// receive notification: bar EventKind::Modified +/// receive notification: bar EventKind::Modified +/// sleep 5 s +/// delete foo/bar +/// receive notification: bar EventKind::Modified +/// receive notification: bar EventKind::Modified +/// receive notification: bar EventKind::Removed class DirectoryWatcherMac : public clang::DirectoryWatcher { public: DirectoryWatcherMac( diff --git a/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp b/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp index a6b48e56236..c26ba57354f 100644 --- a/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp +++ b/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp @@ -377,7 +377,7 @@ TEST(DirectoryWatcherTest, DeleteFile) { VerifyingConsumer TestConsumer{ {{EventKind::Modified, "a"}}, {{EventKind::Removed, "a"}}, - {{EventKind::Modified, "a"}}}; + {{EventKind::Modified, "a"}, {EventKind::Removed, "a"}}}; auto DW = DirectoryWatcher::create( fixture.TestWatchedDir, |