| ... | @@ -51,6 +51,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { | ... | @@ -51,6 +51,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { |
| 51 | macho_step.dependOn(testRelocatableZig(b, .{ .target = default_target })); | 51 | macho_step.dependOn(testRelocatableZig(b, .{ .target = default_target })); |
| 52 | macho_step.dependOn(testSectionBoundarySymbols(b, .{ .target = default_target })); | 52 | macho_step.dependOn(testSectionBoundarySymbols(b, .{ .target = default_target })); |
| 53 | macho_step.dependOn(testSegmentBoundarySymbols(b, .{ .target = default_target })); | 53 | macho_step.dependOn(testSegmentBoundarySymbols(b, .{ .target = default_target })); |
| | 54 | macho_step.dependOn(testSymbolStabs(b, .{ .target = default_target })); |
| 54 | macho_step.dependOn(testStackSize(b, .{ .target = default_target })); | 55 | macho_step.dependOn(testStackSize(b, .{ .target = default_target })); |
| 55 | macho_step.dependOn(testTentative(b, .{ .target = default_target })); | 56 | macho_step.dependOn(testTentative(b, .{ .target = default_target })); |
| 56 | macho_step.dependOn(testThunks(b, .{ .target = aarch64_target })); | 57 | macho_step.dependOn(testThunks(b, .{ .target = aarch64_target })); |
| ... | @@ -1993,6 +1994,54 @@ fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step { | ... | @@ -1993,6 +1994,54 @@ fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step { |
| 1993 | return test_step; | 1994 | return test_step; |
| 1994 | } | 1995 | } |
| 1995 | | 1996 | |
| | 1997 | fn testSymbolStabs(b: *Build, opts: Options) *Step { |
| | 1998 | const test_step = addTestStep(b, "symbol-stabs", opts); |
| | 1999 | |
| | 2000 | const a_o = addObject(b, opts, .{ .name = "a", .c_source_bytes = |
| | 2001 | \\int foo = 42; |
| | 2002 | \\int getFoo() { |
| | 2003 | \\ return foo; |
| | 2004 | \\} |
| | 2005 | }); |
| | 2006 | |
| | 2007 | const b_o = addObject(b, opts, .{ .name = "b", .c_source_bytes = |
| | 2008 | \\int bar = 24; |
| | 2009 | \\int getBar() { |
| | 2010 | \\ return bar; |
| | 2011 | \\} |
| | 2012 | }); |
| | 2013 | |
| | 2014 | const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes = |
| | 2015 | \\#include <stdio.h> |
| | 2016 | \\extern int getFoo(); |
| | 2017 | \\extern int getBar(); |
| | 2018 | \\int main() { |
| | 2019 | \\ printf("foo=%d,bar=%d", getFoo(), getBar()); |
| | 2020 | \\ return 0; |
| | 2021 | \\} |
| | 2022 | }); |
| | 2023 | |
| | 2024 | const exe = addExecutable(b, opts, .{ .name = "main" }); |
| | 2025 | exe.addObject(a_o); |
| | 2026 | exe.addObject(b_o); |
| | 2027 | exe.addObject(main_o); |
| | 2028 | |
| | 2029 | const run = addRunArtifact(exe); |
| | 2030 | run.expectStdOutEqual("foo=42,bar=24"); |
| | 2031 | test_step.dependOn(&run.step); |
| | 2032 | |
| | 2033 | const check = exe.checkObject(); |
| | 2034 | check.checkInSymtab(); |
| | 2035 | check.checkContains("a.o"); // TODO we really should do a fuzzy search like OSO <ignore>/a.o |
| | 2036 | check.checkInSymtab(); |
| | 2037 | check.checkContains("b.o"); |
| | 2038 | check.checkInSymtab(); |
| | 2039 | check.checkContains("main.o"); |
| | 2040 | test_step.dependOn(&check.step); |
| | 2041 | |
| | 2042 | return test_step; |
| | 2043 | } |
| | 2044 | |
| 1996 | fn testStackSize(b: *Build, opts: Options) *Step { | 2045 | fn testStackSize(b: *Build, opts: Options) *Step { |
| 1997 | const test_step = addTestStep(b, "stack-size", opts); | 2046 | const test_step = addTestStep(b, "stack-size", opts); |
| 1998 | | 2047 | |