forked from OSchip/llvm-project
[DirectoryWatcher] Relax assumption to prevent test flakiness
llvm-svn: 367632
This commit is contained in:
parent
d544d1441d
commit
9debb024d4
|
@ -25,6 +25,24 @@ static void stopFSEventStream(FSEventStreamRef);
|
||||||
|
|
||||||
namespace {
|
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 {
|
class DirectoryWatcherMac : public clang::DirectoryWatcher {
|
||||||
public:
|
public:
|
||||||
DirectoryWatcherMac(
|
DirectoryWatcherMac(
|
||||||
|
|
|
@ -377,7 +377,7 @@ TEST(DirectoryWatcherTest, DeleteFile) {
|
||||||
VerifyingConsumer TestConsumer{
|
VerifyingConsumer TestConsumer{
|
||||||
{{EventKind::Modified, "a"}},
|
{{EventKind::Modified, "a"}},
|
||||||
{{EventKind::Removed, "a"}},
|
{{EventKind::Removed, "a"}},
|
||||||
{{EventKind::Modified, "a"}}};
|
{{EventKind::Modified, "a"}, {EventKind::Removed, "a"}}};
|
||||||
|
|
||||||
auto DW = DirectoryWatcher::create(
|
auto DW = DirectoryWatcher::create(
|
||||||
fixture.TestWatchedDir,
|
fixture.TestWatchedDir,
|
||||||
|
|
Loading…
Reference in New Issue