@@ -606,7 +606,6 @@ pub const TestContext = struct {
606606 output_mode : std.builtin.OutputMode ,
607607 optimize_mode : std.builtin.Mode = .Debug ,
608608 updates : std .ArrayList (Update ),
609- object_format : ? std.Target.ObjectFormat = null ,
610609 emit_h : bool = false ,
611610 is_test : bool = false ,
612611 expect_exact : bool = false ,
@@ -782,12 +781,13 @@ pub const TestContext = struct {
782781 pub fn exeFromCompiledC (ctx : * TestContext , name : []const u8 , target : CrossTarget ) * Case {
783782 const prefixed_name = std .fmt .allocPrint (ctx .arena , "CBE: {s}" , .{name }) catch
784783 @panic ("out of memory" );
784+ var target_adjusted = target ;
785+ target_adjusted .ofmt = std .Target .ObjectFormat .c ;
785786 ctx .cases .append (Case {
786787 .name = prefixed_name ,
787- .target = target ,
788+ .target = target_adjusted ,
788789 .updates = std .ArrayList (Update ).init (ctx .cases .allocator ),
789790 .output_mode = .Exe ,
790- .object_format = .c ,
791791 .files = std .ArrayList (File ).init (ctx .arena ),
792792 }) catch @panic ("out of memory" );
793793 return & ctx .cases .items [ctx .cases .items .len - 1 ];
@@ -851,12 +851,13 @@ pub const TestContext = struct {
851851
852852 /// Adds a test case for Zig or ZIR input, producing C code.
853853 pub fn addC (ctx : * TestContext , name : []const u8 , target : CrossTarget ) * Case {
854+ var target_adjusted = target ;
855+ target_adjusted .ofmt = std .Target .ObjectFormat .c ;
854856 ctx .cases .append (Case {
855857 .name = name ,
856- .target = target ,
858+ .target = target_adjusted ,
857859 .updates = std .ArrayList (Update ).init (ctx .cases .allocator ),
858860 .output_mode = .Obj ,
859- .object_format = .c ,
860861 .files = std .ArrayList (File ).init (ctx .arena ),
861862 }) catch @panic ("out of memory" );
862863 return & ctx .cases .items [ctx .cases .items .len - 1 ];
@@ -1501,7 +1502,6 @@ pub const TestContext = struct {
15011502 .root_name = "test_case" ,
15021503 .target = target ,
15031504 .output_mode = case .output_mode ,
1504- .object_format = case .object_format ,
15051505 });
15061506
15071507 const emit_directory : Compilation.Directory = .{
@@ -1537,7 +1537,6 @@ pub const TestContext = struct {
15371537 .emit_h = emit_h ,
15381538 .main_pkg = & main_pkg ,
15391539 .keep_source_files_loaded = true ,
1540- .object_format = case .object_format ,
15411540 .is_native_os = case .target .isNativeOs (),
15421541 .is_native_abi = case .target .isNativeAbi (),
15431542 .dynamic_linker = target_info .dynamic_linker .get (),
@@ -1782,7 +1781,7 @@ pub const TestContext = struct {
17821781 ".." ++ ss ++ "{s}" ++ ss ++ "{s}" ,
17831782 .{ & tmp .sub_path , bin_name },
17841783 );
1785- if (case .object_format != null and case .object_format .? == .c ) {
1784+ if (case .target . ofmt != null and case .target . ofmt .? == .c ) {
17861785 if (host .getExternalExecutor (target_info , .{ .link_libc = true }) != .native ) {
17871786 // We wouldn't be able to run the compiled C code.
17881787 continue :update ; // Pass test.
0 commit comments