[Bazel] Move conformance test targets to //conformance. (#9922)
This commit is contained in:
parent
52655b1f5e
commit
637a699969
173
BUILD.bazel
173
BUILD.bazel
@ -714,11 +714,11 @@ cc_test(
|
||||
],
|
||||
}),
|
||||
data = [
|
||||
# Files for csharp_bootstrap_unittest.cc.
|
||||
"//conformance:all_files",
|
||||
":test_plugin",
|
||||
] + glob([
|
||||
"src/google/protobuf/**/*",
|
||||
# Files for csharp_bootstrap_unittest.cc.
|
||||
"conformance/**/*",
|
||||
]) + glob(
|
||||
[
|
||||
# Files for csharp_bootstrap_unittest.cc.
|
||||
@ -1108,14 +1108,22 @@ py_proto_library(
|
||||
# Conformance tests
|
||||
################################################################################
|
||||
|
||||
alias(
|
||||
name = "conformance_test_runner",
|
||||
actual = "//conformance:conformance_test_runner",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "test_messages_proto2_proto",
|
||||
strip_import_prefix = "src",
|
||||
srcs = ["src/google/protobuf/test_messages_proto2.proto"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "test_messages_proto3_proto",
|
||||
strip_import_prefix = "src",
|
||||
srcs = ["src/google/protobuf/test_messages_proto3.proto"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
@ -1128,87 +1136,6 @@ proto_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
name = "test_messages_proto2_proto_cc",
|
||||
srcs = ["src/google/protobuf/test_messages_proto2.proto"],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
name = "test_messages_proto3_proto_cc",
|
||||
srcs = ["src/google/protobuf/test_messages_proto3.proto"],
|
||||
deps = [
|
||||
":cc_wkt_protos",
|
||||
],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "conformance_proto",
|
||||
srcs = ["conformance/conformance.proto"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
name = "conformance_proto_cc",
|
||||
srcs = ["conformance/conformance.proto"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "jsoncpp",
|
||||
srcs = ["conformance/third_party/jsoncpp/jsoncpp.cpp"],
|
||||
hdrs = ["conformance/third_party/jsoncpp/json.h"],
|
||||
includes = ["conformance"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "conformance_test",
|
||||
srcs = [
|
||||
"conformance/conformance_test.cc",
|
||||
"conformance/conformance_test_runner.cc",
|
||||
],
|
||||
hdrs = [
|
||||
"conformance/conformance_test.h",
|
||||
],
|
||||
includes = [
|
||||
"conformance",
|
||||
"src",
|
||||
],
|
||||
deps = [":conformance_proto_cc"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "binary_json_conformance_suite",
|
||||
srcs = ["conformance/binary_json_conformance_suite.cc"],
|
||||
hdrs = ["conformance/binary_json_conformance_suite.h"],
|
||||
deps = [
|
||||
":conformance_test",
|
||||
":jsoncpp",
|
||||
":test_messages_proto2_proto_cc",
|
||||
":test_messages_proto3_proto_cc",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "text_format_conformance_suite",
|
||||
srcs = ["conformance/text_format_conformance_suite.cc"],
|
||||
hdrs = ["conformance/text_format_conformance_suite.h"],
|
||||
deps = [
|
||||
":conformance_test",
|
||||
":test_messages_proto2_proto_cc",
|
||||
":test_messages_proto3_proto_cc",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "conformance_test_runner",
|
||||
srcs = ["conformance/conformance_test_main.cc"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":binary_json_conformance_suite",
|
||||
":conformance_test",
|
||||
":text_format_conformance_suite",
|
||||
],
|
||||
)
|
||||
|
||||
# TODO: re-enable this test if appropriate, or replace with something that
|
||||
# uses the new setup.
|
||||
# sh_test(
|
||||
@ -1231,6 +1158,7 @@ cc_binary(
|
||||
java_proto_library(
|
||||
name = "test_messages_proto2_java_proto",
|
||||
visibility = [
|
||||
"//conformance:__pkg__",
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
deps = [":test_messages_proto2_proto"],
|
||||
@ -1239,83 +1167,30 @@ java_proto_library(
|
||||
java_proto_library(
|
||||
name = "test_messages_proto3_java_proto",
|
||||
visibility = [
|
||||
"//conformance:__pkg__",
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
deps = [":test_messages_proto3_proto"],
|
||||
)
|
||||
|
||||
java_proto_library(
|
||||
name = "conformance_java_proto",
|
||||
visibility = [
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
deps = [":conformance_proto"],
|
||||
)
|
||||
|
||||
java_lite_proto_library(
|
||||
name = "test_messages_proto2_java_proto_lite",
|
||||
visibility = [
|
||||
"//conformance:__pkg__",
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
deps = [":test_messages_proto2_proto"],
|
||||
)
|
||||
|
||||
java_lite_proto_library(
|
||||
name = "conformance_java_proto_lite",
|
||||
visibility = [
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
deps = [":conformance_proto"],
|
||||
)
|
||||
|
||||
java_lite_proto_library(
|
||||
name = "test_messages_proto3_java_proto_lite",
|
||||
visibility = [
|
||||
"//conformance:__pkg__",
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
deps = [":test_messages_proto3_proto"],
|
||||
)
|
||||
|
||||
java_binary(
|
||||
name = "conformance_java",
|
||||
srcs = ["conformance/ConformanceJava.java"],
|
||||
main_class = "ConformanceJava",
|
||||
visibility = [
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
deps = [
|
||||
":conformance_java_proto",
|
||||
":test_messages_proto2_java_proto",
|
||||
":test_messages_proto3_java_proto",
|
||||
"//:protobuf_java",
|
||||
"//:protobuf_java_util",
|
||||
],
|
||||
)
|
||||
|
||||
java_binary(
|
||||
name = "conformance_java_lite",
|
||||
srcs = ["conformance/ConformanceJavaLite.java"],
|
||||
main_class = "ConformanceJavaLite",
|
||||
visibility = [
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
deps = [
|
||||
":conformance_java_proto_lite",
|
||||
":test_messages_proto2_java_proto_lite",
|
||||
":test_messages_proto3_java_proto_lite",
|
||||
"//:protobuf_java_util",
|
||||
"//:protobuf_javalite",
|
||||
],
|
||||
)
|
||||
|
||||
exports_files([
|
||||
"conformance/conformance_test_runner.sh",
|
||||
"conformance/failure_list_java.txt",
|
||||
"conformance/failure_list_java_lite.txt",
|
||||
"conformance/text_format_failure_list_java.txt",
|
||||
"conformance/text_format_failure_list_java_lite.txt",
|
||||
])
|
||||
|
||||
filegroup(
|
||||
name = "bzl_srcs",
|
||||
srcs = glob(["**/*.bzl"]),
|
||||
@ -1416,26 +1291,6 @@ pkg_files(
|
||||
visibility = ["//pkg:__pkg__"],
|
||||
)
|
||||
|
||||
# Conformance tests
|
||||
pkg_files(
|
||||
name = "conformance_dist_files",
|
||||
srcs = glob(
|
||||
["conformance/**/*"],
|
||||
exclude = [
|
||||
# The following are not in autotools dist:
|
||||
"conformance/autoload.php",
|
||||
"conformance/conformance_nodejs.js",
|
||||
"conformance/conformance_test_runner.sh",
|
||||
"conformance/failure_list_java_lite.txt",
|
||||
"conformance/failure_list_jruby.txt",
|
||||
"conformance/text_format_failure_list_*.txt",
|
||||
"conformance/update_failure_list.py",
|
||||
],
|
||||
),
|
||||
strip_prefix = strip_prefix.from_root(""),
|
||||
visibility = ["//pkg:__pkg__"],
|
||||
)
|
||||
|
||||
# C++ runtime
|
||||
pkg_files(
|
||||
name = "cpp_dist_files",
|
||||
|
@ -1254,7 +1254,8 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \
|
||||
examples/list_people.dart \
|
||||
examples/list_people.py \
|
||||
examples/pubspec.yaml \
|
||||
internal.bzl \
|
||||
conformance/BUILD.bazel \
|
||||
conformance/defs.bzl \
|
||||
maven_install.json \
|
||||
php/BUILD.bazel \
|
||||
protobuf.bzl \
|
||||
|
160
conformance/BUILD.bazel
Normal file
160
conformance/BUILD.bazel
Normal file
@ -0,0 +1,160 @@
|
||||
# Conformance testing for Protobuf.
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test", "objc_library", "cc_proto_library")
|
||||
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
|
||||
|
||||
exports_files([
|
||||
"conformance_test_runner.sh",
|
||||
"failure_list_java.txt",
|
||||
"failure_list_java_lite.txt",
|
||||
"text_format_failure_list_java.txt",
|
||||
"text_format_failure_list_java_lite.txt",
|
||||
])
|
||||
|
||||
cc_proto_library(
|
||||
name = "test_messages_proto2_proto_cc",
|
||||
deps = ["//:test_messages_proto2_proto"],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
name = "test_messages_proto3_proto_cc",
|
||||
deps = ["//:test_messages_proto3_proto"],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "conformance_proto",
|
||||
srcs = ["conformance.proto"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
name = "conformance_proto_cc",
|
||||
deps = [":conformance_proto"],
|
||||
)
|
||||
|
||||
java_proto_library(
|
||||
name = "conformance_java_proto",
|
||||
visibility = [
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
deps = [":conformance_proto"],
|
||||
)
|
||||
|
||||
java_lite_proto_library(
|
||||
name = "conformance_java_proto_lite",
|
||||
visibility = [
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
deps = [":conformance_proto"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "jsoncpp",
|
||||
srcs = ["third_party/jsoncpp/jsoncpp.cpp"],
|
||||
hdrs = ["third_party/jsoncpp/json.h"],
|
||||
includes = ["."],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "conformance_test",
|
||||
srcs = [
|
||||
"conformance_test.cc",
|
||||
"conformance_test_runner.cc",
|
||||
],
|
||||
hdrs = [
|
||||
"conformance_test.h",
|
||||
],
|
||||
includes = ["."],
|
||||
deps = [":conformance_proto_cc"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "binary_json_conformance_suite",
|
||||
srcs = ["binary_json_conformance_suite.cc"],
|
||||
hdrs = ["binary_json_conformance_suite.h"],
|
||||
deps = [
|
||||
":conformance_test",
|
||||
":jsoncpp",
|
||||
":test_messages_proto2_proto_cc",
|
||||
":test_messages_proto3_proto_cc",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "text_format_conformance_suite",
|
||||
srcs = ["text_format_conformance_suite.cc"],
|
||||
hdrs = ["text_format_conformance_suite.h"],
|
||||
deps = [
|
||||
":conformance_test",
|
||||
":test_messages_proto2_proto_cc",
|
||||
":test_messages_proto3_proto_cc",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "conformance_test_runner",
|
||||
srcs = ["conformance_test_main.cc"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":binary_json_conformance_suite",
|
||||
":conformance_test",
|
||||
":text_format_conformance_suite",
|
||||
],
|
||||
)
|
||||
|
||||
java_binary(
|
||||
name = "conformance_java",
|
||||
srcs = ["ConformanceJava.java"],
|
||||
main_class = "ConformanceJava",
|
||||
visibility = [
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
deps = [
|
||||
":conformance_java_proto",
|
||||
"//:protobuf_java",
|
||||
"//:protobuf_java_util",
|
||||
"//:test_messages_proto2_java_proto",
|
||||
"//:test_messages_proto3_java_proto",
|
||||
],
|
||||
)
|
||||
|
||||
java_binary(
|
||||
name = "conformance_java_lite",
|
||||
srcs = ["ConformanceJavaLite.java"],
|
||||
main_class = "ConformanceJavaLite",
|
||||
visibility = [
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
deps = [
|
||||
":conformance_java_proto_lite",
|
||||
"//:protobuf_java_util",
|
||||
"//:protobuf_javalite",
|
||||
"//:test_messages_proto2_java_proto_lite",
|
||||
"//:test_messages_proto3_java_proto_lite",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all_files",
|
||||
srcs = glob(["**/*"]),
|
||||
visibility = ["//:__pkg__"],
|
||||
)
|
||||
|
||||
pkg_files(
|
||||
name = "dist_files",
|
||||
srcs = glob(
|
||||
["**/*"],
|
||||
exclude = [
|
||||
# The following are not in autotools dist:
|
||||
"conformance/autoload.php",
|
||||
"conformance/conformance_nodejs.js",
|
||||
"conformance/conformance_test_runner.sh",
|
||||
"conformance/failure_list_java_lite.txt",
|
||||
"conformance/failure_list_jruby.txt",
|
||||
"conformance/text_format_failure_list_*.txt",
|
||||
"conformance/update_failure_list.py",
|
||||
],
|
||||
),
|
||||
strip_prefix = strip_prefix.from_root(""),
|
||||
visibility = ["//pkg:__pkg__"],
|
||||
)
|
@ -40,7 +40,7 @@ while [[ -n "$@" ]]; do
|
||||
esac
|
||||
done
|
||||
|
||||
conformance_test_runner=$(rlocation com_google_protobuf/conformance_test_runner)
|
||||
conformance_test_runner=$(rlocation com_google_protobuf/conformance/conformance_test_runner)
|
||||
conformance_testee=$(rlocation $TESTEE)
|
||||
args=(--enforce_recommended)
|
||||
|
||||
|
@ -12,9 +12,9 @@ def conformance_test(name, testee, failure_list = None, text_format_failure_list
|
||||
|
||||
native.sh_test(
|
||||
name = name,
|
||||
srcs = ["//:conformance/conformance_test_runner.sh"],
|
||||
srcs = ["//conformance:conformance_test_runner.sh"],
|
||||
data = [testee] + failure_lists + [
|
||||
"//:conformance_test_runner",
|
||||
"//conformance:conformance_test_runner",
|
||||
],
|
||||
args = args,
|
||||
deps = [
|
||||
@ -22,8 +22,7 @@ def conformance_test(name, testee, failure_list = None, text_format_failure_list
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
def _strip_bazel(testee):
|
||||
if testee.startswith("//"):
|
||||
testee = testee.replace("//", "com_google_protobuf")
|
||||
testee = testee.replace("//", "com_google_protobuf/")
|
||||
return testee.replace(":", "/")
|
@ -3,7 +3,7 @@ load("@rules_java//java:defs.bzl", "java_library", "java_lite_proto_library", "j
|
||||
load("@rules_jvm_external//:defs.bzl", "java_export")
|
||||
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
|
||||
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library")
|
||||
load("//:internal.bzl", "conformance_test")
|
||||
load("//conformance:defs.bzl", "conformance_test")
|
||||
load("//:protobuf.bzl", "internal_gen_well_known_protos_java")
|
||||
load("//:protobuf_version.bzl", "PROTOBUF_JAVA_VERSION")
|
||||
load("//java/internal:testing.bzl", "junit_tests")
|
||||
@ -295,9 +295,9 @@ build_test(
|
||||
|
||||
conformance_test(
|
||||
name = "conformance_test",
|
||||
failure_list = "//:conformance/failure_list_java.txt",
|
||||
testee = "//:conformance_java",
|
||||
text_format_failure_list = "//:conformance/text_format_failure_list_java.txt",
|
||||
failure_list = "//conformance:failure_list_java.txt",
|
||||
testee = "//conformance:conformance_java",
|
||||
text_format_failure_list = "//conformance:text_format_failure_list_java.txt",
|
||||
)
|
||||
|
||||
junit_tests(
|
||||
|
@ -1,7 +1,7 @@
|
||||
load("@bazel_skylib//rules:build_test.bzl", "build_test")
|
||||
load("@rules_pkg//:mappings.bzl", "pkg_filegroup", "pkg_files", "strip_prefix")
|
||||
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain")
|
||||
load("//:internal.bzl", "conformance_test")
|
||||
load("//conformance:defs.bzl", "conformance_test")
|
||||
load("//java/internal:testing.bzl", "junit_tests")
|
||||
|
||||
exports_files(
|
||||
@ -59,9 +59,9 @@ build_test(
|
||||
|
||||
conformance_test(
|
||||
name = "conformance_test",
|
||||
failure_list = "//:conformance/failure_list_java_lite.txt",
|
||||
testee = "//:conformance_java_lite",
|
||||
text_format_failure_list = "//:conformance/text_format_failure_list_java_lite.txt",
|
||||
failure_list = "//conformance:failure_list_java_lite.txt",
|
||||
testee = "//conformance:conformance_java_lite",
|
||||
text_format_failure_list = "//conformance:text_format_failure_list_java_lite.txt",
|
||||
)
|
||||
|
||||
junit_tests(
|
||||
|
Loading…
Reference in New Issue
Block a user