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

Conversation

@stuartmorgan-g
Copy link
Contributor

Creates a repo-tool-based replacement for the "local_test.sh" script in
flutter/packages. While ideally we don't want packages running bespoke
tests (for maintenance reasons), in practice we do have a number of such
tests and the script that runs them is strictly worse than the core of
the repo tooling. This will allow us to eliminate "local_test.sh", and
get all the benefits of the tooling (better changed package detection,
run summaries, etc.) when running those custom tests, as well as giving
test coverage for the command itself (unlike the shell script).

Part of flutter/flutter#85543

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. (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, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

Creates a repo-tool-based replacement for the "local_test.sh" script in
flutter/packages. While ideally we don't want packages running bespoke
tests (for maintenance reasons), in practice we do have a number of such
tests and the script that runs them is strictly worse than the core of
the repo tooling. This will allow us to eliminate "local_test.sh", and
get all the benefits of the tooling (better changed package detection,
run summaries, etc.) when running those custom tests.

Part of flutter/flutter#85543
@override
Future<PackageResult> runForPackage(RepositoryPackage package) async {
final File script =
package.directory.childDirectory('tool').childFile(_scriptName);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pigeon has this in bin; I'll move it when I switch flutter/packages to this new command. Dart package layout docs say that bin is for package-client-facing commands, and scripts intended for package developers (the call out test scripts as an explicit example) belong in tool.

}

// Run the legacy script if present.
if (legacyScript.existsSync()) {
Copy link
Member

Choose a reason for hiding this comment

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

This will make it so we run the dart script and the sh script. That will cause certain tests to get executed twice since the shell script delegates to the dart script. We should execute one or the other.

We could juggle things around in Pigeon so that the correct way is to execute the dart script and it will delegate to a shell script test that haven't been migrated (if it isn't windows). We could even make run_tests.sh just execute the dart script and there is another bash script the dart script delegates to for unmigrated tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will make it so we run the dart script and the sh script.

That's already how it works. It had to work that way in order to support pigeon's tests, which were partially implemented in one and partially implemented in the other.

That will cause certain tests to get executed twice since the shell script delegates to the dart script.

This code was supposed to prevent that. If Pigeon's test structure changed after that in a way that causes it to double-run tests, that's a Pigeon test bug.

We could juggle things around in Pigeon so that the correct way is to execute the dart script and it will delegate to a shell script test that haven't been migrated (if it isn't windows).

I don't have any opinion on how Pigeon manages the Dart vs shell split in the interim period until all tests are migrated, but it's orthogonal to this PR since the behavior isn't changing.

Copy link
Member

@gaaclarke gaaclarke Mar 17, 2022

Choose a reason for hiding this comment

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

That's already how it works.

Fair enough.

that's a Pigeon test bug.

I'm just trying to think what the fix is though given this logic and making sure we have a path forward. The easiest thing for pigeon would be to rename the script 'run_tests.sh' to 'shell_tests.sh' and make run_tests.dart execute shell_tests.sh. If pigeon isn't using run_tests.sh then probably no one is so we can get rid of this.

Copy link
Contributor Author

@stuartmorgan-g stuartmorgan-g Mar 18, 2022

Choose a reason for hiding this comment

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

I'm just trying to think what the fix is though given this logic and making sure we have a path forward.

I'm not clear on what the problem actually is. What is the flow where the code I linked to fails to avoid duplicate tests?

If pigeon isn't using run_tests.sh then probably no one is so we can get rid of this.

Four packages currently use run_test.sh. See the linked issue for details.

}

// Run the legacy script if present.
if (legacyScript.existsSync()) {
Copy link
Member

@gaaclarke gaaclarke Mar 17, 2022

Choose a reason for hiding this comment

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

That's already how it works.

Fair enough.

that's a Pigeon test bug.

I'm just trying to think what the fix is though given this logic and making sure we have a path forward. The easiest thing for pigeon would be to rename the script 'run_tests.sh' to 'shell_tests.sh' and make run_tests.dart execute shell_tests.sh. If pigeon isn't using run_tests.sh then probably no one is so we can get rid of this.

@stuartmorgan-g stuartmorgan-g added the waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land. label Mar 18, 2022
@fluttergithubbot
Copy link

This pull request is not suitable for automatic merging in its current state.

  • The status or check suite ios-platform_tests has failed. Please fix the issues identified (or deflake) before re-applying this label.

@fluttergithubbot fluttergithubbot removed the waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land. label Mar 18, 2022
@stuartmorgan-g stuartmorgan-g added the waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land. label Mar 18, 2022
@fluttergithubbot fluttergithubbot merged commit fef72e0 into flutter:main Mar 18, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 18, 2022
@stuartmorgan-g stuartmorgan-g deleted the tool-custom-test branch April 19, 2022 17:37
mauricioluz pushed a commit to mauricioluz/plugins that referenced this pull request Jan 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants