Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@matanlurey
Copy link
Contributor

Partial work towards flutter/flutter#133190.

Some context, from @zanderso on chat:

@matanlurey:

For 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?

@matanlurey matanlurey requested a review from zanderso September 13, 2023 00:06
@matanlurey matanlurey self-assigned this Sep 13, 2023
@matanlurey matanlurey changed the title Engine clang tidy process override Do not run real processes in clang_tidy_test.dart Sep 13, 2023
Copy link
Member

@zanderso zanderso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@matanlurey matanlurey merged commit b71b366 into flutter:main Sep 13, 2023
@matanlurey matanlurey deleted the engine-clang-tidy-process-override branch September 13, 2023 16:49
@@ -0,0 +1,117 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see an implementation of something like this anywhere else in the engine repo. At some point, I'd guess that we'll want to pull this out to its own package in the engine repo to share among other packages, or upstream something like https://github.com/flutter/flutter/blob/master/packages/flutter_tools/test/src/fake_process_manager.dart to https://github.com/google/process.dart

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree with that! I'd probably say:

  1. Pull this into tools/pkg/fake_process_manager as soon as we need it somewhere else.
  2. Chat with Chris about moving flutter_tools' implementation

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 13, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Sep 13, 2023
…134676)

flutter/engine@5e671d5...b71b366

2023-09-13 matanlurey@users.noreply.github.com Do not run real processes in `clang_tidy_test.dart` (flutter/engine#45748)
2023-09-13 30870216+gaaclarke@users.noreply.github.com [Impeller] Adds test to verify wide gamut indexed png decompression fix for Skia. (flutter/engine#45399)
2023-09-13 skia-flutter-autoroll@skia.org Roll Skia from 284c333d7eb2 to 78d18d509475 (2 revisions) (flutter/engine#45769)
2023-09-13 skia-flutter-autoroll@skia.org Roll Skia from 3ff43577d04b to 284c333d7eb2 (1 revision) (flutter/engine#45768)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC bdero@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Mairramer pushed a commit to Mairramer/flutter that referenced this pull request Oct 10, 2023
…lutter#134676)

flutter/engine@5e671d5...b71b366

2023-09-13 matanlurey@users.noreply.github.com Do not run real processes in `clang_tidy_test.dart` (flutter/engine#45748)
2023-09-13 30870216+gaaclarke@users.noreply.github.com [Impeller] Adds test to verify wide gamut indexed png decompression fix for Skia. (flutter/engine#45399)
2023-09-13 skia-flutter-autoroll@skia.org Roll Skia from 284c333d7eb2 to 78d18d509475 (2 revisions) (flutter/engine#45769)
2023-09-13 skia-flutter-autoroll@skia.org Roll Skia from 3ff43577d04b to 284c333d7eb2 (1 revision) (flutter/engine#45768)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC bdero@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants