1 // Copyright 2022 gRPC authors.
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
15 #include <string>
16 #include <vector>
17
18 #include "absl/functional/any_invocable.h"
19 #include "absl/strings/str_cat.h"
20 #include "absl/types/optional.h"
21 #include "gtest/gtest.h"
22 #include "src/core/config/config_vars.h"
23 #include "test/core/end2end/end2end_tests.h"
24 #include "test/core/end2end/fixtures/h2_tls_common.h"
25 #include "test/core/test_util/test_config.h"
26
27 namespace grpc_core {
28 extern void EnsureSuitesLinked();
29 }
30
main(int argc,char ** argv)31 int main(int argc, char** argv) {
32 grpc::testing::TestEnvironment env(&argc, argv);
33 grpc_core::EnsureSuitesLinked();
34 ::testing::InitGoogleTest(&argc, argv);
35 // TODO(ctiller): make this per fixture?
36 grpc_core::ConfigVars::Overrides overrides;
37 overrides.default_ssl_roots_file_path = CA_CERT_PATH;
38 grpc_core::ConfigVars::SetOverrides(overrides);
39 const auto all_tests = grpc_core::CoreEnd2endTestRegistry::Get().AllTests();
40 for (const auto& test : all_tests) {
41 ::testing::RegisterTest(
42 absl::StrCat(test.suite).c_str(),
43 absl::StrCat(test.name, "/", test.config->name).c_str(), nullptr,
44 nullptr, __FILE__, __LINE__,
45 [test = &test]() -> grpc_core::CoreEnd2endTest* {
46 return test->make_test(test->config);
47 });
48 }
49 return RUN_ALL_TESTS();
50 }
51