diff options
author | 2015-10-05 17:52:28 +0000 | |
---|---|---|
committer | 2015-10-06 07:03:23 +0000 | |
commit | dc17eb30959578298a38af7fb38aef8c1eb165f6 (patch) | |
tree | 9c8ef4224258c60fbf292d52aac8b7b48d60f4f2 /src/test/shell | |
parent | 6817a6fcdd4275f9d3d4c3b9451a6c4144adcee1 (diff) |
Add prerequisite dependencies to make ios_test work build on bazel.
--
MOS_MIGRATED_REVID=104673050
Diffstat (limited to 'src/test/shell')
-rwxr-xr-x | src/test/shell/bazel/bazel_objc_test.sh | 42 | ||||
-rwxr-xr-x | src/test/shell/bazel/test-setup.sh | 22 |
2 files changed, 55 insertions, 9 deletions
diff --git a/src/test/shell/bazel/bazel_objc_test.sh b/src/test/shell/bazel/bazel_objc_test.sh index 94004b3580..7b0ceeb5b8 100755 --- a/src/test/shell/bazel/bazel_objc_test.sh +++ b/src/test/shell/bazel/bazel_objc_test.sh @@ -61,12 +61,42 @@ EOF </plist> EOF + cat >ios/PassTest-Info.plist <<EOF +<plist version="1.0"> +<dict> + <key>CFBundleExecutable</key> + <string>PassingXcTest</string> +</dict> +</plist> +EOF + + cat >ios/passtest.m <<EOF +#import <XCTest/XCTest.h> + +@interface PassingXcTest : XCTestCase + +@end + +@implementation PassingXcTest + +- (void)testPass { + XCTAssertEqual(1, 1, @"should pass"); +} + +@end +EOF + cat >ios/BUILD <<EOF objc_binary(name = "bin", non_arc_srcs = ['app.m']) ios_application(name = "app", binary = ':bin', infoplist = 'App-Info.plist') +ios_test(name = 'PassingXcTest', + srcs = ['passtest.m'], + infoplist = "PassTest-Info.plist", + xctest = True, + xctest_app = ':app') EOF } @@ -80,4 +110,16 @@ function test_build_app() { ls bazel-bin/ios/app.ipa || fail "should generate app.ipa" } +function test_ios_test() { + setup_objc_test_support + make_app + + bazel build --test_output=all //ios:PassingXcTest >$TEST_log 2>&1 \ + || fail "should pass" + ls bazel-bin/ios/PassingXcTest.xcodeproj \ + || fail "should generate PassingXcTest.xcodeproj" + ls bazel-bin/ios/PassingXcTest.ipa \ + || fail "should generate PassingXcTest.ipa" +} + run_suite "objc/ios test suite" diff --git a/src/test/shell/bazel/test-setup.sh b/src/test/shell/bazel/test-setup.sh index 204a4fb419..cddaf9c90e 100755 --- a/src/test/shell/bazel/test-setup.sh +++ b/src/test/shell/bazel/test-setup.sh @@ -308,6 +308,18 @@ filegroup( EOF } +function setup_iossim() { + mkdir -p third_party/iossim + ln -sv ${iossim_path} third_party/iossim/iossim + + cat <<EOF >>third_party/iossim/BUILD +licenses(["unencumbered"]) +package(default_visibility = ["//visibility:public"]) + +exports_files(["iossim"]) +EOF +} + # Sets up Objective-C tools. Mac only. function setup_objc_test_support() { mkdir -p tools/objc @@ -322,15 +334,7 @@ function setup_objc_test_support() { [ -e tools/objc/realpath ] || ln -sv ${realpath_path} tools/objc/realpath [ -e tools/objc/environment_plist.sh ] || ln -sv ${environment_plist_path} tools/objc/environment_plist.sh - mkdir -p third_party/iossim - [ -e third_party/iossim/iossim ] || ln -sv ${iossim_path} third_party/iossim/iossim - - cat <<EOF >>third_party/iossim/BUILD -licenses(["unencumbered"]) -package(default_visibility = ["//visibility:public"]) - -exports_files(["iossim"]) -EOF + [ -e third_party/iossim/iossim ] || setup_iossim } workspaces=() |