| ... | @@ -88,6 +88,8 @@ pub const Case = struct { | ... | @@ -88,6 +88,8 @@ pub const Case = struct { |
| 88 | expect_exact: bool = false, | 88 | expect_exact: bool = false, |
| 89 | backend: Backend = .stage2, | 89 | backend: Backend = .stage2, |
| 90 | link_libc: bool = false, | 90 | link_libc: bool = false, |
| | 91 | pic: ?bool = null, |
| | 92 | pie: ?bool = null, |
| 91 | | 93 | |
| 92 | deps: std.ArrayList(DepModule), | 94 | deps: std.ArrayList(DepModule), |
| 93 | | 95 | |
| ... | @@ -425,6 +427,8 @@ fn addFromDirInner( | ... | @@ -425,6 +427,8 @@ fn addFromDirInner( |
| 425 | const is_test = try manifest.getConfigForKeyAssertSingle("is_test", bool); | 427 | const is_test = try manifest.getConfigForKeyAssertSingle("is_test", bool); |
| 426 | const link_libc = try manifest.getConfigForKeyAssertSingle("link_libc", bool); | 428 | const link_libc = try manifest.getConfigForKeyAssertSingle("link_libc", bool); |
| 427 | const output_mode = try manifest.getConfigForKeyAssertSingle("output_mode", std.builtin.OutputMode); | 429 | const output_mode = try manifest.getConfigForKeyAssertSingle("output_mode", std.builtin.OutputMode); |
| | 430 | const pic = try manifest.getConfigForKeyAssertSingle("pic", ?bool); |
| | 431 | const pie = try manifest.getConfigForKeyAssertSingle("pie", ?bool); |
| 428 | | 432 | |
| 429 | if (manifest.type == .translate_c) { | 433 | if (manifest.type == .translate_c) { |
| 430 | for (c_frontends) |c_frontend| { | 434 | for (c_frontends) |c_frontend| { |
| ... | @@ -488,6 +492,8 @@ fn addFromDirInner( | ... | @@ -488,6 +492,8 @@ fn addFromDirInner( |
| 488 | .is_test = is_test, | 492 | .is_test = is_test, |
| 489 | .output_mode = output_mode, | 493 | .output_mode = output_mode, |
| 490 | .link_libc = link_libc, | 494 | .link_libc = link_libc, |
| | 495 | .pic = pic, |
| | 496 | .pie = pie, |
| 491 | .deps = std.ArrayList(DepModule).init(ctx.cases.allocator), | 497 | .deps = std.ArrayList(DepModule).init(ctx.cases.allocator), |
| 492 | }); | 498 | }); |
| 493 | try cases.append(next); | 499 | try cases.append(next); |
| ... | @@ -695,6 +701,8 @@ pub fn lowerToBuildSteps( | ... | @@ -695,6 +701,8 @@ pub fn lowerToBuildSteps( |
| 695 | }; | 701 | }; |
| 696 | | 702 | |
| 697 | if (case.link_libc) artifact.linkLibC(); | 703 | if (case.link_libc) artifact.linkLibC(); |
| | 704 | if (case.pic) |pic| artifact.root_module.pic = pic; |
| | 705 | if (case.pie) |pie| artifact.pie = pie; |
| 698 | | 706 | |
| 699 | switch (case.backend) { | 707 | switch (case.backend) { |
| 700 | .stage1 => continue, | 708 | .stage1 => continue, |
| ... | @@ -958,6 +966,10 @@ const TestManifestConfigDefaults = struct { | ... | @@ -958,6 +966,10 @@ const TestManifestConfigDefaults = struct { |
| 958 | return "false"; | 966 | return "false"; |
| 959 | } else if (std.mem.eql(u8, key, "c_frontend")) { | 967 | } else if (std.mem.eql(u8, key, "c_frontend")) { |
| 960 | return "clang"; | 968 | return "clang"; |
| | 969 | } else if (std.mem.eql(u8, key, "pic")) { |
| | 970 | return "null"; |
| | 971 | } else if (std.mem.eql(u8, key, "pie")) { |
| | 972 | return "null"; |
| 961 | } else unreachable; | 973 | } else unreachable; |
| 962 | } | 974 | } |
| 963 | }; | 975 | }; |
| ... | @@ -991,6 +1003,8 @@ const TestManifest = struct { | ... | @@ -991,6 +1003,8 @@ const TestManifest = struct { |
| 991 | .{ "c_frontend", {} }, | 1003 | .{ "c_frontend", {} }, |
| 992 | .{ "link_libc", {} }, | 1004 | .{ "link_libc", {} }, |
| 993 | .{ "backend", {} }, | 1005 | .{ "backend", {} }, |
| | 1006 | .{ "pic", {} }, |
| | 1007 | .{ "pie", {} }, |
| 994 | }); | 1008 | }); |
| 995 | | 1009 | |
| 996 | const Type = enum { | 1010 | const Type = enum { |
| ... | @@ -1219,7 +1233,12 @@ const TestManifest = struct { | ... | @@ -1219,7 +1233,12 @@ const TestManifest = struct { |
| 1219 | }; | 1233 | }; |
| 1220 | } | 1234 | } |
| 1221 | }.parse, | 1235 | }.parse, |
| 1222 | .@"struct" => @compileError("no default parser for " ++ @typeName(T)), | 1236 | .optional => |o| return struct { |
| | 1237 | fn parse(str: []const u8) anyerror!T { |
| | 1238 | if (std.mem.eql(u8, str, "null")) return null; |
| | 1239 | return try getDefaultParser(o.child)(str); |
| | 1240 | } |
| | 1241 | }.parse, |
| 1223 | else => @compileError("no default parser for " ++ @typeName(T)), | 1242 | else => @compileError("no default parser for " ++ @typeName(T)), |
| 1224 | } | 1243 | } |
| 1225 | } | 1244 | } |