aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Makarand Dharmapurikar <makarandd@google.com>2017-04-12 12:16:28 -0700
committerGravatar Makarand Dharmapurikar <makarandd@google.com>2017-04-12 12:16:28 -0700
commitb4e97270cc13849bb5a4585c88bc6385872d643b (patch)
treec85a66685f089e3457e6ea73c5c5d5a4c7e9f812
parentc44895ffe59c7f6ccf010995f0575cd02d851032 (diff)
replaced hardcoded server path with cmdline arg
The host and port of the remote server can be specified via command line argument to xcodebuild.
-rw-r--r--src/objective-c/tests/InteropTestsLocalCleartext.m6
-rw-r--r--src/objective-c/tests/InteropTestsLocalSSL.m7
-rw-r--r--src/objective-c/tests/InteropTestsRemote.m6
-rw-r--r--src/objective-c/tests/InteropTestsRemoteWithCronet/InteropTestsRemoteWithCronet.m7
-rw-r--r--src/objective-c/tests/Tests.xcodeproj/project.pbxproj1
-rwxr-xr-xsrc/objective-c/tests/run_tests.sh4
6 files changed, 26 insertions, 5 deletions
diff --git a/src/objective-c/tests/InteropTestsLocalCleartext.m b/src/objective-c/tests/InteropTestsLocalCleartext.m
index 94cdf85965..cdcdd8a88c 100644
--- a/src/objective-c/tests/InteropTestsLocalCleartext.m
+++ b/src/objective-c/tests/InteropTestsLocalCleartext.m
@@ -36,7 +36,11 @@
#import "InteropTests.h"
-static NSString * const kLocalCleartextHost = @"localhost:5050";
+// The server address is derived from preprocessor macro, which is
+// in turn derived from environment variable of the same name.
+#define NSStringize_helper(x) #x
+#define NSStringize(x) @NSStringize_helper(x)
+static NSString * const kLocalCleartextHost = NSStringize(HOST_PORT_LOCAL);
// The Protocol Buffers encoding overhead of local interop server. Acquired
// by experiment. Adjust this when server's proto file changes.
diff --git a/src/objective-c/tests/InteropTestsLocalSSL.m b/src/objective-c/tests/InteropTestsLocalSSL.m
index 3c78b65ede..45e62d29b9 100644
--- a/src/objective-c/tests/InteropTestsLocalSSL.m
+++ b/src/objective-c/tests/InteropTestsLocalSSL.m
@@ -35,8 +35,11 @@
#import <GRPCClient/internal_testing/GRPCCall+InternalTests.h>
#import "InteropTests.h"
-
-static NSString * const kLocalSSLHost = @"localhost:5051";
+// The server address is derived from preprocessor macro, which is
+// in turn derived from environment variable of the same name.
+#define NSStringize_helper(x) #x
+#define NSStringize(x) @NSStringize_helper(x)
+static NSString * const kLocalSSLHost = NSStringize(HOST_PORT_LOCALSSL);
// The Protocol Buffers encoding overhead of local interop server. Acquired
// by experiment. Adjust this when server's proto file changes.
diff --git a/src/objective-c/tests/InteropTestsRemote.m b/src/objective-c/tests/InteropTestsRemote.m
index ff1193302b..5260fe4570 100644
--- a/src/objective-c/tests/InteropTestsRemote.m
+++ b/src/objective-c/tests/InteropTestsRemote.m
@@ -36,7 +36,11 @@
#import "InteropTests.h"
-static NSString * const kRemoteSSLHost = @"grpc-test.sandbox.googleapis.com";
+// The server address is derived from preprocessor macro, which is
+// in turn derived from environment variable of the same name.
+#define NSStringize_helper(x) #x
+#define NSStringize(x) @NSStringize_helper(x)
+static NSString * const kRemoteSSLHost = NSStringize(HOST_PORT_REMOTE);
// The Protocol Buffers encoding overhead of remote interop server. Acquired
// by experiment. Adjust this when server's proto file changes.
diff --git a/src/objective-c/tests/InteropTestsRemoteWithCronet/InteropTestsRemoteWithCronet.m b/src/objective-c/tests/InteropTestsRemoteWithCronet/InteropTestsRemoteWithCronet.m
index 9edfbc2639..a7f190d2b4 100644
--- a/src/objective-c/tests/InteropTestsRemoteWithCronet/InteropTestsRemoteWithCronet.m
+++ b/src/objective-c/tests/InteropTestsRemoteWithCronet/InteropTestsRemoteWithCronet.m
@@ -39,7 +39,12 @@
#import "InteropTests.h"
-static NSString * const kRemoteSSLHost = @"grpc-test.sandbox.googleapis.com";
+// The server address is derived from preprocessor macro, which is
+// in turn derived from environment variable of the same name.
+#define NSStringize_helper(x) #x
+#define NSStringize(x) @NSStringize_helper(x)
+static NSString * const kRemoteSSLHost = NSStringize(HOST_PORT_REMOTE);
+
// The Protocol Buffers encoding overhead of remote interop server. Acquired
// by experiment. Adjust this when server's proto file changes.
diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj
index 97de723a22..eee4897ca8 100644
--- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj
+++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj
@@ -1282,6 +1282,7 @@
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
+ "HOST_PORT=$(HOST_PORT)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
diff --git a/src/objective-c/tests/run_tests.sh b/src/objective-c/tests/run_tests.sh
index 0e82bcaa44..2432209f4f 100755
--- a/src/objective-c/tests/run_tests.sh
+++ b/src/objective-c/tests/run_tests.sh
@@ -59,6 +59,9 @@ xcodebuild \
-workspace Tests.xcworkspace \
-scheme AllTests \
-destination name="iPhone 6" \
+ HOST_PORT_LOCALSSL=localhost:5051 \
+ HOST_PORT_LOCAL=localhost:5050 \
+ HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \
test | xcpretty
echo "TIME: $(date)"
@@ -84,4 +87,5 @@ xcodebuild \
-workspace Tests.xcworkspace \
-scheme InteropTestsRemoteWithCronet \
-destination name="iPhone 6" \
+ HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \
test | xcpretty