@@ -195,41 +195,76 @@ pub fn build(b: *Build) !void {
195195 libgrpc .installHeadersDirectory (upstream .path ("include/grpc" ), "grpc" , .{});
196196 b .installArtifact (libgrpc );
197197
198- // Googletest library
199- const gtestmod = b .createModule (.{
200- .target = target ,
201- .optimize = optimize ,
202- .link_libcpp = true ,
203- });
204- const libgtest = b .addLibrary (.{ .name = "gtest" , .root_module = gtestmod });
205- gtestmod .addCSourceFiles (.{
206- .root = gtest .path ("googletest/src" ),
207- .files = & gtest_srcs ,
208- .flags = & cxx_flags ,
209- });
210- gtestmod .addIncludePath (gtest .path ("googletest/include" ));
211- gtestmod .addIncludePath (gtest .path ("googletest" ));
212- libgtest .installHeadersDirectory (gtest .path ("googletest/include" ), "" , .{});
213-
214198 { // Build tests to ensure no symbols are missing
215199 const example_step = b .step ("examples" , "Build example programs" );
216200 const test_step = b .step ("test" , "Run test programs" );
217201
202+ // Googletest library
203+ const gtestmod = b .createModule (.{
204+ .target = target ,
205+ .optimize = optimize ,
206+ .link_libcpp = true ,
207+ });
208+ const libgtest = b .addLibrary (.{ .name = "gtest" , .root_module = gtestmod });
209+ gtestmod .addCSourceFiles (.{
210+ .root = gtest .path ("googletest/src" ),
211+ .files = & gtest_srcs ,
212+ .flags = & cxx_flags ,
213+ });
214+ gtestmod .addIncludePath (gtest .path ("googletest/include" ));
215+ gtestmod .addIncludePath (gtest .path ("googletest" ));
216+ libgtest .installHeadersDirectory (gtest .path ("googletest/include" ), "" , .{});
217+
218+ // const testutilbasemod = b.createModule(.{
219+ // .target = target,
220+ // .optimize = optimize,
221+ // .link_libcpp = true,
222+ // });
223+ // const libtestutilbase = b.addLibrary(.{ .name = "grpc_test_util_base", .root_module = testutilbasemod });
224+ // testutilbasemod.addCSourceFiles(.{
225+ // .root = upstream.path("test/core/test_util"),
226+ // .files = &grpc_test_util_base.srcs,
227+ // .flags = &cxx_flags,
228+ // });
229+ // testutilbasemod.addIncludePath(upstream.path(""));
230+ // testutilbasemod.linkLibrary(libgrpc);
231+ // libtestutilbase.installHeadersDirectory(upstream.path("test/core/test_util"), "", .{
232+ // .include_extensions = &grpc_test_util_base.hdrs,
233+ // });
234+
235+ // const testutilmod = b.createModule(.{
236+ // .target = target,
237+ // .optimize = optimize,
238+ // .link_libcpp = true,
239+ // });
240+ // const libtestutil = b.addLibrary(.{ .name = "grpc_test_util", .root_module = testutilmod });
241+ // testutilmod.addCSourceFiles(.{
242+ // .root = upstream.path("test/core/test_util"),
243+ // .files = &grpc_test_util.srcs,
244+ // .flags = &cxx_flags,
245+ // });
246+ // testutilmod.addIncludePath(upstream.path(""));
247+ // testutilmod.addIncludePath(upstream.path("src/core/ext/upb-gen"));
248+ // testutilmod.addIncludePath(upstream.path("src/core/ext/upbdefs-gen"));
249+ // testutilmod.linkLibrary(libtestutilbase);
250+ // libtestutilbase.installHeadersDirectory(upstream.path("test/core/test_util"), "", .{
251+ // .include_extensions = &grpc_test_util.hdrs,
252+ // });
253+
218254 var tests : ExecutableList = try .initCapacity (b .allocator , 64 );
255+ defer tests .deinit (b .allocator );
219256
220257 {
221- const client_idle = b .createModule (.{
258+ const mod = b .createModule (.{
222259 .target = target ,
223260 .optimize = optimize ,
224261 .link_libcpp = true ,
225262 });
226- client_idle .addCSourceFile (.{
263+ mod .addCSourceFile (.{
227264 .file = upstream .path ("test/core/client_idle/idle_filter_state_test.cc" ),
228265 .flags = & cxx_flags ,
229266 });
230- client_idle .addIncludePath (upstream .path ("" ));
231- client_idle .linkLibrary (libgtest );
232- try tests .append (b .allocator , .{ .name = "idle_filter_state" , .mod = client_idle });
267+ tests .appendAssumeCapacity (.{ .name = "idle_filter_state" , .mod = mod });
233268 }
234269 {
235270 const mod = b .createModule (.{
@@ -238,20 +273,35 @@ pub fn build(b: *Build) !void {
238273 .link_libcpp = true ,
239274 });
240275 mod .addCSourceFile (.{
241- .file = upstream .path ("test/core/slice/c_slice_buffer_test .cc" ),
276+ .file = upstream .path ("test/core/config/core_configuration_test .cc" ),
242277 .flags = & cxx_flags ,
243278 });
244- mod .addIncludePath (upstream .path ("" ));
245- mod .linkLibrary ( libgtest );
279+ mod .addIncludePath (upstream .path ("src/core/ext/upb-gen " ));
280+ mod .addIncludePath ( upstream . path ( "src/core/ext/upbdefs-gen" ) );
246281 mod .linkLibrary (libabseil );
247- try tests .append (b .allocator , .{ .name = "c_slice_buffer" , .mod = mod });
282+ tests .appendAssumeCapacity (.{ .name = "core_configuration" , .mod = mod });
283+ }
284+ {
285+ const mod = b .createModule (.{
286+ .target = target ,
287+ .optimize = optimize ,
288+ .link_libcpp = true ,
289+ });
290+ mod .addCSourceFile (.{
291+ .file = upstream .path ("test/core/config/load_config_test.cc" ),
292+ .flags = & cxx_flags ,
293+ });
294+ mod .linkLibrary (libabseil );
295+ tests .appendAssumeCapacity (.{ .name = "load_config" , .mod = mod });
248296 }
249297
250298 for (tests .items ) | ite | {
251299 const exe = b .addExecutable (.{ .name = ite .name , .root_module = ite .mod });
252300 const install_exe = b .addInstallArtifact (exe , .{});
253301 const run_exe = b .addRunArtifact (exe );
302+ ite .mod .addIncludePath (upstream .path ("" ));
254303 ite .mod .linkLibrary (libgrpc );
304+ ite .mod .linkLibrary (libgtest );
255305 example_step .dependOn (& install_exe .step );
256306 test_step .dependOn (& run_exe .step );
257307 }
@@ -290,3 +340,55 @@ const gtest_srcs = .{
290340 "gtest-typed-test.cc" ,
291341 "gtest.cc" ,
292342};
343+
344+ // const grpc_test_util_base = struct {
345+ // pub const srcs = .{
346+ // "cmdline.cc",
347+ // "grpc_profiler.cc",
348+ // "histogram.cc",
349+ // "mock_endpoint.cc",
350+ // "parse_hexstring.cc",
351+ // "resolve_localhost_ip46.cc",
352+ // "slice_splitter.cc",
353+ // "tracer_util.cc",
354+ // };
355+
356+ // pub const hdrs = .{
357+ // "cmdline.h",
358+ // "evaluate_args_test_util.h",
359+ // "grpc_profiler.h",
360+ // "histogram.h",
361+ // "mock_endpoint.h",
362+ // "parse_hexstring.h",
363+ // "resolve_localhost_ip46.h",
364+ // "slice_splitter.h",
365+ // "tracer_util.h",
366+ // };
367+ // };
368+
369+ // const grpc_test_util = struct {
370+ // pub const srcs = .{
371+ // "port.cc",
372+ // "port_ci.cc",
373+ // "port_server_client.cc",
374+ // "reconnect_server.cc",
375+ // "test_config.cc",
376+ // "test_tcp_server.cc",
377+ // "tls_utils.cc",
378+ // } ++ .{
379+ // "stack_tracer.cc",
380+ // "build.cc",
381+ // };
382+
383+ // pub const hdrs = .{
384+ // "port.h",
385+ // "reconnect_server.h",
386+ // "port_server_client.h",
387+ // "test_config.h",
388+ // "test_tcp_server.h",
389+ // "tls_utils.h",
390+ // } ++ .{
391+ // "stack_tracer.h",
392+ // "build.h",
393+ // };
394+ // };
0 commit comments