| ... | @@ -13,6 +13,7 @@ pub fn make( | ... | @@ -13,6 +13,7 @@ pub fn make( |
| 13 | maker: *Maker, | 13 | maker: *Maker, |
| 14 | progress_node: std.Progress.Node, | 14 | progress_node: std.Progress.Node, |
| 15 | ) Step.ExtendedMakeError!void { | 15 | ) Step.ExtendedMakeError!void { |
| | 16 | _ = check_file; |
| 16 | _ = progress_node; | 17 | _ = progress_node; |
| 17 | const graph = maker.graph; | 18 | const graph = maker.graph; |
| 18 | const arena = maker.graph.arena; // TODO don't leak into process arena | 19 | const arena = maker.graph.arena; // TODO don't leak into process arena |
| ... | @@ -20,7 +21,7 @@ pub fn make( | ... | @@ -20,7 +21,7 @@ pub fn make( |
| 20 | const step = maker.stepByIndex(step_index); | 21 | const step = maker.stepByIndex(step_index); |
| 21 | const conf = &maker.scanned_config.configuration; | 22 | const conf = &maker.scanned_config.configuration; |
| 22 | const conf_step = step_index.ptr(conf); | 23 | const conf_step = step_index.ptr(conf); |
| 23 | const conf_cf = conf_step.extended.get(conf.extra).install_file; | 24 | const conf_cf = conf_step.extended.get(conf.extra).check_file; |
| 24 | const lazy_path = conf_cf.file.get(conf); | 25 | const lazy_path = conf_cf.file.get(conf); |
| 25 | | 26 | |
| 26 | try step.singleUnchangingWatchInput(maker, arena, lazy_path); | 27 | try step.singleUnchangingWatchInput(maker, arena, lazy_path); |
| ... | @@ -29,11 +30,12 @@ pub fn make( | ... | @@ -29,11 +30,12 @@ pub fn make( |
| 29 | const limit: Io.Limit = if (conf_cf.max_bytes.value) |x| .limited(x) else .unlimited; | 30 | const limit: Io.Limit = if (conf_cf.max_bytes.value) |x| .limited(x) else .unlimited; |
| 30 | | 31 | |
| 31 | const contents = src_path.root_dir.handle.readFileAlloc(io, src_path.sub_path, arena, limit) catch |err| | 32 | const contents = src_path.root_dir.handle.readFileAlloc(io, src_path.sub_path, arena, limit) catch |err| |
| 32 | return step.fail("failed to read {f}: {t}", .{ src_path, err }); | 33 | return step.fail(maker, "failed to read {f}: {t}", .{ src_path, err }); |
| 33 | | 34 | |
| 34 | for (check_file.expected_matches) |expected_match| { | 35 | for (conf_cf.expected_matches.slice) |expected_match_index| { |
| | 36 | const expected_match = expected_match_index.slice(conf); |
| 35 | if (std.mem.find(u8, contents, expected_match) == null) { | 37 | if (std.mem.find(u8, contents, expected_match) == null) { |
| 36 | return step.fail( | 38 | return step.fail(maker, |
| 37 | \\ | 39 | \\ |
| 38 | \\========= expected to find: =================== | 40 | \\========= expected to find: =================== |
| 39 | \\{s} | 41 | \\{s} |
| ... | @@ -44,16 +46,17 @@ pub fn make( | ... | @@ -44,16 +46,17 @@ pub fn make( |
| 44 | } | 46 | } |
| 45 | } | 47 | } |
| 46 | | 48 | |
| 47 | if (check_file.expected_exact) |expected_exact| { | 49 | if (conf_cf.expected_exact.value) |expected_exact_index| { |
| | 50 | const expected_exact = expected_exact_index.slice(conf); |
| 48 | if (!std.mem.eql(u8, expected_exact, contents)) { | 51 | if (!std.mem.eql(u8, expected_exact, contents)) { |
| 49 | return step.fail( | 52 | return step.fail(maker, |
| 50 | \\ | 53 | \\ |
| 51 | \\========= expected: ===================== | 54 | \\========= expected: ===================== |
| 52 | \\{s} | 55 | \\{s} |
| 53 | \\========= but found: ==================== | 56 | \\========= but found: ==================== |
| 54 | \\{s} | 57 | \\{s} |
| 55 | \\========= from the following file: ====== | 58 | \\========= from the following file: ====== |
| 56 | \\{s} | 59 | \\{f} |
| 57 | , .{ expected_exact, contents, src_path }); | 60 | , .{ expected_exact, contents, src_path }); |
| 58 | } | 61 | } |
| 59 | } | 62 | } |