Skip to content

Conversation

maxwellE
Copy link
Contributor

This works as follows

add a rule like follows

load(
    "@build_bazel_rules_apple//apple/testing/simulator_pool:create_simulator_pool.bzl",
    "create_simulator_pool"
)
load(
    "@build_bazel_rules_apple//apple/testing/default_runner:ios_xctestrun_runner.bzl",
    "ios_xctestrun_runner"
)

ios_xctestrun_runner(
    name = "ios_x86_64_sim_runner",
    device_type = "iPhone Xs",
)

create_simulator_pool(
    name = "create_simulator_pool",
    device_type = "iPhone Xs",
    pool_size = 3,
    os_version = "18.3",
    server_port = 50051,
)

ios_xctestrun_runner(
    name = "simulator_pool_test_runner",
    device_type = "iPhone Xs",
    simulator_pool_server_port = 50051,
)

You will need to make sure you consume :simulator_pool_test_runner in your ios_unit_test rule

You also need to create the pool and its server by running the following before you run any tests

bazel run //:create_simulator_pool

This will automatically daemonize the server. Once you are done with the pool you need to run

curl -X GET http://localhost:50051/shutdown to shut the server down.

The server shutdown does not delete any simulators. On startup the server automatically deletes old cloned simulators and makes new clones off of the originally booted golden simulator. A golden simulator is one which is never deleted, it is only booted and shutdown to be used for testing or cloning to other simulators.

This works as follows

add a rule like follows

```python
load(
    "@build_bazel_rules_apple//apple/testing/simulator_pool:create_simulator_pool.bzl",
    "create_simulator_pool"
)
load(
    "@build_bazel_rules_apple//apple/testing/default_runner:ios_xctestrun_runner.bzl",
    "ios_xctestrun_runner"
)

ios_xctestrun_runner(
    name = "ios_x86_64_sim_runner",
    device_type = "iPhone Xs",
)

create_simulator_pool(
    name = "create_simulator_pool",
    device_type = "iPhone Xs",
    pool_size = 3,
    os_version = "18.3",
    server_port = 50051,
)

ios_xctestrun_runner(
    name = "simulator_pool_test_runner",
    device_type = "iPhone Xs",
    simulator_pool_server_port = 50051,
)
```

You will need to make sure you consume `:simulator_pool_test_runner` in your `ios_unit_test` rule

You also need to create the pool and its server by running the following *before* you run any tests

`bazel run //:create_simulator_pool`

This will automatically daemonize the server. Once you are done with the pool you need to run

`curl -X GET http://localhost:50051/shutdown` to shut the server down.

The server shutdown does not delete any simulators. On startup the server automatically deletes old cloned simulators and makes new clones off of the originally booted golden simulator. A golden simulator is one which is never deleted, it is only booted and shutdown to be used for testing or cloning to other simulators.

Signed-off-by: Maxwell Elliott <[email protected]>
Signed-off-by: Maxwell Elliott <[email protected]>
Signed-off-by: Maxwell Elliott <[email protected]>
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.

1 participant