Commit d721d9af69

Andrew Kelley <andrew@ziglang.org>
2024-08-07 01:33:34
update coff_dwarf standalone test to new API
and make it still test compilation on non-Windows
1 parent 2a651ea
Changed files (2)
test
standalone
test/standalone/coff_dwarf/build.zig
@@ -7,9 +7,10 @@ pub fn build(b: *std.Build) void {
     b.default_step = test_step;
 
     const optimize: std.builtin.OptimizeMode = .Debug;
-    const target = b.standardTargetOptions(.{});
-
-    if (builtin.os.tag != .windows) return;
+    const target = if (builtin.os.tag == .windows)
+        b.standardTargetOptions(.{})
+    else
+        b.resolveTargetQuery(.{ .os_tag = .windows });
 
     if (builtin.cpu.arch == .aarch64) {
         // https://github.com/ziglang/zig/issues/18427
test/standalone/coff_dwarf/main.zig
@@ -17,11 +17,11 @@ pub fn main() !void {
 
     const module = try debug_info.getModuleForAddress(add_addr);
     const symbol = try module.getSymbolAtAddress(allocator, add_addr);
-    defer symbol.deinit(allocator);
+    defer if (symbol.source_location) |sl| allocator.free(sl.file_name);
 
-    try testing.expectEqualStrings("add", symbol.symbol_name);
-    try testing.expect(symbol.line_info != null);
-    try testing.expectEqualStrings("shared_lib.c", std.fs.path.basename(symbol.line_info.?.file_name));
-    try testing.expectEqual(@as(u64, 3), symbol.line_info.?.line);
-    try testing.expectEqual(@as(u64, 0), symbol.line_info.?.column);
+    try testing.expectEqualStrings("add", symbol.name);
+    try testing.expect(symbol.source_location != null);
+    try testing.expectEqualStrings("shared_lib.c", std.fs.path.basename(symbol.source_location.?.file_name));
+    try testing.expectEqual(@as(u64, 3), symbol.source_location.?.line);
+    try testing.expectEqual(@as(u64, 0), symbol.source_location.?.column);
 }