From e1f493ebd2c6a8d44673648eeefe19c382789280 Mon Sep 17 00:00:00 2001 From: Martin Konicek Date: Thu, 16 Mar 2017 15:18:20 -0700 Subject: [PATCH] Add a flag to support a simplified iOS test - just compile, don't run packager and tests Reviewed By: gfosco Differential Revision: D4690887 fbshipit-source-id: e6299c9146e1ac97a0606f538e9d10539f147a67 --- .travis.yml | 2 +- docs/Testing.md | 2 +- scripts/objc-test-ios.sh | 17 +++++++++++++++++ scripts/objc-test-tvos.sh | 5 ++--- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5f0caaabc..0cbf424aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ install: - $yarn install script: - - if [[ "$TEST_TYPE" = objc-ios ]]; then travis_retry travis_wait ./scripts/objc-test-ios.sh; fi + - if [[ "$TEST_TYPE" = objc-ios ]]; then travis_retry travis_wait ./scripts/objc-test-ios.sh test; fi - if [[ "$TEST_TYPE" = objc-tvos ]]; then travis_retry travis_wait ./scripts/objc-test-tvos.sh; fi - if [[ "$TEST_TYPE" = e2e-objc ]]; then node ./scripts/run-ci-e2e-tests.js --ios --js --retries 3; fi - if [[ ( "$TEST_TYPE" = podspecs ) && ( "$TRAVIS_PULL_REQUEST" = "false" ) ]]; then gem install cocoapods && ./scripts/process-podspecs.sh; fi diff --git a/docs/Testing.md b/docs/Testing.md index ace4db3ef..eb7121788 100644 --- a/docs/Testing.md +++ b/docs/Testing.md @@ -97,7 +97,7 @@ See the following for example usage and integration points: You can run integration tests locally with cmd+U in the IntegrationTest and UIExplorer apps in Xcode, or by running the following in the command line on macOS: $ cd react-native - $ ./scripts/objc-test-ios.sh + $ ./scripts/objc-test-ios.sh test > Your Xcode install will come with a variety of Simulators running the latest OS. You may need to manually create a new Simulator to match what the `XCODE_DESTINATION` param in the test script. diff --git a/scripts/objc-test-ios.sh b/scripts/objc-test-ios.sh index a85caa073..3f909f7a2 100755 --- a/scripts/objc-test-ios.sh +++ b/scripts/objc-test-ios.sh @@ -26,6 +26,12 @@ function cleanup { } trap cleanup INT TERM EXIT +# If first argument is "test", actually start the packager and run tests. +# Otherwise, just build UIExplorer for tvOS and exit + +if [ "$1" = "test" ]; +then + # Start the packager (exec "./packager/launchPackager.command" || echo "Can't start packager automatically") & (exec "./IntegrationTests/launchWebSocketServer.command" || echo "Can't start web socket server automatically") & @@ -60,6 +66,7 @@ rm temp.bundle curl 'http://localhost:8081/IntegrationTests/RCTRootViewIntegrationTestApp.bundle?platform=ios&dev=true' -o temp.bundle rm temp.bundle +# Build and test for iOS # TODO: We use xcodebuild because xctool would stall when collecting info about # the tests before running them. Switch back when this issue with xctool has # been resolved. @@ -70,3 +77,13 @@ xcodebuild \ -destination "platform=iOS Simulator,name=iPhone 5s,OS=10.1" \ build test +else + +# Only build for iOS (check there are no missing files in the Xcode project) +xcodebuild \ + -project "Examples/UIExplorer/UIExplorer.xcodeproj" \ + -scheme "UIExplorer" \ + -sdk "iphonesimulator" \ + build + +fi diff --git a/scripts/objc-test-tvos.sh b/scripts/objc-test-tvos.sh index 2266a5ba6..943d51091 100755 --- a/scripts/objc-test-tvos.sh +++ b/scripts/objc-test-tvos.sh @@ -23,7 +23,7 @@ function cleanup { } trap cleanup EXIT -# If first argument is "test", actually start the packager and run tests as in the iOS script +# If first argument is "test", actually start the packager and run tests. # Otherwise, just build UIExplorer for tvOS and exit if [ "$1" = "test" ]; @@ -57,12 +57,11 @@ xcodebuild \ else -# Build only (no test) for tvOS, to make sure there are no missing files +# Only build for tvOS (check there are no missing files in the Xcode project) xcodebuild \ -project "Examples/UIExplorer/UIExplorer.xcodeproj" \ -scheme "UIExplorer-tvOS" \ -sdk "appletvsimulator" \ - -destination "platform=tvOS Simulator,name=Apple TV 1080p,OS=10.1" \ build fi