calabash / calabash-ios-server

An embedded HTTP server for performing queries and test automation
Other
87 stars 82 forks source link

Static initializer can skip loading the embedded LPServer #410

Closed jmoody closed 6 years ago

jmoody commented 6 years ago

Motivation

If the app is launched with environment:

XTC_SKIP_LPSERVER_TOKEN => < identifier of embedded LPServer >

then the static initializer will not start the embedded LPServer.

Further, if the .app bundle includes a libCalabashFAT.dylib and is launched with the follow environment:

"DYLD_INSERT_LIBRARIES" => /path/to/installed/My.app/libCalabashFAT.dylib

the static initializer will start the bundled LPServer.

This will allow us to "inject" an LPServer into an app that is already linked with an LPServer and eventually allow us to automatically "inject" an LPServer into an app with having to change the Xcode build settings (no more Linker flags).

Completes:

Progress on:

Test

Automated test for Simulators

@dylib_inject @simulator @not_xtc
Feature: Start LPServer from embedded dylib
Skips starting the LPServer embedded in the application binary
in favor of starting the LPServer (dylib) embedded in the
application .app bundle.

  Scenario: Server embedded in the binary is launched      # features/dylib_injection.feature:11
    Given the app has launched                             # features/steps/shared.rb:29
    Then the server identifier is from the embedded binary # features/steps/dylib_injection.rb:2

  @skip_embedded_server
  Scenario: Server in the .app bundle is launched         # features/dylib_injection.feature:16
    Given the app has launched                            # features/steps/shared.rb:29
    Then the server identifier is from the embedded dylib # features/steps/dylib_injection.rb:21

2 scenarios (2 passed)
4 steps (4 passed)
0m28.419s