forked from baidu/sofa-pbrpc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23f4698
commit d3ede4d
Showing
5 changed files
with
187 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
load("@protobuf//:protobuf.bzl", "cc_proto_library") | ||
|
||
cc_proto_library( | ||
name = "test_data", | ||
srcs = [ | ||
"test_data.proto", | ||
], | ||
include = ".", | ||
default_runtime = "@protobuf//:protobuf", | ||
protoc = "@protobuf//:protoc", | ||
deps = [ | ||
"//:cc_protos", | ||
], | ||
) | ||
|
||
cc_binary( | ||
name = "test_atomic", | ||
srcs = ["test_atomic.cc"], | ||
deps = [ | ||
"//:sofa-pbrpc", | ||
], | ||
visibility = ["//main:__pkg__"], | ||
) | ||
|
||
cc_library( | ||
name = "test_buffer-deps", | ||
hdrs = [ | ||
"//:src/sofa/pbrpc/buffer.cc", | ||
], | ||
deps = [ | ||
"//:sofa-pbrpc" | ||
], | ||
visibility = ["//main:__pkg__"], | ||
) | ||
|
||
cc_binary( | ||
name = "test_buffer", | ||
srcs = ["test_buffer.cc"], | ||
deps = [ | ||
":test_data", | ||
"//:sofa-pbrpc", | ||
":test_buffer-deps", | ||
], | ||
includes = ["src"], | ||
copts = [ | ||
"-fno-access-control", | ||
], | ||
visibility = ["//main:__pkg__"], | ||
) | ||
|
||
cc_binary( | ||
name = "test_closure", | ||
srcs = ["test_closure.cc"], | ||
deps = [ | ||
"//:sofa-pbrpc" | ||
], | ||
visibility = ["//main:__pkg__"], | ||
) | ||
|
||
cc_binary( | ||
name = "test_common", | ||
srcs = ["test_common.cc"], | ||
deps = [ | ||
"//:sofa-pbrpc" | ||
], | ||
copts = [ | ||
"-DBAZEL_BUILD" | ||
], | ||
visibility = ["//main:__pkg__"], | ||
) | ||
|
||
cc_binary( | ||
name = "test_epoll_support", | ||
srcs = ["test_epoll_support.cc"], | ||
deps = [ | ||
"//:sofa-pbrpc" | ||
], | ||
visibility = ["//main:__pkg__"], | ||
) | ||
|
||
cc_binary( | ||
name = "test_ext_closure", | ||
srcs = ["test_ext_closure.cc"], | ||
deps = [ | ||
"//:sofa-pbrpc" | ||
], | ||
visibility = ["//main:__pkg__"], | ||
) | ||
|
||
cc_binary( | ||
name = "test_io_service_pool", | ||
srcs = ["test_io_service_pool.cc"], | ||
deps = [ | ||
"//:sofa-pbrpc" | ||
], | ||
visibility = ["//main:__pkg__"], | ||
) | ||
|
||
cc_binary( | ||
name = "test_thread_group", | ||
srcs = ["test_thread_group.cc"], | ||
deps = [ | ||
"//:sofa-pbrpc" | ||
], | ||
visibility = ["//main:__pkg__"], | ||
) | ||
|
||
cc_binary( | ||
name = "test_timeout_manager", | ||
srcs = ["test_timeout_manager.cc"], | ||
deps = [ | ||
"//:sofa-pbrpc" | ||
], | ||
visibility = ["//main:__pkg__"], | ||
) | ||
|
||
cc_binary( | ||
name = "test_tran_buf_pool", | ||
srcs = ["test_tran_buf_pool.cc"], | ||
deps = [ | ||
"//:sofa-pbrpc" | ||
], | ||
visibility = ["//main:__pkg__"], | ||
) | ||
|
||
cc_binary( | ||
name = "test_web_service", | ||
srcs = ["test_web_service.cc"], | ||
deps = [ | ||
"//:sofa-pbrpc" | ||
], | ||
copts = [ | ||
"-fno-access-control", | ||
], | ||
visibility = ["//main:__pkg__"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
function build() | ||
{ | ||
name=$(echo $1 | awk -F '.' '{print $2}' | awk -F '/' '{print $2}') | ||
bazel build :$name | ||
if [ $? -ne 0 ]; then | ||
echo "BUILD FAILED!!! for $name" | ||
exit 1 | ||
fi | ||
} | ||
|
||
function run() | ||
{ | ||
name=$(echo $1 | awk -F '.' '{print $2}' | awk -F '/' '{print $2}') | ||
echo "===========" $name "===========" | ||
bazel run :$name | ||
../bazel-bin/unit-test/$name | ||
if [ $? -ne 0 ]; then | ||
echo "TEST FAILED!!!" | ||
exit 1 | ||
fi | ||
} | ||
|
||
num=0 | ||
for test_case in `find . -name 'test_*.cc' -a` # -perm -100` | ||
do | ||
build $test_case | ||
num=$((num+1)) | ||
done | ||
|
||
num=0 | ||
for test_case in `find . -name 'test_*.cc' -a` # -perm -100` | ||
do | ||
run $test_case | ||
num=$((num+1)) | ||
done | ||
|
||
echo | ||
echo "CASE NUM: $num" | ||
echo "ALL CASE PASSED!!!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
syntax = "proto2"; | ||
|
||
package sofa.pbrpc.test; | ||
|
||
message TestData { | ||
|