summaryrefslogtreecommitdiffstats
path: root/clang/unittests/DirectoryWatcher
Commit message (Collapse)AuthorAgeFilesLines
* Use ASSERT_THAT_ERROR instead of logAllUnhandledErrors/exitDmitri Gribenko2019-08-092-43/+10
| | | | | | | | | | | | | | Summary: ASSERT_THAT_ERROR looks like the intended helper for use in tests. Reviewers: plotfi, jkorous, compnerd Subscribers: mgorny, dexonsmith, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65853 llvm-svn: 368399
* Remove LLVM mutexes from clang in favor of std::mutexBenjamin Kramer2019-08-071-1/+0
| | | | | | | None of those need to be recursive mutexes. No functionality change intended. llvm-svn: 368173
* [clang][DirectoryWatcher][NFC] Swapping asserts for llvm fatal_error in createPuyan Lotfi2019-08-061-57/+99
| | | | | | | | | | | | | | I also have replaced all the instances of "auto DW = DirectoryWatcher::create" with llvm::Expected<std::unique_ptr<DirectoryWatcher>> DW = DirectoryWatcher::create to make it more clear that DirectoryWatcher::create is returning an Expected. I've also allowed for logAllUnhandledErrors to consume errors in the case were DirectoryWatcher::create produces them. Differential Revision: https://reviews.llvm.org/D65829 llvm-svn: 368108
* [clang][DirectoryWatcher] Adding llvm::Expected error handling to create.Puyan Lotfi2019-08-061-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this patch Unix style errno error reporting from the inotify layer was used by DirectoryWatcher::create to simply return a nullptr on error. This would generally be ok, except that in LLVM we have much more robust error reporting through the facilities of llvm::Expected. The other critical thing I stumbled across was that the unit tests for DirectoryWatcher were not failing abruptly when inotify_init() was reporting an error, but would continue with the testing and eventually hit a deadlock in a pathological machine state (ie in the unit test, the return nullptr on ::create was ignored). Generally this pathological state never happens on any build bot, so it is totally understandable that it was overlooked, but on a Linux desktop running a dubious desktop environment (which I will not name) there is a chance that said desktop environment could use up enough inotify instances to exceed the user's limit. These are the conditions that led me to hit the deadlock I am addressing in this patch with more robust error handling. With the new llvm::Expected error handling when your system runs out of inotify instances for your user, the unit test will be forced to handle the error or crash and report the issue to the user instead of weirdly deadlocking on a condition variable wait. Differential Revision: https://reviews.llvm.org/D65704 llvm-svn: 367979
* [NFC][DirectoryWatchedTests] Unlocks mutexes before signaling condition variablePuyan Lotfi2019-08-061-2/+6
| | | | | | | | | | | | | | | | | This should not affect actual behavior, but should pessimize the threading less by avoiding the situation where: * mutex is still locked * T1 notifies on condition variable * T2 wakes to check mutex * T2 sees mutex is still locked * T2 waits * T1 unlocks mutex * T2 tries again, acquires mutex. Differential Revision: https://reviews.llvm.org/D65708 llvm-svn: 367968
* [DirectoryWatcher] Relax assumption to prevent test flakinessJan Korous2019-08-011-1/+1
| | | | llvm-svn: 367632
* [DirectoryWatcher][test] Relax test assumptionsJan Korous2019-07-151-44/+20
| | | | | | | | | Workaround for FSEvents sometimes sending notifications for events that happened before DirectoryWatcher was created. This caused tests to be flaky on green dragon. llvm-svn: 366138
* [DirectoryWatcher][NFC][test] Add typedef for enumJan Korous2019-07-151-22/+23
| | | | llvm-svn: 366137
* [DirectoryWatcher][test][NFC] Add information to test failure reportsJan Korous2019-07-131-2/+25
| | | | llvm-svn: 365976
* [DirectoryWatcher][NFC] Silence warnings in release buildJan Korous2019-07-121-3/+10
| | | | llvm-svn: 365968
* Reland [clang] DirectoryWatcherJan Korous2019-07-122-0/+443
| | | | | | | | | | This reverts commit f561227d133224d2d6a5a016abe4be051fa75501. - DirectoryWatcher - Fix the build for platforms that don't have DW implementated. - Fix the threading dependencies (thanks to compnerd). llvm-svn: 365954
* Revert "Reland [clang] DirectoryWatcher"Jan Korous2019-07-122-443/+0
| | | | | | This reverts commit fdcb7f47e783933e0af8a5fae91132269a208268. llvm-svn: 365948
* Reland [clang] DirectoryWatcherJan Korous2019-07-122-0/+443
| | | | | | | | This reverts commit abce8c457dd3de6b156756e547cc0eefb7653c79. + Fix the build for platforms that don't have DW implementated. llvm-svn: 365947
* Revert [clang] DirectoryWatcherReid Kleckner2019-07-092-439/+0
| | | | | | This reverts r365574 (git commit 31babea94a3ed38a140540f2252cf043dacec1f7) llvm-svn: 365581
* [clang] DirectoryWatcherJan Korous2019-07-092-0/+439
Asynchronously monitors specified directory for changes and passes notifications to provided callback. Dependency for index-while-building. Differential Revision: https://reviews.llvm.org/D58418 llvm-svn: 365574
OpenPOWER on IntegriCloud