@@ -606,7 +606,6 @@ pub const TestContext = struct {
606
606
output_mode : std.builtin.OutputMode ,
607
607
optimize_mode : std.builtin.Mode = .Debug ,
608
608
updates : std .ArrayList (Update ),
609
- object_format : ? std.Target.ObjectFormat = null ,
610
609
emit_h : bool = false ,
611
610
is_test : bool = false ,
612
611
expect_exact : bool = false ,
@@ -782,12 +781,13 @@ pub const TestContext = struct {
782
781
pub fn exeFromCompiledC (ctx : * TestContext , name : []const u8 , target : CrossTarget ) * Case {
783
782
const prefixed_name = std .fmt .allocPrint (ctx .arena , "CBE: {s}" , .{name }) catch
784
783
@panic ("out of memory" );
784
+ var target_adjusted = target ;
785
+ target_adjusted .ofmt = std .Target .ObjectFormat .c ;
785
786
ctx .cases .append (Case {
786
787
.name = prefixed_name ,
787
- .target = target ,
788
+ .target = target_adjusted ,
788
789
.updates = std .ArrayList (Update ).init (ctx .cases .allocator ),
789
790
.output_mode = .Exe ,
790
- .object_format = .c ,
791
791
.files = std .ArrayList (File ).init (ctx .arena ),
792
792
}) catch @panic ("out of memory" );
793
793
return & ctx .cases .items [ctx .cases .items .len - 1 ];
@@ -851,12 +851,13 @@ pub const TestContext = struct {
851
851
852
852
/// Adds a test case for Zig or ZIR input, producing C code.
853
853
pub fn addC (ctx : * TestContext , name : []const u8 , target : CrossTarget ) * Case {
854
+ var target_adjusted = target ;
855
+ target_adjusted .ofmt = std .Target .ObjectFormat .c ;
854
856
ctx .cases .append (Case {
855
857
.name = name ,
856
- .target = target ,
858
+ .target = target_adjusted ,
857
859
.updates = std .ArrayList (Update ).init (ctx .cases .allocator ),
858
860
.output_mode = .Obj ,
859
- .object_format = .c ,
860
861
.files = std .ArrayList (File ).init (ctx .arena ),
861
862
}) catch @panic ("out of memory" );
862
863
return & ctx .cases .items [ctx .cases .items .len - 1 ];
@@ -1501,7 +1502,6 @@ pub const TestContext = struct {
1501
1502
.root_name = "test_case" ,
1502
1503
.target = target ,
1503
1504
.output_mode = case .output_mode ,
1504
- .object_format = case .object_format ,
1505
1505
});
1506
1506
1507
1507
const emit_directory : Compilation.Directory = .{
@@ -1537,7 +1537,6 @@ pub const TestContext = struct {
1537
1537
.emit_h = emit_h ,
1538
1538
.main_pkg = & main_pkg ,
1539
1539
.keep_source_files_loaded = true ,
1540
- .object_format = case .object_format ,
1541
1540
.is_native_os = case .target .isNativeOs (),
1542
1541
.is_native_abi = case .target .isNativeAbi (),
1543
1542
.dynamic_linker = target_info .dynamic_linker .get (),
@@ -1782,7 +1781,7 @@ pub const TestContext = struct {
1782
1781
".." ++ ss ++ "{s}" ++ ss ++ "{s}" ,
1783
1782
.{ & tmp .sub_path , bin_name },
1784
1783
);
1785
- if (case .object_format != null and case .object_format .? == .c ) {
1784
+ if (case .target . ofmt != null and case .target . ofmt .? == .c ) {
1786
1785
if (host .getExternalExecutor (target_info , .{ .link_libc = true }) != .native ) {
1787
1786
// We wouldn't be able to run the compiled C code.
1788
1787
continue :update ; // Pass test.
0 commit comments