Thanks to visit codestin.com
Credit goes to github.com

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

wip: [macOS] Wrap FlutterTextInputPlugin tests in autorelase pool #47516

Closed
wants to merge 1 commit into from

Conversation

cbracken
Copy link
Member

@cbracken cbracken commented Oct 31, 2023

Wraps all FlutterTextInputPlugin tests in an autorelease pool to ensure resources are cleaned up between tests.

Prior to this change, running these tests via:

../out/host_debug_unopt_arm64/flutter_desktop_darwin_unittests \
    --gtest_repeat=1000 \
--gtest_filter='FlutterTextInputPluginTest.TestFirstRectForCharacterRange'

Resuling in a test failure:

[ RUN      ] FlutterTextInputPluginTest.TestFirstRectForCharacterRange
2023-10-31 10:30:48.497112-0700 flutter_desktop_darwin_unittests[5304:4897209] Could not create Metal command queue.
2023-10-31 10:30:48.497761-0700 flutter_desktop_darwin_unittests[5304:4897209] Unable to create FlutterView; no MTLDevice or MTLCommandQueue available.
2023-10-31 10:30:48.520949-0700 flutter_desktop_darwin_unittests[5304:4897209] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Did not record an invocation in OCMStub/OCMExpect/OCMReject.
Possible causes are:
- The receiver is not a mock object.
- The selector conflicts with a selector implemented by OCMStubRecorder/OCMExpectationRecorder.'
*** First throw call stack:
(
        0   CoreFoundation                      0x000000018b1f6800 __exceptionPreprocess + 176
        1   libobjc.A.dylib                     0x000000018acedeb4 objc_exception_throw + 60
        2   CoreFoundation                      0x000000018b1f66f0 +[NSException exceptionWithName:reason:userInfo:] + 0
        3   flutter_desktop_darwin_unittests    0x00000001039318a0 +[OCMMacroState endStubMacro] + 272
        4   flutter_desktop_darwin_unittests    0x0000000100138858 -[FlutterInputPluginTestObjc testFirstRectForCharacterRange] + 1316
        5   flutter_desktop_darwin_unittests    0x0000000100152e04 _ZN7flutter7testing62FlutterTextInputPluginTest_TestFirstRectForCharacterRange_Test8TestBodyEv + 60
        6   flutter_d
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Did not record an invocation in OCMStub/OCMExpect/OCMReject.
Possible causes are:
- The receiver is not a mock object.
- The selector conflicts with a selector implemented by OCMStubRecorder/OCMExpectationRecorder.'
*** First throw call stack:
(
        0   CoreFoundation                      0x000000018b1f6800 __exceptionPreprocess + 176
        1   libobjc.A.dylib                     0x000000018acedeb4 objc_exception_throw + 60
        2   CoreFoundation                      0x000000018b1f66f0 +[NSException exceptionWithName:reason:userInfo:] + 0
        3   flutter_desktop_darwin_unittests    0x00000001039318a0 +[OCMMacroState endStubMacro] + 272
        4   flutter_desktop_darwin_unittests    0x0000000100138858 -[FlutterInputPluginTestObjc testFirstRectForCharacterRange] + 1316

Issue: flutter/flutter#104789
Issue: flutter/flutter#127441
Issue: flutter/flutter#124840

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 Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Wraps all FlutterTextInputPlugin tests in an autorelease pool to ensure
resources are cleaned up between tests.

Prior to this change, running these tests via:

    ../out/host_debug_unopt_arm64/flutter_desktop_darwin_unittests \
        --gtest_repeat=1000 \
	--gtest_filter='FlutterTextInputPluginTest.TestFirstRectForCharacterRange'

Resuling in a test failure:

```
[ RUN      ] FlutterTextInputPluginTest.TestFirstRectForCharacterRange
2023-10-31 10:30:48.497112-0700 flutter_desktop_darwin_unittests[5304:4897209] Could not create Metal command queue.
2023-10-31 10:30:48.497761-0700 flutter_desktop_darwin_unittests[5304:4897209] Unable to create FlutterView; no MTLDevice or MTLCommandQueue available.
2023-10-31 10:30:48.520949-0700 flutter_desktop_darwin_unittests[5304:4897209] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Did not record an invocation in OCMStub/OCMExpect/OCMReject.
Possible causes are:
- The receiver is not a mock object.
- The selector conflicts with a selector implemented by OCMStubRecorder/OCMExpectationRecorder.'
*** First throw call stack:
(
        0   CoreFoundation                      0x000000018b1f6800 __exceptionPreprocess + 176
        1   libobjc.A.dylib                     0x000000018acedeb4 objc_exception_throw + 60
        2   CoreFoundation                      0x000000018b1f66f0 +[NSException exceptionWithName:reason:userInfo:] + 0
        3   flutter_desktop_darwin_unittests    0x00000001039318a0 +[OCMMacroState endStubMacro] + 272
        4   flutter_desktop_darwin_unittests    0x0000000100138858 -[FlutterInputPluginTestObjc testFirstRectForCharacterRange] + 1316
        5   flutter_desktop_darwin_unittests    0x0000000100152e04 _ZN7flutter7testing62FlutterTextInputPluginTest_TestFirstRectForCharacterRange_Test8TestBodyEv + 60
        6   flutter_d
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Did not record an invocation in OCMStub/OCMExpect/OCMReject.
Possible causes are:
- The receiver is not a mock object.
- The selector conflicts with a selector implemented by OCMStubRecorder/OCMExpectationRecorder.'
*** First throw call stack:
(
        0   CoreFoundation                      0x000000018b1f6800 __exceptionPreprocess + 176
        1   libobjc.A.dylib                     0x000000018acedeb4 objc_exception_throw + 60
        2   CoreFoundation                      0x000000018b1f66f0 +[NSException exceptionWithName:reason:userInfo:] + 0
        3   flutter_desktop_darwin_unittests    0x00000001039318a0 +[OCMMacroState endStubMacro] + 272
        4   flutter_desktop_darwin_unittests    0x0000000100138858 -[FlutterInputPluginTestObjc testFirstRectForCharacterRange] + 1316
```

Issue: flutter/flutter#104789
Issue: flutter/flutter#127441
Issue: flutter/flutter#124840
@cbracken cbracken changed the title [macOS] Wrap FlutterTextInputPlugin tests in autorelase pool wip: [macOS] Wrap FlutterTextInputPlugin tests in autorelase pool Oct 31, 2023
@cbracken
Copy link
Member Author

Marking as WIP. Turns out that cleaning up memory here breaks another test. Will fix then update the patch.

Copy link
Contributor

@gspencergoog gspencergoog left a comment

Choose a reason for hiding this comment

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

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

@zanderso zanderso added the Work in progress (WIP) Not ready (yet) for review! label Nov 2, 2023
@flutter-dashboard
Copy link

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

@cbracken
Copy link
Member Author

I'm going to drop this patch for the time being; I will get back to this and it still needs to be done, but there's a bit more complexity to this one than there initially seemed to be. (Specifically we're relying the test being leaky at the moment 😞)

@cbracken cbracken closed this Nov 22, 2023
@cbracken cbracken deleted the autorelease-text-input branch November 28, 2024 16:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants