Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B buck
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 201
    • Issues 201
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • buck
  • Issues
  • #2477
Closed
Open
Issue created Jun 12, 2020 by Administrator@rootContributor

Running (test) binaries on iPhone Simulator

Created by: danzimm

Hey folks,

I'm working with buck on iOS. I had an idea that might be useful to you guys, before I dive in let me give some context...

Testing xplat code on iPhone Simulator: Today

Right now its common for users to set cxx.default_platform=iphonesimulator-x86_64 in their buckconfig so that when building/testing they default to using an iOS simulator. Let's focus on testing for a moment: this forces users to use apple_test declarations in their buck files to declare tests. This becomes an issue when dealing with cross platform code, as often times their tests are declared as cxx_test (and use e.g. gtest). Now users can define two test targets, one apple_test, one cxx_test and invent a shim to create an XCTest out of their native test, but this isn't super ideal.

Enter: xcrun simctl spawn

I stumbled upon this subcommand today which allows me to run binaries built for the simulator on the simulator without an app bundle. I've verified that I'm able to run the following commands successfully and observe the test's output and exit code reflect passing and failing tests:

> buck build //:gtest_target#iphonesimulator-x86_64
> xcrun simctl boot 'iPhone 11'
> xcrun simctl spawn 'iPhone 11' buck-out/gen/gtest_target

Idea

Now, this isn't necessarily a feature request as I'm not sure I need it, but I figure it might be a good idea for you folks moving forward: what if the iphonesimulator flavor changes how binaries are ran internally so that doing buck run or buck test automatically invokes binaries with xcrun simctl spawn instead of executing them directly? This could help cleanup the situation I mentioned above and more generally ease some xplat devx issues.

cc @mzlee

Assignee
Assign to
Time tracking