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

[flutter_plugin_tool] Add support for running Windows unit tests #4276

Merged
merged 6 commits into from
Aug 30, 2021

Conversation

stuartmorgan
Copy link
Contributor

Implements support for --windows in native-test, for unit tests only. The structure of the new code has most of the new functionality in a generic utility for running GoogleTest test binaries, so that it can be trivially extended to Linux support in a follow-up once the Linux test PoC has landed.

This runs the recently-added url_launcher_windows unit test. However, it's not yet run in CI since it needs LUCI bringup; that will be done one this support is in place.

Requires new logic to check if a plugin contains native code, and some new test utility plumbing to generate plugins whose pubspecs indicate that they only contain Dart code to test it, to allow filtering filtering out the FFI-based Windows plugins.

Part of flutter/flutter#82445

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Note that unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test exempt.
  • All existing and new tests are passing.

Implements support for `--windows` in `native-test`, for unit tests
only.

This runs the recently-added `url_launcher_windows` unit test. However,
it's not yet run in CI since it needs LUCI bringup (new recipe, new
builder, etc.), which will be done one this support is in place.

Part of flutter/flutter#82445
@stuartmorgan stuartmorgan requested a review from cbracken August 26, 2021 19:55
@google-cla google-cla bot added the cla: yes label Aug 26, 2021
Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

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

lgtm


final File testBinary = pluginDirectory
.childDirectory('example')
.childFile(testBinaryRelativePath.split('/').join(r'\'));
Copy link
Member

Choose a reason for hiding this comment

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

Here and below: Does createFakePlugin not handle Windows paths with backslashes? It's only one more character with a raw string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It explicitly takes Posix-style paths, so that test authors don't have to think about whether they are writing a Windows or non-Windows test when specifying extra files. This is an annoying side effect of that though, so maybe I should reconsider that. I'll take a look on Monday.

(I really wish there were a version of childFile that took an array; I may just write that as a helper instead, as I've wanted it before. The fact that childFile accepts something that's not actually a basename is a bit sketchy.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added that helper, and cleaned up this and a couple of places where I had been working around not having it by doing split/join dances.

@stuartmorgan stuartmorgan merged commit 5306c02 into flutter:master Aug 30, 2021
@stuartmorgan stuartmorgan deleted the tool-windows-unit branch August 30, 2021 18:52
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 30, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 30, 2021
NickalasB added a commit to NickalasB/plugins that referenced this pull request Sep 7, 2021
* master: (490 commits)
  Allow neutral conclusion in publishing check (flutter#4321)
  Revert "[image_picker] add forceFullMetadata to interface" (flutter#4314)
  [image_picker] add forceFullMetadata to interface (flutter#4288)
  [flutter_plugin_tools] Adjust diff logging (flutter#4312)
  Remove gradle.properties from plugins (flutter#4309)
  build-examples .pluginToolsConfig.yaml support (flutter#4305)
  [camera_web] Make plugin publishable for the first time. (flutter#4304)
  adds option to re-authenticate on google silent sign in (flutter#4251)
  [ci.yaml] Add builders to recipes cq (flutter#4306)
  Add scripts for Windows LUCI recipe (flutter#4303)
  [video_player] Ensure seekTo is not called before video player is initialized.  (flutter#4300)
  Ensure setExposureOffset returns new value on Android (flutter#4301)
  Add a way to opt a file out of Dart formatting (flutter#4292)
  [flutter_plugin_tools] Add Linux support to native-test (flutter#4294)
  [image_picker]Android update cache (flutter#4124)
  [flutter_plugin_tools] Fix build-examples for packages (flutter#4248)
  [flutter_plugin_tool] Migrate 'publish' to new base command (flutter#4290)
  [flutter_plugin_tool] Move branch-switching logic from tool_runner.sh to tool (flutter#4268)
  [flutter_plugin_tool] Add support for running Windows unit tests (flutter#4276)
  [camera_web] Do not flip the video on the back camera (flutter#4281)
  ...

# Conflicts:
#	packages/webview_flutter/webview_flutter/CHANGELOG.md
#	packages/webview_flutter/webview_flutter/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterWebView.java
#	packages/webview_flutter/webview_flutter/pubspec.yaml
fotiDim pushed a commit to fotiDim/plugins that referenced this pull request Sep 13, 2021
…tter#4276)

Implements support for `--windows` in `native-test`, for unit tests only. The structure of the new code has most of the new functionality in a generic utility for running GoogleTest test binaries, so that it can be trivially extended to Linux support in a follow-up once the Linux test PoC has landed.

This runs the recently-added `url_launcher_windows` unit test. However, it's not yet run in CI since it needs LUCI bringup; that will be done one this support is in place.

Requires new logic to check if a plugin contains native code, and some new test utility plumbing to generate plugins whose pubspecs indicate that they only contain Dart code to test it, to allow filtering filtering out the FFI-based Windows plugins.

Part of flutter/flutter#82445
amantoux pushed a commit to amantoux/plugins that referenced this pull request Sep 27, 2021
…tter#4276)

Implements support for `--windows` in `native-test`, for unit tests only. The structure of the new code has most of the new functionality in a generic utility for running GoogleTest test binaries, so that it can be trivially extended to Linux support in a follow-up once the Linux test PoC has landed.

This runs the recently-added `url_launcher_windows` unit test. However, it's not yet run in CI since it needs LUCI bringup; that will be done one this support is in place.

Requires new logic to check if a plugin contains native code, and some new test utility plumbing to generate plugins whose pubspecs indicate that they only contain Dart code to test it, to allow filtering filtering out the FFI-based Windows plugins.

Part of flutter/flutter#82445
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants