Skip to content

Commit d6e07e2

Browse files
committed
Build and run 2 more tests
1 parent b3bc7ca commit d6e07e2

File tree

1 file changed

+31
-35
lines changed

1 file changed

+31
-35
lines changed

build.zig

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,19 @@ pub fn build(b: *Build) !void {
215215
gtestmod.addIncludePath(gtest.path("googletest"));
216216
libgtest.installHeadersDirectory(gtest.path("googletest/include"), "", .{});
217217

218+
// test_util:build
219+
const testbuildmod = b.createModule(.{
220+
.target = target,
221+
.optimize = optimize,
222+
.link_libcpp = true,
223+
});
224+
const libtestbuild = b.addLibrary(.{ .name = "test_util_build", .root_module = testbuildmod });
225+
testbuildmod.addCSourceFile(.{
226+
.file = upstream.path("test/core/test_util/build.cc"),
227+
.flags = &cxx_flags,
228+
});
229+
libtestbuild.installHeader(upstream.path("test/core/test_util/build.h"), "build.h");
230+
218231
// const testutilbasemod = b.createModule(.{
219232
// .target = target,
220233
// .optimize = optimize,
@@ -255,45 +268,33 @@ pub fn build(b: *Build) !void {
255268
defer tests.deinit(b.allocator);
256269

257270
{
258-
const mod = b.createModule(.{
259-
.target = target,
260-
.optimize = optimize,
261-
.link_libcpp = true,
262-
});
263-
mod.addCSourceFile(.{
264-
.file = upstream.path("test/core/client_idle/idle_filter_state_test.cc"),
265-
.flags = &cxx_flags,
266-
});
271+
const mod = b.createModule(.{ .target = target, .optimize = optimize, .link_libcpp = true });
272+
mod.addCSourceFile(.{ .file = upstream.path("test/core/client_idle/idle_filter_state_test.cc"), .flags = &cxx_flags });
267273
tests.appendAssumeCapacity(.{ .name = "idle_filter_state", .mod = mod });
268274
}
269275
{
270-
const mod = b.createModule(.{
271-
.target = target,
272-
.optimize = optimize,
273-
.link_libcpp = true,
274-
});
275-
mod.addCSourceFile(.{
276-
.file = upstream.path("test/core/config/core_configuration_test.cc"),
277-
.flags = &cxx_flags,
278-
});
276+
const mod = b.createModule(.{ .target = target, .optimize = optimize, .link_libcpp = true });
277+
mod.addCSourceFile(.{ .file = upstream.path("test/core/config/core_configuration_test.cc"), .flags = &cxx_flags });
279278
mod.addIncludePath(upstream.path("src/core/ext/upb-gen"));
280279
mod.addIncludePath(upstream.path("src/core/ext/upbdefs-gen"));
281-
mod.linkLibrary(libabseil);
282280
tests.appendAssumeCapacity(.{ .name = "core_configuration", .mod = mod });
283281
}
284282
{
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);
283+
const mod = b.createModule(.{ .target = target, .optimize = optimize, .link_libcpp = true });
284+
mod.addCSourceFile(.{ .file = upstream.path("test/core/config/load_config_test.cc"), .flags = &cxx_flags });
295285
tests.appendAssumeCapacity(.{ .name = "load_config", .mod = mod });
296286
}
287+
{
288+
const mod = b.createModule(.{ .target = target, .optimize = optimize, .link_libcpp = true });
289+
mod.addCSourceFile(.{ .file = upstream.path("test/core/slice/slice_string_helpers_test.cc"), .flags = &cxx_flags });
290+
tests.appendAssumeCapacity(.{ .name = "slice_string_helpers", .mod = mod });
291+
}
292+
{
293+
const mod = b.createModule(.{ .target = target, .optimize = optimize, .link_libcpp = true });
294+
mod.addCSourceFile(.{ .file = upstream.path("test/core/slice/slice_test.cc"), .flags = &cxx_flags });
295+
mod.linkLibrary(libtestbuild);
296+
tests.appendAssumeCapacity(.{ .name = "slice", .mod = mod });
297+
}
297298

298299
for (tests.items) |ite| {
299300
const exe = b.addExecutable(.{ .name = ite.name, .root_module = ite.mod });
@@ -302,6 +303,7 @@ pub fn build(b: *Build) !void {
302303
ite.mod.addIncludePath(upstream.path(""));
303304
ite.mod.linkLibrary(libgrpc);
304305
ite.mod.linkLibrary(libgtest);
306+
ite.mod.linkLibrary(libabseil);
305307
example_step.dependOn(&install_exe.step);
306308
test_step.dependOn(&run_exe.step);
307309
}
@@ -375,9 +377,6 @@ const gtest_srcs = .{
375377
// "test_config.cc",
376378
// "test_tcp_server.cc",
377379
// "tls_utils.cc",
378-
// } ++ .{
379-
// "stack_tracer.cc",
380-
// "build.cc",
381380
// };
382381

383382
// pub const hdrs = .{
@@ -387,8 +386,5 @@ const gtest_srcs = .{
387386
// "test_config.h",
388387
// "test_tcp_server.h",
389388
// "tls_utils.h",
390-
// } ++ .{
391-
// "stack_tracer.h",
392-
// "build.h",
393389
// };
394390
// };

0 commit comments

Comments
 (0)