update coff_dwarf standalone test to new API

and make it still test compilation on non-Windows
This commit is contained in:
Andrew Kelley 2024-08-06 16:33:34 -07:00
parent 2a651eab45
commit d721d9af69
2 changed files with 10 additions and 9 deletions

View file

@ -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

View file

@ -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);
}