Fix iOS internal test

Summary:
It got broken by https://github.com/facebook/react-native/pull/13173.
When the test scripts are run without the "test" argument, we only
want to compile the code, not run the packager and integration tests.

On Travis we pass the "test" argument so we'll still run the packager and integration tests:
https://github.com/facebook/react-native/blob/master/.travis.yml

Reviewed By: gfosco

Differential Revision: D4905912

fbshipit-source-id: e118e6e4f4a818fa06e89d417574e839c4192c1b
This commit is contained in:
Martin Konicek 2017-04-27 09:05:22 -07:00 committed by Facebook Github Bot
parent 1a72d91cb2
commit 03d57f2180
3 changed files with 43 additions and 15 deletions

View File

@ -1,6 +1,13 @@
#!/bin/bash
set -ex
# Script used to run iOS tests.
# If not arguments are passed to the script, it will only compile
# the UIExplorer.
# If the script is called with a single argument "test", we'll
# also run the UIExplorer integration test (needs JS and packager):
# ./objc-test-ios.sh test
SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
ROOT=$(dirname "$SCRIPTS")
@ -9,7 +16,6 @@ cd "$ROOT"
SCHEME="UIExplorer"
SDK="iphonesimulator"
DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=10.1"
TEST="test"
. ./scripts/objc-test.sh
# If there is a "test" argument, pass it to the test script.
. ./scripts/objc-test.sh $1

View File

@ -1,6 +1,13 @@
#!/bin/bash
set -ex
# Script used to run tvOS tests.
# If not arguments are passed to the script, it will only compile
# the UIExplorer.
# If the script is called with a single argument "test", we'll
# also run the UIExplorer integration test (needs JS and packager):
# ./objc-test-tvos.sh test
SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
ROOT=$(dirname "$SCRIPTS")
@ -9,8 +16,7 @@ cd "$ROOT"
SCHEME="UIExplorer-tvOS"
SDK="appletvsimulator"
DESTINATION="platform=tvOS Simulator,name=Apple TV 1080p,OS=10.1"
# Uncomment the line below to enable tvOS testing
#TEST="test"
. ./scripts/objc-test.sh
# If there's a "test" argument, pass it to the test script.
. ./scripts/objc-test.sh $1

View File

@ -1,6 +1,14 @@
#!/bin/bash
set -ex
# Script used to run iOS and tvOS tests.
# Environment variables are used to configure what test to run.
# If not arguments are passed to the script, it will only compile
# the UIExplorer.
# If the script is called with a single argument "test", we'll
# also run the UIExplorer integration test (needs JS and packager).
# ./objc-test.sh test
SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
ROOT=$(dirname $SCRIPTS)
@ -26,8 +34,7 @@ trap cleanup EXIT
# If first argument is "test", actually start the packager and run tests.
# Otherwise, just build UIExplorer for tvOS and exit
if [ "$TEST" = "test" ];
then
if [ "$1" = "test" ]; then
# Start the packager
open "./packager/launchPackager.command" || echo "Can't start packager automatically"
@ -45,12 +52,7 @@ rm temp.bundle
curl 'http://localhost:8081/IntegrationTests/RCTRootViewIntegrationTestApp.bundle?platform=ios&dev=true' -o temp.bundle
rm temp.bundle
else
TEST=""
fi
# Run tests
# 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.
@ -59,4 +61,18 @@ xcodebuild \
-scheme $SCHEME \
-sdk $SDK \
-destination "$DESTINATION" \
build $TEST
build test
else
# Don't run tests. No need to pass -destination to xcodebuild.
# 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.
xcodebuild \
-project "Examples/UIExplorer/UIExplorer.xcodeproj" \
-scheme $SCHEME \
-sdk $SDK \
build
fi