Skip to content

Commit 503acd6

Browse files
committed
Propagate exit code in test_objc
1 parent 9fdbf60 commit 503acd6

File tree

5 files changed

+26
-28
lines changed

5 files changed

+26
-28
lines changed

.circleci/config.yml

+1-7
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ aliases:
284284
285285
- &boot-simulator-iphone
286286
name: Boot iPhone Simulator
287-
command: xcrun simctl boot "iPhone 5s" || true
287+
command: xcrun simctl boot "iPhone XS" || true
288288

289289
- &boot-simulator-appletv
290290
name: Boot Apple TV Simulator
@@ -437,12 +437,6 @@ jobs:
437437
- run: *run-objc-ios-tests
438438
- run: *run-objc-tvos-tests
439439

440-
# TODO: Fix these failing tests.
441-
- run: *display-broken-tests-warning
442-
- run: *run-podspec-tests
443-
- run: *run-objc-ios-e2e-tests
444-
- run: *run-objc-tvos-e2e-tests
445-
446440
- store_test_results:
447441
path: ~/react-native/reports/junit
448442

scripts/.tests.env

+3-6
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,9 @@ export AVD_NAME="testAVD"
1717
export AVD_ABI=x86
1818

1919
## IOS ##
20-
export IOS_TARGET_OS="11.4"
21-
export IOS_DEVICE="iPhone 5s"
22-
23-
export SCHEME="RNTester"
24-
export SDK="iphonesimulator${IOS_TARGET_OS}"
25-
export DESTINATION="platform=iOS Simulator,OS=${IOS_TARGET_OS},name=${IOS_DEVICE}"
20+
export IOS_TARGET_OS="12.1"
21+
export IOS_DEVICE="iPhone XS"
22+
export TVOS_DEVICE="Apple TV"
2623

2724
## CI OVERRIDES ##
2825
# Values to override when running in CI

scripts/objc-test-ios.sh

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# LICENSE file in the root directory of this source tree.
66
#
77
# Script used to run iOS tests.
8-
# If not arguments are passed to the script, it will only compile
8+
# If no arguments are passed to the script, it will only compile
99
# the RNTester.
1010
# If the script is called with a single argument "test", we'll
1111
# also run the RNTester integration test (needs JS and packager):
@@ -18,10 +18,13 @@ ROOT=$(dirname "$SCRIPTS")
1818

1919
cd "$ROOT"
2020

21+
# shellcheck disable=SC1091
22+
source "scripts/.tests.env"
23+
2124
export TEST_NAME="iOS"
2225
export SCHEME="RNTester"
2326
export SDK="iphonesimulator"
24-
export DESTINATION="platform=iOS Simulator,name=iPhone XS,OS=12.1"
27+
export DESTINATION="platform=iOS Simulator,name=${IOS_DEVICE},OS=${IOS_TARGET_OS}"
2528

2629
# If there's a "test" argument, pass it to the test script.
27-
. ./scripts/objc-test.sh $1
30+
./scripts/objc-test.sh $1

scripts/objc-test-tvos.sh

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# LICENSE file in the root directory of this source tree.
66
#
77
# Script used to run tvOS tests.
8-
# If not arguments are passed to the script, it will only compile
8+
# If no arguments are passed to the script, it will only compile
99
# the RNTester.
1010
# If the script is called with a single argument "test", we'll
1111
# also run the RNTester integration test (needs JS and packager):
@@ -18,10 +18,13 @@ ROOT=$(dirname "$SCRIPTS")
1818

1919
cd "$ROOT"
2020

21+
# shellcheck disable=SC1091
22+
source "scripts/.tests.env"
23+
2124
export TEST_NAME="tvOS"
2225
export SCHEME="RNTester-tvOS"
2326
export SDK="appletvsimulator"
24-
export DESTINATION="platform=tvOS Simulator,name=Apple TV,OS=12.1"
27+
export DESTINATION="platform=tvOS Simulator,name=${TVOS_DEVICE},OS=${IOS_TARGET_OS}"
2528

2629
# If there's a "test" argument, pass it to the test script.
27-
. ./scripts/objc-test.sh $1
30+
./scripts/objc-test.sh $1

scripts/objc-test.sh

+10-9
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,23 @@ set -ex
1717
SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
1818
ROOT=$(dirname $SCRIPTS)
1919

20-
cd $ROOT
20+
cd "$ROOT"
2121

2222
# Create cleanup handler
2323
function cleanup {
24-
EXIT_CODE=$?
24+
EXIT=$?
2525
set +e
2626

27-
if [ $EXIT_CODE -ne 0 ];
27+
if [ $EXIT -ne 0 ];
2828
then
2929
WATCHMAN_LOGS=/usr/local/Cellar/watchman/3.1/var/run/watchman/$USER.log
30-
[ -f $WATCHMAN_LOGS ] && cat $WATCHMAN_LOGS
30+
[ -f "$WATCHMAN_LOGS" ] && cat "$WATCHMAN_LOGS"
3131
fi
3232
# kill whatever is occupying port 8081 (packager)
3333
lsof -i tcp:8081 | awk 'NR!=1 {print $2}' | xargs kill
3434
# kill whatever is occupying port 5555 (web socket server)
3535
lsof -i tcp:5555 | awk 'NR!=1 {print $2}' | xargs kill
36+
exit $EXIT
3637
}
3738
trap cleanup EXIT
3839

@@ -61,7 +62,7 @@ function waitForPackager {
6162
if [ "$1" = "test" ]; then
6263

6364
# Start the packager
64-
npm run start --max-workers=1 || echo "Can't start packager automatically" &
65+
yarn start --max-workers=1 || echo "Can't start packager automatically" &
6566
# Start the WebSocket test server
6667
open "./IntegrationTests/launchWebSocketServer.command" || echo "Can't start web socket server automatically"
6768

@@ -80,8 +81,8 @@ rm temp.bundle
8081
# Run tests
8182
xcodebuild \
8283
-project "RNTester/RNTester.xcodeproj" \
83-
-scheme $SCHEME \
84-
-sdk $SDK \
84+
-scheme "$SCHEME" \
85+
-sdk "$SDK" \
8586
-destination "$DESTINATION" \
8687
-UseModernBuildSystem=NO \
8788
build test \
@@ -92,8 +93,8 @@ else
9293
# Don't run tests. No need to pass -destination to xcodebuild.
9394
xcodebuild \
9495
-project "RNTester/RNTester.xcodeproj" \
95-
-scheme $SCHEME \
96-
-sdk $SDK \
96+
-scheme "$SCHEME" \
97+
-sdk "$SDK" \
9798
-UseModernBuildSystem=NO \
9899
build
99100

0 commit comments

Comments
 (0)