Skip to content

Some tests should manually select the local engine variant #72368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
zanderso opened this issue Dec 15, 2020 · 16 comments
Open

Some tests should manually select the local engine variant #72368

zanderso opened this issue Dec 15, 2020 · 16 comments
Assignees
Labels
a: tests "flutter test", flutter_test, or one of our tests c: new feature Nothing broken; request for a new capability P2 Important issues not at the top of the work list team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels. triaged-tool Triaged by Flutter Tool team

Comments

@zanderso
Copy link
Member

zanderso commented Dec 15, 2020

See the discussion here #71721 (comment)

@a-siva @mkustermann

@jonahwilliams who did some plumbing around this recently here #65802

@zanderso zanderso added a: tests "flutter test", flutter_test, or one of our tests c: new feature Nothing broken; request for a new capability tool Affects the "flutter" command-line tool. See also t: labels. labels Dec 15, 2020
@annagrin
Copy link
Contributor

annagrin commented Jan 7, 2021

Note: fixing this will enable us to fix the web HHH bot from failing every time the kernel version changes.

@annagrin annagrin self-assigned this Mar 9, 2021
@godofredoc
Copy link
Contributor

\cc @jmagman any pointers that you can give us here?

@jmagman
Copy link
Member

jmagman commented Mar 17, 2021

@yjbanov was investigating something similar in #78072.

@jmagman
Copy link
Member

jmagman commented Mar 17, 2021

Never mind, this is requesting the possibility to --local-engine=android_debug instead of host_debug, not that the local engine isn't being used at all in some tests.

@jmagman
Copy link
Member

jmagman commented Mar 18, 2021

The original impetus for this seems to be:

We are seeing issues on HHH configuration of dart-lang/sdk,
flutter/engine and flutter/flutter where the web tests are using new
frontend_server tooling (which expects current kernel version) but is
given kernel file from an older version.

That may be fixed by #78496.

However if we still need this, the integration tests could have a getLocalEngineArguments() for each desired variant like getLocalEngineAndroidArguments() that replaces the injected flag values. Something like:

List<String> getLocalEngineAndroidArguments() => 
  getLocalEngineArguments().map((String argument) => argument.replaceAll('host_', 'android_')).toList();

but something more robust.

@annagrin
Copy link
Contributor

@jmagman I was under impression that we needed to set local engine environment variables to make sure the bots run tests with the local engine, as was attempted in #71721? I think that PR was reverted. Is it no longer needed?

@jmagman
Copy link
Member

jmagman commented Mar 19, 2021

@annagrin You're right, it's not related to #78496. web_tool_tests is calling pub without the local engine flags, not flutter test.
https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8852389365860202592/+/steps/flutter_test_web_tool_tests/0/stdout

@annagrin
Copy link
Contributor

@jmagman @godofredoc I would appreciate if someone could take this over from me, as I am not familiar with the flutter test infrastructure enough to make the right call.

@annagrin annagrin removed their assignment Mar 19, 2021
@jmagman
Copy link
Member

jmagman commented Mar 19, 2021

The problem I think being described is that the tool assumes that --local-engine points to a platform/build mode variant. If you were locally developing for iOS, say, it's expecting:

--local-engine=ios_debug --local-engine-src-path=/path/to/engine/src

And if it needs to grab something from host_debug the artifacts know how to do that mapping, it can map ios_debughost_debug

