xref: /aosp_15_r20/external/grpc-grpc/test/core/util/fuzz_config_vars.cc (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1 // Copyright 2023 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 //
16 // Automatically generated by tools/codegen/core/gen_config_vars.py
17 //
18 
19 #include "test/core/util/fuzz_config_vars.h"
20 
21 #include "test/core/util/fuzz_config_vars_helpers.h"
22 
23 namespace grpc_core {
24 
OverridesFromFuzzConfigVars(const grpc::testing::FuzzConfigVars & vars)25 ConfigVars::Overrides OverridesFromFuzzConfigVars(
26     const grpc::testing::FuzzConfigVars& vars) {
27   ConfigVars::Overrides overrides;
28   if (vars.has_enable_fork_support()) {
29     overrides.enable_fork_support = vars.enable_fork_support();
30   }
31   if (vars.has_dns_resolver()) {
32     overrides.dns_resolver = vars.dns_resolver();
33   }
34   if (vars.has_verbosity()) {
35     overrides.verbosity = vars.verbosity();
36   }
37   if (vars.has_stacktrace_minloglevel()) {
38     overrides.stacktrace_minloglevel = vars.stacktrace_minloglevel();
39   }
40   if (vars.has_experiments()) {
41     overrides.experiments =
42         ValidateExperimentsStringForFuzzing(vars.experiments());
43   }
44   if (vars.has_trace()) {
45     overrides.trace = vars.trace();
46   }
47   return overrides;
48 }
ApplyFuzzConfigVars(const grpc::testing::FuzzConfigVars & vars)49 void ApplyFuzzConfigVars(const grpc::testing::FuzzConfigVars& vars) {
50   ConfigVars::SetOverrides(OverridesFromFuzzConfigVars(vars));
51 }
52 
53 }  // namespace grpc_core
54