Merge pull request #98 from birth-software/disable-non-root-package-tests

Disable non-root package tests
This commit is contained in:
David 2024-02-27 13:53:20 -06:00 committed by GitHub
commit 53f492918e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 5 deletions

View File

@ -3938,7 +3938,7 @@ pub const Builder = struct {
} }
} }
if (unit.descriptor.is_test and count.test_declarations > 0) { if (unit.descriptor.is_test and count.test_declarations > 0 and unit.main_package.? == unit.files.get(builder.current_file).package) {
for (test_declarations.items) |test_declaration_node_index| { for (test_declarations.items) |test_declaration_node_index| {
const test_node = unit.getNode(test_declaration_node_index); const test_node = unit.getNode(test_declaration_node_index);
assert(test_node.id == .test_declaration); assert(test_node.id == .test_declaration);

View File

@ -11,7 +11,6 @@ const TestError = error{
}; };
fn collectDirectoryDirEntries(allocator: Allocator, path: []const u8) ![]const []const u8{ fn collectDirectoryDirEntries(allocator: Allocator, path: []const u8) ![]const []const u8{
std.debug.print("Opening from cwd: {s}\n", .{try std.fs.cwd().realpathAlloc(allocator, ".")});
var dir = try std.fs.cwd().openDir(path, .{ var dir = try std.fs.cwd().openDir(path, .{
.iterate = true, .iterate = true,
}); });
@ -45,7 +44,7 @@ fn runStandalone(allocator: Allocator, args: struct {
var failed_test_count: usize = 0; var failed_test_count: usize = 0;
const total_test_count = test_names.len; const total_test_count = test_names.len;
std.debug.print("[{s} START]\n", .{args.group_name}); std.debug.print("\n[{s} START]\n\n", .{args.group_name});
for (test_names) |test_name| { for (test_names) |test_name| {
std.debug.print("{s}... ", .{test_name}); std.debug.print("{s}... ", .{test_name});
@ -290,7 +289,6 @@ fn runBuildTests(allocator: Allocator) !void {
} }
pub fn main() !void { pub fn main() !void {
std.debug.print("\n",.{});
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
const allocator = arena.allocator(); const allocator = arena.allocator();
try runStandalone(allocator, .{ try runStandalone(allocator, .{
@ -301,7 +299,7 @@ pub fn main() !void {
try runBuildTests(allocator); try runBuildTests(allocator);
try runStandalone(allocator, .{ try runStandalone(allocator, .{
.directory_path = "test/tests", .directory_path = "test/tests",
.group_name = "TESTS", .group_name = "TEST EXECUTABLE",
.is_test = true, .is_test = true,
}); });
} }

View File

@ -2,6 +2,13 @@ comptime {
_ = start; _ = start;
} }
test {
_ = build;
_ = builtin;
_ = os;
_ = start;
}
const build = #import("build.nat"); const build = #import("build.nat");
const builtin = #import("builtin.nat"); const builtin = #import("builtin.nat");
const os = #import("os.nat"); const os = #import("os.nat");