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

Embed OCMock and iOS tests into IosUnitTests app #27899

Merged
merged 1 commit into from Aug 5, 2021

Conversation

jmagman
Copy link
Member

@jmagman jmagman commented Aug 5, 2021

Currently libocmock_shared.dylib and libios_test_flutter.dylib are supposed to be embedded into IosUnitTests via a build phase bash script:

xcode_frameworks_dir="${TARGET_BUILD_DIR}/${PlugIns/IosUnitTestsTests.xctest/Frameworks/}"
mkdir -p "${xcode_frameworks_dir}"
flutter_engine_rel_path="../../../../out/${FLUTTER_ENGINE}"
cp -f "${flutter_engine_rel_path}/libios_test_flutter.dylib" "${xcode_frameworks_dir}"
cp -f "${flutter_engine_rel_path}/libocmock_shared.dylib" "${xcode_frameworks_dir}"
...

It's trying to copy these libraries to the .../Build/Products/Debug-iphonesimulator/IosUnitTests.app/PlugIns/IosUnitTestsTests.xctest/Frameworks directory. However, ${PlugIns/IosUnitTestsTests.xctest/Frameworks/} resolves to an empty string, so when it runs it's copying just to the build directory:

+ cp -f ../../../../out/ios_debug_sim_unopt/libios_test_flutter.dylib /Users/magder/Library/Developer/Xcode/DerivedData/IosUnitTests-deguovljqrrqvqcikqurolciwtuu/Build/Products/Debug-iphonesimulator/
+ cp -f ../../../../out/ios_debug_sim_unopt/libocmock_shared.dylib /Users/magder/Library/Developer/Xcode/DerivedData/IosUnitTests-deguovljqrrqvqcikqurolciwtuu/Build/Products/Debug-iphonesimulator/

Instead:

  1. Replace the script phase with a copy phase that also handles code signing.
  2. Adjust the test target's runpath search paths to find the embedded dylibs.

I found this while trying to get the unit tests running on a physical device, and noticed the dylibs weren't in the app bundle.
flutter/flutter#87699

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 Hixie said 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.

@jmagman jmagman self-assigned this Aug 5, 2021
@google-cla google-cla bot added the cla: yes label Aug 5, 2021
@jmagman jmagman requested a review from dnfield August 5, 2021 01:40
@jmagman jmagman added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Aug 5, 2021
@fluttergithubbot fluttergithubbot merged commit 4092390 into flutter:master Aug 5, 2021
@jmagman jmagman deleted the ios-unit-embed branch August 5, 2021 16:51
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 5, 2021
filmil pushed a commit to filmil/engine that referenced this pull request Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes platform-ios waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
3 participants