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