pull/11341/head
Muxi Yan 8 years ago
parent cc620dffd0
commit 7352bae1bb
  1. 38
      src/objective-c/tests/PluginTest/imported-with-dash.proto
  2. 8
      src/objective-c/tests/PluginTest/test-dash-filename.proto
  3. 22
      src/objective-c/tests/build_tests.sh
  4. 32
      src/objective-c/tests/run_tests.sh

@ -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;
}

@ -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 {
}

@ -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
}

@ -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" \

Loading…
Cancel
Save