Skip to content
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

[flutter_local_notifications_windows] use flutter test instead of dart test #2459

Closed
wants to merge 5 commits into from

Conversation

MaikuB
Copy link
Owner

@MaikuB MaikuB commented Nov 13, 2024

Switched to flutter test to see if it helps improves output shown in the logs

@Levi-Lesches
Copy link
Contributor

Weird:

flutter_local_notifications_windows:
Resolving dependencies...
Downloading packages...
  _fe_analyzer_shared 73.0.0 (76.0.0 available)
  analyzer 6.8.0 (6.11.0 available)
  ffigen 13.0.0 (15.0.0 available)
! flutter_local_notifications_platform_interface 8.1.0 from path ..\flutter_local_notifications_platform_interface (overridden in .\pubspec_overrides.yaml)
  macros 0.1.2-main.4 (0.1.3-main.0 available)
  matcher 0.12.16+1 (0.12.[17](https://github.com/MaikuB/flutter_local_notifications/actions/runs/11814739691/job/32914415296?pr=2459#step:6:18) available)
  timezone 0.9.4 (0.10.0 available)
Got dependencies!
6 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.

✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/details_test.dart: Details: No details
✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/bindings_test.dart: Bindings work in simple cases
✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/bindings_test.dart: Bindings fail when ID is not found in simple cases
✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/bindings_test.dart: Bindings are included in show()
✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/details_test.dart: Details: Simple details
✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/details_test.dart: Details: Actions
✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/details_test.dart: Details: Audio
✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/bindings_test.dart: Bindings fail when notification has been cancelled
✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/plugin_test.dart: Plugin initializes safely
✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/plugin_test.dart: Plugin catches bad GUIDs
✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/plugin_test.dart: Plugin cannot be used before initializing
✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/plugin_test.dart: Plugin cannot be used after disposed
✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/plugin_test.dart: Plugin does not support repeating notifications
✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/scheduled_test.dart: Schedules work with basic times
✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/details_test.dart: Details: Rows
✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/details_test.dart: Details: Header
✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/details_test.dart: Details: Images
✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/details_test.dart: Details: Inputs
✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/details_test.dart: Details: Progress
✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/scheduled_test.dart: Schedules do not work with earlier time
✅ d:/a/flutter_local_notifications/flutter_local_notifications/flutter_local_notifications_windows/test/xml_test.dart: XML catches invalid XML

🎉 15 tests passed.
--------------------------------------------------------------------------------

$ melos exec
  └> flutter test
     └> FAILED (in 1 packages)
        └> flutter_local_notifications_windows (with exit code 1)

melos run test:unit:windows
  └> melos exec -c 1 -- "flutter test"
     └> FAILED
ScriptException: The script test:unit:windows failed to execute.

@MaikuB
Copy link
Owner Author

MaikuB commented Nov 13, 2024

Yeah I noticed. Not sure what is going on there. I recall having a similar problem but don't remember the solution. I think it had to do with the folder/scope that melos was able to run in. If you have ideas then let me know

@Levi-Lesches
Copy link
Contributor

Nope, don't know what's going on here 🤷‍♂️

@MaikuB
Copy link
Owner Author

MaikuB commented Nov 13, 2024

I'm going to abandon this PR for now as I don't have time to see what's going on. Verbose logs seemingly indicate the error is thrown by the Flutter tooling. I haven't been able to reproduce this as I'm having trouble as I'm trouble running the tests locally now. I did take the old DLL you had and used it on my local machine but that worked. Potentially this is to do with having Windows ARM when I run build.bat on my machine. The number of tests being run also looks off when run via GitHub as it should be 21 tests

@MaikuB MaikuB closed this Nov 13, 2024
@Levi-Lesches
Copy link
Contributor

Yeah, I had a lot of issues as well. The tests are inherently flaky due to flutter insisting on multithreading them, whereas the underlying Windows API is inherently not thread-safe. I attempt to explain / debug a bit in bin/crash.dart and solve it with enableMultithreading(), but that didn't fix it 100%. When I had the issues, the test harness would segfault midway through the tests at random lines (even lines that just declare and don't even assign a variable). It's also why the tests all have a few retry attempts, it's to let a few tests fail, and then after the rest have finished, they get their own time to re-run.

Here's something more concrete though -- when I run these locally:

dart test --reporter compact  # rewrites a single line to show progress, works 21/21
dart test --reporter expanded  # each test on its own line, suddenly exits after 12 
dart test --reporter github  # the GitHub Actions text, suddenly exits after 12

These results aren't stable, and sometimes they do all work, but it's interesting that I was able to briefly recreate this problem locally. I'd say it's not worth fixing, and to let the exit code determine whether GitHub goes green or not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants