-
Notifications
You must be signed in to change notification settings - Fork 6k
Introduce a GN rule that (explicitly) generates a dart test wrapper
#55475
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
| script = string.Template( | ||
| '''#!/bin/sh | ||
|
|
||
| set -e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dumb question because I get tripped up on this constantly. set -e makes sure that the exit code of this script is non zero if the dart test exit code is non zero right? Can you check that failed tests report non-zero exit codes through the shell script too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any command or pipeline that has an error will exit the script automatically. Dart tests that fail set errno 1.
| parser.add_argument('--output', required=True, help='Output file') | ||
| parser.add_argument('--command', required=True, help='Command to run') | ||
| parser.add_argument('--cwd', required=False, help='Working directory') | ||
| parser.add_argument('rest', nargs='*', help='Arguments to pass to the command') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I <3 rest vs args +1
|
Does |
Yes, I believe it does. My thought that given how workspaces work, it shouldn't matter though? (Side-note, if it does matter, we should make sure to change |
Right, it shouldn't matter, but if we really wanted to skip it there might be a flag for that... cc @bkonyi . |
I don't think there's a flag to disable the automatic |
As in the precompilation of the test package itself? If pub still has a |
Yes, precompilation of the test package. |
It looks like that calls ensureUpToDate - which only does a |
Do we want to be running |
The engine (at least for the most part) uses pub workspaces, with overrides for the third party deps (pulled in via a DEPS file IIRC). https://github.com/flutter/engine/blob/main/pubspec.yaml. This means I would love the Dart SDK to also do it this way :). |
jtmcdole
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| unset CDPATH | ||
|
|
||
| # Store the current working directory. | ||
| prev_cwd=$$(pwd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could save yourself a variable with pushd "$CD_PATH" > /dev/null and popd > /dev/null in the exit signal handler. Also wouldn't need to worry about CDPATH above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, that's much simpler!
Added a PWD "test" as well.
cbracken
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
I think @zanderso wanted a chance to weigh in here, and is OOO, so I'll check back with Monday before merging. |
|
Sorry, a couple more questions. Is there any way to make the implied Does |
No, there is not. We could definitely request one if we end up thinking its important. But, on the importance, I'm struggling a bit to understand what we're trying to avoid:
It does place files in But I'm guessing since it's in |
If someone does a
CI does filesystem level caching, so even files that are Also a couple of questions for @bkonyi:
|
That's a surprising tidbit - is it documented somewhere? I would have imagined block level caching. |
The Dart CLI has a top-level
@derekxu16 will know more about this since he's been the one working on it. Would we want to keep the compilation server running and shared between tests on a shard? If not, there should be a way for the compilation server to have the same lifespan as the test process. If we do want to shared the compilation server, it should be as simple as adding a step to run |
It is using the frontend server and passing a previous dill file to it to initialize from. The frontend server handles invalidating that as needed afaik (but if it doesn't do that, we have larger problems). |
The recipes use https://flutter.googlesource.com/recipes/+/refs/heads/main/recipe_modules/cache/api.py, which reads/writes files to the CAS service. |
I think we need to be more careful than just shutting it down. We need these test runs to be hermetic. So, we can't have one test using a different tests' compilation server. Is it possible to ensure that no other process connects to a compilation server? |
Compilation servers will be associated with "info files", so it will be possible to specify which compilation server an invocation of |
|
@johnmccutchan or @zanderso Do either of you have feedback specifically about this PR (i.e. should block merging)? If not, I plan to merge this shortly. |
|
@matanlurey LGTM w/ @derekxu16 @bkonyi Please keep the engine team and @johnmccutchan in the loop w.r.t. the persistent compilation daemon on CI. |
…155967) flutter/engine@e61bc85...bfb6ddd 2024-09-30 [email protected] Roll Skia from 534633fb4bd9 to d1d7deb68f9d (1 revision) (flutter/engine#55534) 2024-09-30 [email protected] Roll Dart SDK from 79863e31de87 to d9fb41a4b5ee (1 revision) (flutter/engine#55533) 2024-09-30 [email protected] Introduce a GN rule that (explicitly) generates a `dart test` wrapper (flutter/engine#55475) 2024-09-30 [email protected] Remove the need to use `runZoned` by replacing `print` statements (flutter/engine#55530) 2024-09-30 [email protected] Roll Skia from 6c89706638ee to 534633fb4bd9 (2 revisions) (flutter/engine#55531) 2024-09-30 [email protected] [Impeller] Create a libImpeller dylib and expose symbols. (flutter/engine#55526) 2024-09-30 [email protected] Added metal validation for `impeller_unittests (flutter/engine#55527) 2024-09-30 [email protected] Roll Skia from dfeeb199b226 to 6c89706638ee (2 revisions) (flutter/engine#55528) 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 [email protected],[email protected] 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://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…lutter#155967) flutter/engine@e61bc85...bfb6ddd 2024-09-30 [email protected] Roll Skia from 534633fb4bd9 to d1d7deb68f9d (1 revision) (flutter/engine#55534) 2024-09-30 [email protected] Roll Dart SDK from 79863e31de87 to d9fb41a4b5ee (1 revision) (flutter/engine#55533) 2024-09-30 [email protected] Introduce a GN rule that (explicitly) generates a `dart test` wrapper (flutter/engine#55475) 2024-09-30 [email protected] Remove the need to use `runZoned` by replacing `print` statements (flutter/engine#55530) 2024-09-30 [email protected] Roll Skia from 6c89706638ee to 534633fb4bd9 (2 revisions) (flutter/engine#55531) 2024-09-30 [email protected] [Impeller] Create a libImpeller dylib and expose symbols. (flutter/engine#55526) 2024-09-30 [email protected] Added metal validation for `impeller_unittests (flutter/engine#55527) 2024-09-30 [email protected] Roll Skia from dfeeb199b226 to 6c89706638ee (2 revisions) (flutter/engine#55528) 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 [email protected],[email protected] 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://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Follow-up to #55475 Test: `flutter/tools/gn --no-prebuilt-dart-sdk --unoptimized --runtime-mode debug && ninja -C out/host_debug_unopt`
Follow-up to flutter/engine#55475 Test: `flutter/tools/gn --no-prebuilt-dart-sdk --unoptimized --runtime-mode debug && ninja -C out/host_debug_unopt`


Closes flutter/flutter#155769.
This is a variant of the approach in #52241, based on feedback from @jakemac53 and @jonahwilliams (who originally sped up
dart testsignificantly by usingfrontend_serverunder the scenes: dart-lang/test#1399), in short:This stanza, when built (
ninja -C ../out/host_debug flutter/tools/engine_tool:tests) generates the following file:In turn, when executed (
../out/host_debug/gen/flutter/tools/engine_tool/tests) it just runsdart test:There is no actual compilation performed by the tool (that is handled implicitly by
dart test), and as a result neither adepfileis needed, nor generating a pre-compiled artifact like a snapshot or AOT elf/assembly.This work is incomplete, that is, we'd want to properly tag the executable so
etcan find it, and create a wrapper template (i.e.dart_test) that tightens things up a bit, but I wanted to show the work at this intermediate step to get feedback before moving forward./cc @jonahwilliams, @jtmcdole as well.