| ... | ... | @@ -80,7 +80,7 @@ test { |
| 80 | 80 | var dir = try std.fs.cwd().openDir(dir_path, .{ .iterate = true }); |
| 81 | 81 | defer dir.close(); |
| 82 | 82 | |
| 83 | | ctx.addTestCasesFromDir(dir); |
| 83 | ctx.addTestCasesFromDir(dir, .incremental); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | try @import("test_cases").addCases(&ctx); |
| ... | ... | @@ -834,10 +834,6 @@ pub const TestContext = struct { |
| 834 | 834 | /// Execute all tests as incremental updates to a single compilation. Explicitly |
| 835 | 835 | /// incremental tests ("foo.0.zig", "foo.1.zig", etc.) still execute in order |
| 836 | 836 | incremental, |
| 837 | | |
| 838 | | fn parse(str: []const u8) ?Strategy { |
| 839 | | return std.meta.stringToEnum(Strategy, str); |
| 840 | | } |
| 841 | 837 | }; |
| 842 | 838 | |
| 843 | 839 | /// Adds a compile-error test for each file in the provided directory, using the |
| ... | ... | @@ -866,9 +862,9 @@ pub const TestContext = struct { |
| 866 | 862 | }; |
| 867 | 863 | } |
| 868 | 864 | |
| 869 | | pub fn addTestCasesFromDir(ctx: *TestContext, dir: std.fs.Dir) void { |
| 865 | pub fn addTestCasesFromDir(ctx: *TestContext, dir: std.fs.Dir, strategy: Strategy) void { |
| 870 | 866 | var current_file: []const u8 = "none"; |
| 871 | | addTestCasesFromDirInner(ctx, dir, &current_file) catch |err| { |
| 867 | addTestCasesFromDirInner(ctx, dir, strategy, &current_file) catch |err| { |
| 872 | 868 | std.debug.panic("test harness failed to process file '{s}': {s}\n", .{ |
| 873 | 869 | current_file, @errorName(err), |
| 874 | 870 | }); |
| ... | ... | @@ -938,6 +934,7 @@ pub const TestContext = struct { |
| 938 | 934 | fn addTestCasesFromDirInner( |
| 939 | 935 | ctx: *TestContext, |
| 940 | 936 | dir: std.fs.Dir, |
| 937 | strategy: Strategy, |
| 941 | 938 | /// This is kept up to date with the currently being processed file so |
| 942 | 939 | /// that if any errors occur the caller knows it happened during this file. |
| 943 | 940 | current_file: *[]const u8, |
| ... | ... | @@ -988,8 +985,8 @@ pub const TestContext = struct { |
| 988 | 985 | // in a new sequence ("*.0.zig") or an independent test file ("*.zig") |
| 989 | 986 | if (new_parts.test_index != null and new_parts.test_index.? != 0) return error.InvalidIncrementalTestIndex; |
| 990 | 987 | |
| 991 | | // if (strategy == .independent) |
| 992 | | // opt_case = null; // Generate a new independent test case for this update |
| 988 | if (strategy == .independent) |
| 989 | opt_case = null; // Generate a new independent test case for this update |
| 993 | 990 | } |
| 994 | 991 | } |
| 995 | 992 | prev_filename = filename; |
| ... | ... | @@ -999,13 +996,12 @@ pub const TestContext = struct { |
| 999 | 996 | |
| 1000 | 997 | // Parse the manifest |
| 1001 | 998 | var manifest = try TestManifest.parse(ctx.arena, src); |
| 1002 | | const strategy = manifest.getConfigForKey("strategy", Strategy, Strategy.parse).next().?; |
| 1003 | | const backend = manifest.getConfigForKey("backend", Backend, Backend.parse).next().?; |
| 1004 | 999 | |
| 1005 | 1000 | switch (manifest.@"type") { |
| 1006 | 1001 | .@"error" => { |
| 1007 | 1002 | const case = opt_case orelse case: { |
| 1008 | 1003 | const case = try ctx.cases.addOne(); |
| 1004 | const backend = manifest.getConfigForKey("backend", Backend, Backend.parse).next().?; |
| 1009 | 1005 | case.* = .{ |
| 1010 | 1006 | .name = "none", |
| 1011 | 1007 | .target = .{}, |
| ... | ... | @@ -1032,6 +1028,7 @@ pub const TestContext = struct { |
| 1032 | 1028 | .run => { |
| 1033 | 1029 | const case = opt_case orelse case: { |
| 1034 | 1030 | const case = try ctx.cases.addOne(); |
| 1031 | const backend = manifest.getConfigForKey("backend", Backend, Backend.parse).next().?; |
| 1035 | 1032 | case.* = .{ |
| 1036 | 1033 | .name = "none", |
| 1037 | 1034 | .target = .{}, |