Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
7a0c431c
Commit
7a0c431c
authored
Jun 18, 2015
by
Jisi Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable tests for bazel build.
Change-Id: I63ed5fb58a45e098f2fd1fa457a219148de030bd
parent
5b3a8e76
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
140 additions
and
77 deletions
+140
-77
BUILD
BUILD
+98
-77
WORKSPACE
WORKSPACE
+16
-0
gmock.BUILD
gmock.BUILD
+23
-0
update_file_lists.sh
update_file_lists.sh
+3
-0
No files found.
BUILD
View file @
7a0c431c
...
...
@@ -286,11 +286,13 @@ PROTOS = LITE_TEST_PROTOS + TEST_PROTOS
INPUTS = PROTOS + WELL_KNOWN_PROTOS
OUTPUTS = ["src/" + x[:-5] + "pb.h" for x in PROTOS] + \
["src/" + x[:-5] + "pb.cc" for x in PROTOS]
genrule(
name = "gen_test_protos",
srcs = ["src/" + x for x in INPUTS],
outs = ["src/" + x[:-5] + "pb.h" for x in PROTOS] +
["src/" + x[:-5] + "pb.cc" for x in PROTOS],
outs = OUTPUTS,
cmd =
"$(location :protoc) --cpp_out=$(@D)/src" +
"".join([" -I" + x + "=$(location src/" + x + ")" for x in INPUTS]) +
...
...
@@ -307,78 +309,97 @@ COMMON_TEST_SRCS = [
"src/google/protobuf/testing/googletest.cc",
]
# TODO(liujisi): Add gtest dependency and enable tests.
# cc_test(
# name = "protobuf_test",
# srcs = OUTPUTS + COMMON_TEST_SRCS + [
# "src/google/protobuf/any_test.cc",
# "src/google/protobuf/arena_unittest.cc",
# "src/google/protobuf/arenastring_unittest.cc",
# "src/google/protobuf/compiler/command_line_interface_unittest.cc",
# "src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc",
# "src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc",
# "src/google/protobuf/compiler/cpp/cpp_unittest.cc",
# "src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc",
# "src/google/protobuf/compiler/importer_unittest.cc",
# "src/google/protobuf/compiler/java/java_doc_comment_unittest.cc",
# "src/google/protobuf/compiler/java/java_plugin_unittest.cc",
# "src/google/protobuf/compiler/mock_code_generator.cc",
# "src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc",
# "src/google/protobuf/compiler/parser_unittest.cc",
# "src/google/protobuf/compiler/python/python_plugin_unittest.cc",
# "src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc",
# "src/google/protobuf/descriptor_database_unittest.cc",
# "src/google/protobuf/descriptor_unittest.cc",
# "src/google/protobuf/drop_unknown_fields_test.cc",
# "src/google/protobuf/dynamic_message_unittest.cc",
# "src/google/protobuf/extension_set_unittest.cc",
# "src/google/protobuf/generated_message_reflection_unittest.cc",
# "src/google/protobuf/io/coded_stream_unittest.cc",
# "src/google/protobuf/io/printer_unittest.cc",
# "src/google/protobuf/io/tokenizer_unittest.cc",
# "src/google/protobuf/io/zero_copy_stream_unittest.cc",
# "src/google/protobuf/map_field_test.cc",
# "src/google/protobuf/map_test.cc",
# "src/google/protobuf/message_unittest.cc",
# "src/google/protobuf/no_field_presence_test.cc",
# "src/google/protobuf/preserve_unknown_enum_test.cc",
# "src/google/protobuf/proto3_arena_unittest.cc",
# "src/google/protobuf/reflection_ops_unittest.cc",
# "src/google/protobuf/repeated_field_reflection_unittest.cc",
# "src/google/protobuf/repeated_field_unittest.cc",
# "src/google/protobuf/stubs/bytestream_unittest.cc",
# "src/google/protobuf/stubs/common_unittest.cc",
# "src/google/protobuf/stubs/once_unittest.cc",
# "src/google/protobuf/stubs/status_test.cc",
# "src/google/protobuf/stubs/statusor_test.cc",
# "src/google/protobuf/stubs/stringpiece_unittest.cc",
# "src/google/protobuf/stubs/stringprintf_unittest.cc",
# "src/google/protobuf/stubs/structurally_valid_unittest.cc",
# "src/google/protobuf/stubs/strutil_unittest.cc",
# "src/google/protobuf/stubs/template_util_unittest.cc",
# "src/google/protobuf/stubs/time_test.cc",
# "src/google/protobuf/stubs/type_traits_unittest.cc",
# "src/google/protobuf/text_format_unittest.cc",
# "src/google/protobuf/unknown_field_set_unittest.cc",
# "src/google/protobuf/util/field_comparator_test.cc",
# "src/google/protobuf/util/internal/default_value_objectwriter_test.cc",
# "src/google/protobuf/util/internal/json_objectwriter_test.cc",
# "src/google/protobuf/util/internal/json_stream_parser_test.cc",
# "src/google/protobuf/util/internal/protostream_objectsource_test.cc",
# "src/google/protobuf/util/internal/protostream_objectwriter_test.cc",
# "src/google/protobuf/util/internal/type_info_test_helper.cc",
# "src/google/protobuf/util/json_util_test.cc",
# "src/google/protobuf/util/type_resolver_util_test.cc",
# "src/google/protobuf/well_known_types_unittest.cc",
# "src/google/protobuf/wire_format_unittest.cc",
# ],
# copts = COPTS,
# includes = [
# "src/",
# ],
# linkopts = LINK_OPTS,
# deps = [
# ":protobuf",
# ":protoc_lib",
# ],
# )
cc_binary(
name = "test_plugin",
srcs = [
# AUTOGEN(test_plugin_srcs)
"src/google/protobuf/compiler/mock_code_generator.cc",
"src/google/protobuf/compiler/test_plugin.cc",
"src/google/protobuf/testing/file.cc",
],
deps = [
":protobuf",
":protoc_lib",
"//external:gtest",
],
)
cc_test(
name = "protobuf_test",
srcs = OUTPUTS + COMMON_TEST_SRCS + [
# AUTOGEN(test_srcs)
"src/google/protobuf/any_test.cc",
"src/google/protobuf/arena_unittest.cc",
"src/google/protobuf/arenastring_unittest.cc",
"src/google/protobuf/compiler/command_line_interface_unittest.cc",
"src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc",
"src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc",
"src/google/protobuf/compiler/cpp/cpp_unittest.cc",
"src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc",
"src/google/protobuf/compiler/importer_unittest.cc",
"src/google/protobuf/compiler/java/java_doc_comment_unittest.cc",
"src/google/protobuf/compiler/java/java_plugin_unittest.cc",
"src/google/protobuf/compiler/mock_code_generator.cc",
"src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc",
"src/google/protobuf/compiler/parser_unittest.cc",
"src/google/protobuf/compiler/python/python_plugin_unittest.cc",
"src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc",
"src/google/protobuf/descriptor_database_unittest.cc",
"src/google/protobuf/descriptor_unittest.cc",
"src/google/protobuf/drop_unknown_fields_test.cc",
"src/google/protobuf/dynamic_message_unittest.cc",
"src/google/protobuf/extension_set_unittest.cc",
"src/google/protobuf/generated_message_reflection_unittest.cc",
"src/google/protobuf/io/coded_stream_unittest.cc",
"src/google/protobuf/io/printer_unittest.cc",
"src/google/protobuf/io/tokenizer_unittest.cc",
"src/google/protobuf/io/zero_copy_stream_unittest.cc",
"src/google/protobuf/map_field_test.cc",
"src/google/protobuf/map_test.cc",
"src/google/protobuf/message_unittest.cc",
"src/google/protobuf/no_field_presence_test.cc",
"src/google/protobuf/preserve_unknown_enum_test.cc",
"src/google/protobuf/proto3_arena_unittest.cc",
"src/google/protobuf/reflection_ops_unittest.cc",
"src/google/protobuf/repeated_field_reflection_unittest.cc",
"src/google/protobuf/repeated_field_unittest.cc",
"src/google/protobuf/stubs/bytestream_unittest.cc",
"src/google/protobuf/stubs/common_unittest.cc",
"src/google/protobuf/stubs/once_unittest.cc",
"src/google/protobuf/stubs/status_test.cc",
"src/google/protobuf/stubs/statusor_test.cc",
"src/google/protobuf/stubs/stringpiece_unittest.cc",
"src/google/protobuf/stubs/stringprintf_unittest.cc",
"src/google/protobuf/stubs/structurally_valid_unittest.cc",
"src/google/protobuf/stubs/strutil_unittest.cc",
"src/google/protobuf/stubs/template_util_unittest.cc",
"src/google/protobuf/stubs/time_test.cc",
"src/google/protobuf/stubs/type_traits_unittest.cc",
"src/google/protobuf/text_format_unittest.cc",
"src/google/protobuf/unknown_field_set_unittest.cc",
"src/google/protobuf/util/field_comparator_test.cc",
"src/google/protobuf/util/internal/default_value_objectwriter_test.cc",
"src/google/protobuf/util/internal/json_objectwriter_test.cc",
"src/google/protobuf/util/internal/json_stream_parser_test.cc",
"src/google/protobuf/util/internal/protostream_objectsource_test.cc",
"src/google/protobuf/util/internal/protostream_objectwriter_test.cc",
"src/google/protobuf/util/internal/type_info_test_helper.cc",
"src/google/protobuf/util/json_util_test.cc",
"src/google/protobuf/util/type_resolver_util_test.cc",
"src/google/protobuf/well_known_types_unittest.cc",
"src/google/protobuf/wire_format_unittest.cc",
],
copts = COPTS,
data = [
":test_plugin",
],
includes = [
"src/",
],
linkopts = LINK_OPTS,
deps = [
":protobuf",
":protoc_lib",
"//external:gtest_main",
],
)
WORKSPACE
View file @
7a0c431c
new_http_archive(
name = "gmock_archive",
url = "https://googlemock.googlecode.com/files/gmock-1.7.0.zip",
sha256 = "26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b",
build_file = "gmock.BUILD",
)
bind(
name = "gtest",
actual = "@gmock_archive//:gtest",
)
bind(
name = "gtest_main",
actual = "@gmock_archive//:gtest_main",
)
gmock.BUILD
0 → 100644
View file @
7a0c431c
cc_library(
name = "gtest",
srcs = [
"gmock-1.7.0/gtest/src/gtest-all.cc",
"gmock-1.7.0/src/gmock-all.cc",
],
includes = [
"gmock-1.7.0",
"gmock-1.7.0/gtest",
"gmock-1.7.0/gtest/include",
"gmock-1.7.0/include",
],
linkopts = ["-pthread"],
visibility = ["//visibility:public"],
)
cc_library(
name = "gtest_main",
srcs = ["gmock-1.7.0/src/gmock_main.cc"],
linkopts = ["-pthread"],
visibility = ["//visibility:public"],
deps = [":gtest"],
)
update_file_lists.sh
View file @
7a0c431c
...
...
@@ -57,6 +57,7 @@ WKT_PROTOS=$(get_variable_value $MAKEFILE nobase_dist_proto_DATA)
COMMON_TEST_SOURCES
=
$(
get_source_files
$MAKEFILE
COMMON_TEST_SOURCES
)
TEST_SOURCES
=
$(
get_source_files
$MAKEFILE
protobuf_test_SOURCES
)
LITE_TEST_SOURCES
=
$(
get_source_files
$MAKEFILE
protobuf_lite_test_SOURCES
)
TEST_PLUGIN_SOURCES
=
$(
get_source_files
$MAKEFILE
test_plugin_SOURCES
)
################################################################################
# Update cmake files.
...
...
@@ -177,3 +178,5 @@ set_bazel_value $BAZEL_BUILD well_known_protos "" $WKT_PROTOS
set_bazel_value
$BAZEL_BUILD
test_protos
""
$PROTOS
set_bazel_value
$BAZEL_BUILD
common_test_srcs
$BAZEL_PREFIX
$COMMON_TEST_SOURCES
set_bazel_value
$BAZEL_BUILD
test_srcs
$BAZEL_PREFIX
$TEST_SOURCES
set_bazel_value
$BAZEL_BUILD
test_plugin_srcs
$BAZEL_PREFIX
$TEST_PLUGIN_SOURCES
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment