forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not run real processes in
clang_tidy_test.dart
(flutter#45748)
Partial work towards flutter/flutter#133190. Some context, from @zanderso on chat: @matanlurey: > For [`clang_tidy_test.dart`](https://github.com/flutter/engine/blob/c020936303cb0646cd10593e6e427d8c5aa6ce52/tools/clang_tidy/test/clang_tidy_test.dart), what is your vision there? I remember we ran into problems with it actually executing `clang.run()` in too many of the test cases, but I don't remember (or seem to have written down) what we decided to do 🙂 @zanderso: > The existing tests are calling `computeFilesOfInterest` and `getLintCommandsForFiles` and inspecting the results for positive tests instead of hitting a real clang-tidy invocation. Tests of command line flags that call `clangTidy.run()` are also testing cases that short-circuit or fail before making a real invocation. Making it harder to do a real invocation from a unit test probably requires plumbing a fake-able ProcessRunner or ProcessManager object through to the ClangTidy constructor. --- All this PR does is allow providing a `ProcessManager` (defaults to `LocalProcessManager`, i.e. `dart:io`) throughout the tool. Then, for tests, I've implemented a _very_ minimal fake of both `ProcessManager` and `Process` (it would be nice to share code w/ say, `flutter_tool`, but lots of work/overhead for very little surface area). After this CL, no tests in `clang_tidy_test.dart` actually run a process. This should unblock adding new features (i.e. original intent of flutter/flutter#133190) without causing headaches for others/CI?
- Loading branch information
1 parent
3b6d0ea
commit b71b366
Showing
5 changed files
with
303 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ dependencies: | |
args: any | ||
meta: any | ||
path: any | ||
process: any | ||
process_runner: any | ||
|
||
dev_dependencies: | ||
|
Oops, something went wrong.