| ... | ... | @@ -88,6 +88,8 @@ pub const Case = struct { |
| 88 | 88 | expect_exact: bool = false, |
| 89 | 89 | backend: Backend = .stage2, |
| 90 | 90 | link_libc: bool = false, |
| 91 | pic: ?bool = null, |
| 92 | pie: ?bool = null, |
| 91 | 93 | |
| 92 | 94 | deps: std.ArrayList(DepModule), |
| 93 | 95 | |
| ... | ... | @@ -425,6 +427,8 @@ fn addFromDirInner( |
| 425 | 427 | const is_test = try manifest.getConfigForKeyAssertSingle("is_test", bool); |
| 426 | 428 | const link_libc = try manifest.getConfigForKeyAssertSingle("link_libc", bool); |
| 427 | 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 | 433 | if (manifest.type == .translate_c) { |
| 430 | 434 | for (c_frontends) |c_frontend| { |
| ... | ... | @@ -488,6 +492,8 @@ fn addFromDirInner( |
| 488 | 492 | .is_test = is_test, |
| 489 | 493 | .output_mode = output_mode, |
| 490 | 494 | .link_libc = link_libc, |
| 495 | .pic = pic, |
| 496 | .pie = pie, |
| 491 | 497 | .deps = std.ArrayList(DepModule).init(ctx.cases.allocator), |
| 492 | 498 | }); |
| 493 | 499 | try cases.append(next); |
| ... | ... | @@ -695,6 +701,8 @@ pub fn lowerToBuildSteps( |
| 695 | 701 | }; |
| 696 | 702 | |
| 697 | 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 | 707 | switch (case.backend) { |
| 700 | 708 | .stage1 => continue, |
| ... | ... | @@ -958,6 +966,10 @@ const TestManifestConfigDefaults = struct { |
| 958 | 966 | return "false"; |
| 959 | 967 | } else if (std.mem.eql(u8, key, "c_frontend")) { |
| 960 | 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 | 973 | } else unreachable; |
| 962 | 974 | } |
| 963 | 975 | }; |
| ... | ... | @@ -991,6 +1003,8 @@ const TestManifest = struct { |
| 991 | 1003 | .{ "c_frontend", {} }, |
| 992 | 1004 | .{ "link_libc", {} }, |
| 993 | 1005 | .{ "backend", {} }, |
| 1006 | .{ "pic", {} }, |
| 1007 | .{ "pie", {} }, |
| 994 | 1008 | }); |
| 995 | 1009 | |
| 996 | 1010 | const Type = enum { |
| ... | ... | @@ -1219,7 +1233,12 @@ const TestManifest = struct { |
| 1219 | 1233 | }; |
| 1220 | 1234 | } |
| 1221 | 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 | 1242 | else => @compileError("no default parser for " ++ @typeName(T)), |
| 1224 | 1243 | } |
| 1225 | 1244 | } |