// Determine the host engine directory associated with the local engine:
// Strip '_sim_' since there are no host simulator builds.
String _getHostEngineBasename(String localEngineBasename) {

But it doesn't bother with host_debugios_debug, because it assumes if you wanted iOS artifacts you would have passed in ios_debug. _getEngineArtifactsPath isn't trying to figure out /path/to/engine/src/ios_debug here, it's just trusting --local-engine is pointing to the appropriate variant:

String _getEngineArtifactsPath(TargetPlatform platform, [ BuildMode mode ]) {
final String engineDir = _cache.getArtifactDirectory('engine').path;
final String platformName = getNameForTargetPlatform(platform);

case TargetPlatform.ios:
case TargetPlatform.android_arm:
case TargetPlatform.android_arm64:
case TargetPlatform.android_x64:
case TargetPlatform.android_x86:
assert(mode != null, 'Need to specify a build mode for platform $platform.');
final String suffix = mode != BuildMode.debug ? '-${snakeCase(getModeName(mode), '-')}' : '';
return _fileSystem.path.join(engineDir, platformName + suffix);

However, the testing infrastructure always passes in --local-engine host_*.

--local-engine=host_debug --local-engine-src-path=/b/s/w/ir/cache/builder/src

So when --local-engine --local-engine-src-path was passed through to pub test in #71721, and a tool test needed an Android artifact, it failed:

The file /b/s/w/ir/cache/builder/src/out/host_debug/flutter_embedding_release.pom wasn't found in the local engine out directory.

#71721 (comment)
https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8861844867680645408/+/steps/flutter_test_web_tool_tests/0/stdout

This was easy to reproduce locally:

$ cd examples/hello_world
$ flutter --local-engine=host_debug_unopt --local-engine-src-path=/path/to/engine/src build apk --analyze-size --target-platform=android-arm64

On top of all that, the pom/jar gradle artifact symlinking bypasses the above artifacts logic and does the path construction itself:

final String artifactVersion = _getLocalArtifactVersion(
fileSystem.path.join(
engineOutPath,
'flutter_embedding_$buildMode.pom',
),
fileSystem,
);

The most robust thing to do would be to handle --local-engine=host_ and do the mapping to target platforms engine out directories like ios_debug or whatever. The artifacts location code is already pretty hairy though, and our CI/tool subshard limitations of requiring more than one target platforms engine may not be worth potential regressions.

The easier thing to do would be to do something cheesy like getLocalEngineAndroidArguments as described in #72368 (comment)

@dcharkes
Copy link
Contributor

Note: fixing this will enable us to fix the web HHH bot from failing every time the kernel version changes.

We had another kernel version change 4 days ago: https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8851986851676848432/+/steps/flutter_test_tool_tests/0/stdout

cc @johnniwinther

@annagrin
Copy link
Contributor

annagrin commented Mar 23, 2021

@athomas would it be possible to build other flavors of engine in dart HHH bot to make sure all tests run correctly if/when pub runs with local engine flag (will need to reland #71721 for it, and add more flags probably)? See @jmagman investigation above.

cc @sigmundch

@sigmundch
Copy link
Contributor

Some observations after looking at this more closely and discussing it with @jonahwilliams:

  1. Tests that use getLocalEngineArguments are in the integration.shard. We'll attempt to set the local-engine environment flags only for the web.shard to unblock the 3H-web bot on the Dart side.
  2. We may not need a big general change to handle the uses of getLocalEngineArguments, but a one by one manual review instead. Currently only 12 files (total of 47 unit tests) use it. Many don't need a local engine, for example, so it may be OK to remove the use of the flag in those cases (see [flutter_tools] remove getLocalEngineArtifacts from integration tests that cant use it #83282). Individual tests could be changed to ignore the local engine flag or skipped the test if the specified engine is not compatible with the test.

sigmundch added a commit to sigmundch/flutter that referenced this issue May 24, 2021
This is bassically reapplying flutter#71721, but only enables it on web tests.

There are known issues that several tests under the `integration.shard`
depend on a specific platform, and as a result they require some
additional flexiblity (bots need to build more than one engine, and the
test flags should allow for secondary engines to be picked by such
tests).

By enabling this on the web-test shard, we will reduce the false
positives in the dart-flutter-HHH-web bot.

Fixing the more general problem is tracked by flutter#72368.
jonahwilliams pushed a commit that referenced this issue May 25, 2021
…#83308)

This is bassically reapplying #71721, but only enables it on web tests.

There are known issues that several tests under the `integration.shard`
depend on a specific platform, and as a result they require some
additional flexiblity (bots need to build more than one engine, and the
test flags should allow for secondary engines to be picked by such
tests).

By enabling this on the web-test shard, we will reduce the false
positives in the dart-flutter-HHH-web bot.

Fixing the more general problem is tracked by #72368.
@flutter-triage-bot flutter-triage-bot bot added the team-tool Owned by Flutter Tool team label Jul 8, 2023
@eliasyishak eliasyishak added the P2 Important issues not at the top of the work list label Oct 16, 2023
@eliasyishak eliasyishak added the triaged-tool Triaged by Flutter Tool team label Oct 16, 2023
@matanlurey
Copy link
Contributor

@sigmundch Can you comment if this is something that needs to be done or otherwise close this issue? Thanks!

@matanlurey matanlurey added the dependency: dart Dart team may need to help us label May 23, 2025
@sigmundch
Copy link
Contributor

It's been a while, so trying to refresh my memory here. Since we landed #83308, we are no longer affected in the web HHH boots (item 1 in my previous comment), so that part is complete.

I am not aware that any work was done to address item 2. However, I'm not aware of anything being blocked by it either. As such, maybe the remaining work here could be categorized as tech debt/test hygiene and prioritized accordingly?

@matanlurey matanlurey assigned matanlurey and unassigned sigmundch May 23, 2025
@matanlurey matanlurey removed the dependency: dart Dart team may need to help us label May 23, 2025
@matanlurey
Copy link
Contributor

Got it, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: tests "flutter test", flutter_test, or one of our tests c: new feature Nothing broken; request for a new capability P2 Important issues not at the top of the work list team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels. triaged-tool Triaged by Flutter Tool team
Projects
None yet
Development

No branches or pull requests

10 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy