Travis CI reliability fixes: preload package manager and increase tim…

Summary:
- Consolidate common code in iOS and tvOS test scripts
- Start the packager before starting tests, to improve reliability
- Increase timeout value in RCTTestRunner.m
Closes https://github.com/facebook/react-native/pull/10378

Differential Revision: D4028364

Pulled By: bestander

fbshipit-source-id: 24c2124a1c62643a02f0668b60a67b971e08d1a3
This commit is contained in:
dlowder-salesforce
2016-10-16 15:37:45 -07:00
committed by Facebook Github Bot
parent f8b0728d9b
commit 64a4c6070d
13 changed files with 187 additions and 56 deletions

16
scripts/objc-test-ios.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
set -ex
SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
ROOT=$(dirname $SCRIPTS)
cd $ROOT
XCODE_PROJECT="Examples/UIExplorer/UIExplorer.xcodeproj"
XCODE_SCHEME="UIExplorer"
XCODE_SDK="iphonesimulator"
if [ -z "$XCODE_DESTINATION" ]; then
XCODE_DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=10.0"
fi
. ./scripts/objc-test.sh

View File

@@ -7,20 +7,6 @@ ROOT=$(dirname $SCRIPTS)
cd $ROOT
function cleanup {
EXIT_CODE=$?
set +e
if [ $EXIT_CODE -ne 0 ];
then
WATCHMAN_LOGS=/usr/local/Cellar/watchman/3.1/var/run/watchman/$USER.log
[ -f $WATCHMAN_LOGS ] && cat $WATCHMAN_LOGS
fi
# kill whatever is occupying port 8081
lsof -i tcp:8081 | awk 'NR!=1 {print $2}' | xargs kill
}
trap cleanup EXIT
XCODE_PROJECT="Examples/UIExplorer/UIExplorer.xcodeproj"
XCODE_SCHEME="UIExplorer-tvOS"
XCODE_SDK="appletvsimulator"
@@ -28,27 +14,4 @@ if [ -z "$XCODE_DESTINATION" ]; then
XCODE_DESTINATION="platform=tvOS Simulator,name=Apple TV 1080p,OS=9.2"
fi
# Support for environments without xcpretty installed
set +e
OUTPUT_TOOL=$(which xcpretty)
set -e
# 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.
if [ -z "$OUTPUT_TOOL" ]; then
xcodebuild \
-project $XCODE_PROJECT \
-scheme $XCODE_SCHEME \
-sdk $XCODE_SDK \
-destination "$XCODE_DESTINATION" \
test
else
xcodebuild \
-project $XCODE_PROJECT \
-scheme $XCODE_SCHEME \
-sdk $XCODE_SDK \
-destination "$XCODE_DESTINATION" \
test | $OUTPUT_TOOL && exit ${PIPESTATUS[0]}
fi
. ./scripts/objc-test.sh

View File

@@ -1,11 +1,18 @@
#!/bin/bash
set -ex
# This script contains common code to be run from scripts/objc-test-ios.sh or scripts/objc-test-tvos.sh
SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
ROOT=$(dirname $SCRIPTS)
cd $ROOT
# Start the packager and preload the UIExplorerApp bundle for better performance in integration tests
open "./packager/launchPackager.command" || echo "Can't start packager automatically"
sleep 20
curl 'http://localhost:8081/Examples/UIExplorer/js/UIExplorerApp.ios.bundle?platform=ios&dev=true' -o temp.bundle
rm temp.bundle
curl 'http://localhost:8081/Examples/UIExplorer/js/UIExplorerApp.ios.bundle?platform=ios&dev=true&minify=false' -o temp.bundle
rm temp.bundle
curl 'http://localhost:8081/IntegrationTests/IntegrationTestsApp.bundle?platform=ios&dev=true' -o temp.bundle
rm temp.bundle
curl 'http://localhost:8081/IntegrationTests/RCTRootViewIntegrationTestApp.bundle?platform=ios&dev=true' -o temp.bundle
rm temp.bundle
function cleanup {
EXIT_CODE=$?
@@ -21,13 +28,6 @@ function cleanup {
}
trap cleanup EXIT
XCODE_PROJECT="Examples/UIExplorer/UIExplorer.xcodeproj"
XCODE_SCHEME="UIExplorer"
XCODE_SDK="iphonesimulator"
if [ -z "$XCODE_DESTINATION" ]; then
XCODE_DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=10.0"
fi
# Support for environments without xcpretty installed
set +e
OUTPUT_TOOL=$(which xcpretty)