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

View File

@ -15,7 +15,7 @@ install:
- travis_wait npm install
script:
- if [[ "$TEST_TYPE" = objc ]]; then travis_retry travis_wait ./scripts/objc-test.sh; fi
- if [[ "$TEST_TYPE" = objc-ios ]]; then travis_retry travis_wait ./scripts/objc-test-ios.sh; 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" = js ]]; then npm run flow check; fi
@ -24,7 +24,7 @@ script:
env:
matrix:
- TEST_TYPE=e2e-objc
- TEST_TYPE=objc
- TEST_TYPE=objc-ios
- TEST_TYPE=objc-tvos
- TEST_TYPE=js

View File

@ -87,6 +87,7 @@
2D4BD8E61DA2E20D005AC8A8 /* TestBundle.js in Resources */ = {isa = PBXBuildFile; fileRef = 3DD981D51D33C6FB007DC7BE /* TestBundle.js */; };
2D4BD8E71DA2E20D005AC8A8 /* libOCMock.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14D6D7101B220EB3001FB087 /* libOCMock.a */; };
2D8C2E321DA40403000EE098 /* RCTMultipartStreamReaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 001BFCE31D838343008E587E /* RCTMultipartStreamReaderTests.m */; };
2DD0EFF41DA853B200B0C975 /* libRCTPushNotification-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD0EFF31DA853B200B0C975 /* libRCTPushNotification-tvOS.a */; };
2DD323DC1DA2DDBF000FE1B8 /* FlexibleSizeExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F441E81BEBE5030039B79C /* FlexibleSizeExampleView.m */; };
2DD323DD1DA2DDBF000FE1B8 /* UpdatePropertiesExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 272E6B3C1BEA849E001FCF37 /* UpdatePropertiesExampleView.m */; };
2DD323DE1DA2DDBF000FE1B8 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
@ -210,6 +211,13 @@
remoteGlobalIDString = 2DD3238F1DA2DD8A000FE1B8;
remoteInfo = "UIExplorer-tvOS";
};
2DD0EFF21DA853B200B0C975 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 14DC67E71AB71876001358AB /* RCTPushNotification.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 2DD0EFE61DA8533A00B0C975;
remoteInfo = "RCTPushNotification-tvOS";
};
2DD323A61DA2DD8B000FE1B8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
@ -459,6 +467,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
2DD0EFF41DA853B200B0C975 /* libRCTPushNotification-tvOS.a in Frameworks */,
2DD323E31DA2DE3F000FE1B8 /* libRCTAnimation-tvOS.a in Frameworks */,
2DD323E41DA2DE3F000FE1B8 /* libRCTImage-tvOS.a in Frameworks */,
2DD323E51DA2DE3F000FE1B8 /* libRCTLinking-tvOS.a in Frameworks */,
@ -700,6 +709,7 @@
isa = PBXGroup;
children = (
14DC67F11AB71876001358AB /* libRCTPushNotification.a */,
2DD0EFF31DA853B200B0C975 /* libRCTPushNotification-tvOS.a */,
);
name = Products;
sourceTree = "<group>";
@ -1121,6 +1131,13 @@
remoteRef = 14DC67F01AB71876001358AB /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2DD0EFF31DA853B200B0C975 /* libRCTPushNotification-tvOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libRCTPushNotification-tvOS.a";
remoteRef = 2DD0EFF21DA853B200B0C975 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2DD323B51DA2DD8B000FE1B8 /* libRCTAnimation-tvOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;

View File

@ -24,8 +24,12 @@
@implementation RCTFontTests
// It can happen (particularly in tvOS simulator) that expected and result font objects
// will be different objects, but the same font, so this macro now explicitly
// checks that fontName (which includes the style) and pointSize are equal.
#define RCTAssertEqualFonts(font1, font2) { \
XCTAssertEqualObjects(font1, font2); \
XCTAssertTrue([font1.fontName isEqualToString:font2.fontName]); \
XCTAssertEqual(font1.pointSize,font2.pointSize); \
}
- (void)testWeight

View File

@ -8,9 +8,19 @@
/* Begin PBXBuildFile section */
148699CF1ABD045300480536 /* RCTPushNotificationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 148699CE1ABD045300480536 /* RCTPushNotificationManager.m */; };
2DD0EFEF1DA8534500B0C975 /* RCTPushNotificationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 148699CE1ABD045300480536 /* RCTPushNotificationManager.m */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
2DD0EFE41DA8533A00B0C975 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "include/$(PRODUCT_NAME)";
dstSubfolderSpec = 16;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
58B511D91A9E6C8500147676 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
@ -26,9 +36,17 @@
134814201AA4EA6300B7C361 /* libRCTPushNotification.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTPushNotification.a; sourceTree = BUILT_PRODUCTS_DIR; };
148699CD1ABD045300480536 /* RCTPushNotificationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPushNotificationManager.h; sourceTree = "<group>"; };
148699CE1ABD045300480536 /* RCTPushNotificationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPushNotificationManager.m; sourceTree = "<group>"; };
2DD0EFE61DA8533A00B0C975 /* libRCTPushNotification-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTPushNotification-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
2DD0EFE31DA8533A00B0C975 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
58B511D81A9E6C8500147676 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@ -53,6 +71,7 @@
148699CD1ABD045300480536 /* RCTPushNotificationManager.h */,
148699CE1ABD045300480536 /* RCTPushNotificationManager.m */,
134814211AA4EA7D00B7C361 /* Products */,
2DD0EFE61DA8533A00B0C975 /* libRCTPushNotification-tvOS.a */,
);
indentWidth = 2;
sourceTree = "<group>";
@ -61,6 +80,23 @@
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
2DD0EFE51DA8533A00B0C975 /* RCTPushNotification-tvOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 2DD0EFEE1DA8533A00B0C975 /* Build configuration list for PBXNativeTarget "RCTPushNotification-tvOS" */;
buildPhases = (
2DD0EFE21DA8533A00B0C975 /* Sources */,
2DD0EFE31DA8533A00B0C975 /* Frameworks */,
2DD0EFE41DA8533A00B0C975 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = "RCTPushNotification-tvOS";
productName = "RCTPushNotification-tvOS";
productReference = 2DD0EFE61DA8533A00B0C975 /* libRCTPushNotification-tvOS.a */;
productType = "com.apple.product-type.library.static";
};
58B511DA1A9E6C8500147676 /* RCTPushNotification */ = {
isa = PBXNativeTarget;
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTPushNotification" */;
@ -87,6 +123,10 @@
LastUpgradeCheck = 0610;
ORGANIZATIONNAME = Facebook;
TargetAttributes = {
2DD0EFE51DA8533A00B0C975 = {
CreatedOnToolsVersion = 8.0;
ProvisioningStyle = Automatic;
};
58B511DA1A9E6C8500147676 = {
CreatedOnToolsVersion = 6.1.1;
};
@ -105,11 +145,20 @@
projectRoot = "";
targets = (
58B511DA1A9E6C8500147676 /* RCTPushNotification */,
2DD0EFE51DA8533A00B0C975 /* RCTPushNotification-tvOS */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
2DD0EFE21DA8533A00B0C975 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2DD0EFEF1DA8534500B0C975 /* RCTPushNotificationManager.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
58B511D71A9E6C8500147676 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@ -121,6 +170,56 @@
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
2DD0EFEC1DA8533A00B0C975 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_TESTABILITY = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../React/**",
);
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Debug;
};
2DD0EFED1DA8533A00B0C975 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_NO_COMMON_BLOCKS = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../React/**",
);
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Release;
};
58B511ED1A9E6C8500147676 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@ -242,6 +341,14 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
2DD0EFEE1DA8533A00B0C975 /* Build configuration list for PBXNativeTarget "RCTPushNotification-tvOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
2DD0EFEC1DA8533A00B0C975 /* Debug */,
2DD0EFED1DA8533A00B0C975 /* Release */,
);
defaultConfigurationIsVisible = 0;
};
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTPushNotification" */ = {
isa = XCConfigurationList;
buildConfigurations = (

View File

@ -11,10 +11,12 @@
@interface RCTPushNotificationManager : RCTEventEmitter
#if !TARGET_OS_TV
+ (void)didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings;
+ (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
+ (void)didReceiveRemoteNotification:(NSDictionary *)notification;
+ (void)didReceiveLocalNotification:(UILocalNotification *)notification;
+ (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error;
#endif
@end

View File

@ -22,6 +22,7 @@ NSString *const RCTRegisterUserNotificationSettings = @"RegisterUserNotification
NSString *const RCTErrorUnableToRequestPermissions = @"E_UNABLE_TO_REQUEST_PERMISSIONS";
NSString *const RCTErrorRemoteNotificationRegistrationFailed = @"E_FAILED_TO_REGISTER_FOR_REMOTE_NOTIFICATIONS";
#if !TARGET_OS_TV
@implementation RCTConvert (NSCalendarUnit)
RCT_ENUM_CONVERTER(NSCalendarUnit,
@ -58,12 +59,15 @@ RCT_ENUM_CONVERTER(NSCalendarUnit,
}
@end
#endif //TARGET_OS_TV
@implementation RCTPushNotificationManager
{
RCTPromiseResolveBlock _requestPermissionsResolveBlock;
}
#if !TARGET_OS_TV
static NSDictionary *RCTFormatLocalNotification(UILocalNotification *notification)
{
NSMutableDictionary *formattedLocalNotification = [NSMutableDictionary dictionary];
@ -83,6 +87,8 @@ static NSDictionary *RCTFormatLocalNotification(UILocalNotification *notificatio
return formattedLocalNotification;
}
#endif //TARGET_OS_TV
RCT_EXPORT_MODULE()
- (dispatch_queue_t)methodQueue
@ -127,6 +133,8 @@ RCT_EXPORT_MODULE()
@"remoteNotificationRegistrationError"];
}
#if !TARGET_OS_TV
+ (void)didRegisterUserNotificationSettings:(__unused UIUserNotificationSettings *)notificationSettings
{
if ([UIApplication instancesRespondToSelector:@selector(registerForRemoteNotifications)]) {
@ -358,4 +366,6 @@ RCT_EXPORT_METHOD(getScheduledLocalNotifications:(RCTResponseSenderBlock)callbac
callback(@[formattedScheduledLocalNotifications]);
}
#endif //TARGET_OS_TV
@end

View File

@ -18,7 +18,7 @@
#import "RCTJSCExecutor.h"
#import "RCTBridge+Private.h"
static const NSTimeInterval kTestTimeoutSeconds = 60;
static const NSTimeInterval kTestTimeoutSeconds = 120;
static const NSTimeInterval kTestTeardownTimeoutSeconds = 30;
@implementation RCTTestRunner

View File

@ -14,8 +14,10 @@
@interface RCTConvert (UIStatusBar)
#if !TARGET_OS_TV
+ (UIStatusBarStyle)UIStatusBarStyle:(id)json;
+ (UIStatusBarAnimation)UIStatusBarAnimation:(id)json;
#endif
@end

View File

@ -13,6 +13,7 @@
#import "RCTLog.h"
#import "RCTUtils.h"
#if !TARGET_OS_TV
@implementation RCTConvert (UIStatusBar)
RCT_ENUM_CONVERTER(UIStatusBarStyle, (@{
@ -28,6 +29,7 @@ RCT_ENUM_CONVERTER(UIStatusBarAnimation, (@{
}), UIStatusBarAnimationNone, integerValue);
@end
#endif
@implementation RCTStatusBarManager
@ -51,6 +53,8 @@ RCT_EXPORT_MODULE()
@"statusBarFrameWillChange"];
}
#if !TARGET_OS_TV
- (void)startObserving
{
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
@ -128,4 +132,6 @@ RCT_EXPORT_METHOD(setNetworkActivityIndicatorVisible:(BOOL)visible)
RCTSharedApplication().networkActivityIndicatorVisible = visible;
}
#endif //TARGET_OS_TV
@end

View File

@ -163,8 +163,10 @@
2D3B5EEF1D9B09DC00451313 /* RCTViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E0674E1A70F44B002CDEE1 /* RCTViewManager.m */; };
2D3B5EF01D9B09E300451313 /* RCTWrapperViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B080241A694A8400A75B9A /* RCTWrapperViewController.m */; };
2D3B5EF11D9B09E700451313 /* UIView+React.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E067541A70F44B002CDEE1 /* UIView+React.m */; };
2D537FD21DA4809D000F876C /* RCTMultipartDataTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 006FC4131D9B20820057AAAD /* RCTMultipartDataTask.m */; };
2D537FD21DA4809D000F876C /* (null) in Sources */ = {isa = PBXBuildFile; };
2D74EAFA1DAE9590003B751B /* RCTMultipartDataTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 006FC4131D9B20820057AAAD /* RCTMultipartDataTask.m */; };
2D8C2E331DA40441000EE098 /* RCTMultipartStreamReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 001BFCCF1D8381DE008E587E /* RCTMultipartStreamReader.m */; };
2DD0EFE11DA84F2800B0C975 /* RCTStatusBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13723B4F1A82FD3C00F88898 /* RCTStatusBarManager.m */; };
352DCFF01D19F4C20056D623 /* RCTI18nUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 352DCFEF1D19F4C20056D623 /* RCTI18nUtil.m */; };
391E86A41C623EC800009732 /* RCTTouchEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 391E86A21C623EC800009732 /* RCTTouchEvent.m */; };
3D1E68DB1CABD13900DD7465 /* RCTDisplayLink.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D1E68D91CABD13900DD7465 /* RCTDisplayLink.m */; };
@ -889,6 +891,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2DD0EFE11DA84F2800B0C975 /* RCTStatusBarManager.m in Sources */,
2D3B5EC91D9B095C00451313 /* RCTBorderDrawing.m in Sources */,
2D3B5ED31D9B097B00451313 /* RCTMapOverlay.m in Sources */,
2D3B5E991D9B089A00451313 /* RCTDisplayLink.m in Sources */,
@ -913,7 +916,7 @@
2D3B5ED11D9B097500451313 /* RCTMapAnnotation.m in Sources */,
2D3B5EAB1D9B08EC00451313 /* RCTJSCErrorHandling.m in Sources */,
2D3B5EAF1D9B08FB00451313 /* RCTAccessibilityManager.m in Sources */,
2D537FD21DA4809D000F876C /* RCTMultipartDataTask.m in Sources */,
2D537FD21DA4809D000F876C /* (null) in Sources */,
2D3B5EF11D9B09E700451313 /* UIView+React.m in Sources */,
2D3B5E931D9B087300451313 /* RCTErrorInfo.m in Sources */,
2D3B5EE01D9B09AD00451313 /* RCTRootShadowView.m in Sources */,
@ -960,6 +963,7 @@
2D3B5E9C1D9B08A300451313 /* RCTImageSource.m in Sources */,
2D3B5EC31D9B094800451313 /* RCTProfileTrampoline-arm.S in Sources */,
2D3B5ED91D9B098E00451313 /* RCTNavItem.m in Sources */,
2D74EAFA1DAE9590003B751B /* RCTMultipartDataTask.m in Sources */,
2D3B5EC51D9B094D00451313 /* RCTProfileTrampoline-i386.S in Sources */,
2D3B5EC41D9B094B00451313 /* RCTProfileTrampoline-arm64.S in Sources */,
2D3B5EBB1D9B092300451313 /* RCTI18nManager.m in Sources */,

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)