aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2017-06-08 09:58:06 -0700
committerGravatar Muxi Yan <mxyan@google.com>2017-06-08 10:25:15 -0700
commit7352bae1bb02d0d66091f85761934e7fcc1b95ef (patch)
tree8a3311fa6bd78db266ed3c37d58d060040cb9067 /src/objective-c
parentcc620dffd02da894dd5678e650c474d21c8432c0 (diff)
Move tests
Diffstat (limited to 'src/objective-c')
-rw-r--r--src/objective-c/tests/PluginTest/imported-with-dash.proto38
-rw-r--r--src/objective-c/tests/PluginTest/test-dash-filename.proto (renamed from src/objective-c/tests/RemoteTestClient/test-dash-filename.proto)8
-rwxr-xr-xsrc/objective-c/tests/build_tests.sh22
-rwxr-xr-xsrc/objective-c/tests/run_tests.sh32
4 files changed, 77 insertions, 23 deletions
diff --git a/src/objective-c/tests/PluginTest/imported-with-dash.proto b/src/objective-c/tests/PluginTest/imported-with-dash.proto
new file mode 100644
index 0000000000..0c4ee3827a
--- /dev/null
+++ b/src/objective-c/tests/PluginTest/imported-with-dash.proto
@@ -0,0 +1,38 @@
+// Copyright 2017, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package grpc.testing;
+
+option objc_class_prefix = "RMT";
+
+message TestMessageImported {
+ int32 dummy = 1;
+}
diff --git a/src/objective-c/tests/RemoteTestClient/test-dash-filename.proto b/src/objective-c/tests/PluginTest/test-dash-filename.proto
index 413d6f9eaa..be9386f960 100644
--- a/src/objective-c/tests/RemoteTestClient/test-dash-filename.proto
+++ b/src/objective-c/tests/PluginTest/test-dash-filename.proto
@@ -1,4 +1,4 @@
-// Copyright 2015, Google Inc.
+// Copyright 2017, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -35,5 +35,11 @@ package grpc.testing;
option objc_class_prefix = "RMT";
+import "imported-with-dash.proto";
+
+message TestMessage {
+ int32 dummy = 1;
+}
+
service DummyService {
}
diff --git a/src/objective-c/tests/build_tests.sh b/src/objective-c/tests/build_tests.sh
index 496dbcbe60..4b3ed21886 100755
--- a/src/objective-c/tests/build_tests.sh
+++ b/src/objective-c/tests/build_tests.sh
@@ -53,25 +53,3 @@ rm -f RemoteTestClient/*.{h,m}
echo "TIME: $(date)"
pod install
-# Verify the output proto name
-[ -e ./RemoteTestClient/Test-dash-filename.pbrpc.h ] || {
- echo >&2 "protoc outputs wrong filename."
- exit 1
-}
-
-# Verify the output proto name when dash is treated as separator
-PROTOC=../../../bins/$CONFIG/protobuf/protoc
-PLUGIN=../../../bins/$CONFIG/grpc_objective_c_plugin
-
-eval $PROTOC \
- --plugin=protoc-gen-grpc=$PLUGIN \
- --objc_out=RemoteTestClient \
- --grpc_out=filename-dash-as-separator:RemoteTestClient \
- -I RemoteTestClient \
- -I ../../../third_party/protobuf/src \
- RemoteTestClient/*.proto
-
-[ -e ./RemoteTestClient/TestDashFilename.pbrpc.h ] || {
- echo >&2 "protoc outputs wring filename. 2"
- exit 1
-}
diff --git a/src/objective-c/tests/run_tests.sh b/src/objective-c/tests/run_tests.sh
index 2432209f4f..2d61910bbd 100755
--- a/src/objective-c/tests/run_tests.sh
+++ b/src/objective-c/tests/run_tests.sh
@@ -38,6 +38,38 @@ cd $(dirname $0)
# Run the tests server.
BINDIR=../../../bins/$CONFIG
+PROTOC=$BINDIR/protobuf/protoc
+PLUGIN=$BINDIR/grpc_objective_c_plugin
+
+rm -rf PluginTest/*pb*
+
+# Verify the output proto filename
+eval $PROTOC \
+ --plugin=protoc-gen-grpc=$PLUGIN \
+ --objc_out=PluginTest \
+ --grpc_out=PluginTest \
+ -I PluginTest \
+ -I ../../../third_party/protobuf/src \
+ PluginTest/*.proto
+
+[ -e ./PluginTest/TestDashFilename.pbrpc.h ] || {
+ echo >&2 "protoc outputs wrong filename."
+ exit 1
+}
+
+# Verify names of the imported protos in generated code
+[ "`cat PluginTest/TestDashFilename.pbrpc.h |
+ egrep '#import ".*\.pb(objc|rpc)\.h"$' |
+ egrep '-'`" ] && {
+ echo >&2 "protoc generated import with wrong filename."
+ exit 1
+}
+[ "`cat PluginTest/TestDashFilename.pbrpc.m |
+ egrep '#import ".*\.pb(objc|rpc)\.m"$' |
+ egrep '-'`" ] && {
+ echo >&2 "protoc generated import with wrong filename."
+ exit 1
+}
[ -f $BINDIR/interop_server ] || {
echo >&2 "Can't find the test server. Make sure run_tests.py is making" \