xref: /aosp_15_r20/external/federated-compute/fcp/testing/BUILD (revision 14675a029014e728ec732f129a32e299b2da0601)
1# Copyright 2019 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15load("//fcp:config.bzl", "FCP_COPTS")
16load("//fcp/tracing:build_defs.bzl", "tracing_schema_cc_library")
17
18package(
19    default_visibility = ["//fcp:internal"],
20    licenses = ["notice"],  # Apache 2.0
21)
22
23tracing_schema_cc_library(
24    name = "tracing_schema",
25    srcs = ["tracing_schema.fbs"],
26)
27
28cc_library(
29    name = "result_matchers",
30    testonly = True,
31    srcs = [
32    ],
33    hdrs = [
34        "result_matchers.h",
35    ],
36    copts = FCP_COPTS,
37    deps = [
38        "//fcp/base:error",
39        "//fcp/base:result",
40        "@com_google_googletest//:gtest",
41    ],
42)
43
44cc_library(
45    name = "parse_text_proto",
46    testonly = 1,
47    hdrs = ["parse_text_proto.h"],
48    copts = FCP_COPTS,
49    deps = [
50        "//fcp/base",
51        "@com_google_absl//absl/strings",
52        "@com_google_protobuf//:protobuf",
53    ],
54)
55
56cc_library(
57    name = "testing",
58    testonly = 1,
59    srcs = ["testing.cc"],
60    hdrs = ["testing.h"],
61    copts = FCP_COPTS,
62    deps = [
63        ":parse_text_proto",
64        ":result_matchers",
65        ":tracing_schema",
66        "//fcp/base",
67        "//fcp/base:error",
68        "//fcp/base:result",
69        "//fcp/base:source_location",
70        "//fcp/tracing",
71        "@com_google_absl//absl/flags:flag",
72        "@com_google_absl//absl/status",
73        "@com_google_absl//absl/strings",
74        "@com_google_googletest//:gtest",
75        "@com_google_protobuf//:protobuf",
76    ],
77)
78
79cc_test(
80    name = "result_matchers_test",
81    srcs = [
82        "result_matchers_test.cc",
83    ],
84    copts = FCP_COPTS,
85    deps = [
86        ":result_matchers",
87        ":testing",
88        "//fcp/base:error",
89        "//fcp/base:result",
90        "//fcp/base:tracing_schema",
91        "//fcp/tracing:test_tracing_recorder",
92        "@com_google_googletest//:gtest_main",
93    ],
94)
95
96cc_test(
97    name = "testing_test",
98    size = "small",
99    srcs = ["testing_test.cc"],
100    args = ["--baseline_path=$(location :testdata/verify_baseline_test.baseline)"],
101    copts = FCP_COPTS,
102    data = [":testdata/verify_baseline_test.baseline"],
103    deps = [
104        ":test_messages_cc_proto",
105        ":testing",
106        "//fcp/base",
107        "@com_google_absl//absl/flags:flag",
108        "@com_google_googletest//:gtest_main",
109    ],
110)
111
112proto_library(
113    name = "test_messages_proto",
114    srcs = ["test_messages.proto"],
115)
116
117cc_proto_library(
118    name = "test_messages_cc_proto",
119    deps = [":test_messages_proto"],
120)
121