| ... | @@ -391,8 +391,10 @@ pub const TestContext = struct { | ... | @@ -391,8 +391,10 @@ pub const TestContext = struct { |
| 391 | prg_node.activate(); | 391 | prg_node.activate(); |
| 392 | defer prg_node.end(); | 392 | defer prg_node.end(); |
| 393 | | 393 | |
| 394 | // So that we can see which test case failed when the leak checker goes off. | 394 | // So that we can see which test case failed when the leak checker goes off, |
| 395 | progress.refresh(); | 395 | // or there's an internal error |
| | 396 | progress.initial_delay_ns = 0; |
| | 397 | progress.refresh_rate_ns = 0; |
| 396 | | 398 | |
| 397 | const info = try std.zig.system.NativeTargetInfo.detect(std.testing.allocator, case.target); | 399 | const info = try std.zig.system.NativeTargetInfo.detect(std.testing.allocator, case.target); |
| 398 | try self.runOneCase(std.testing.allocator, &prg_node, case, info.target); | 400 | try self.runOneCase(std.testing.allocator, &prg_node, case, info.target); |
| ... | @@ -408,10 +410,6 @@ pub const TestContext = struct { | ... | @@ -408,10 +410,6 @@ pub const TestContext = struct { |
| 408 | const root_pkg = try Package.create(allocator, tmp.dir, ".", tmp_src_path); | 410 | const root_pkg = try Package.create(allocator, tmp.dir, ".", tmp_src_path); |
| 409 | defer root_pkg.destroy(); | 411 | defer root_pkg.destroy(); |
| 410 | | 412 | |
| 411 | var prg_node = root_node.start(case.name, case.updates.items.len); | | |
| 412 | prg_node.activate(); | | |
| 413 | defer prg_node.end(); | | |
| 414 | | | |
| 415 | const bin_name = try std.zig.binNameAlloc(allocator, "test_case", target, case.output_mode, null); | 413 | const bin_name = try std.zig.binNameAlloc(allocator, "test_case", target, case.output_mode, null); |
| 416 | defer allocator.free(bin_name); | 414 | defer allocator.free(bin_name); |
| 417 | | 415 | |
| ... | @@ -434,7 +432,7 @@ pub const TestContext = struct { | ... | @@ -434,7 +432,7 @@ pub const TestContext = struct { |
| 434 | defer module.deinit(); | 432 | defer module.deinit(); |
| 435 | | 433 | |
| 436 | for (case.updates.items) |update, update_index| { | 434 | for (case.updates.items) |update, update_index| { |
| 437 | var update_node = prg_node.start("update", 4); | 435 | var update_node = root_node.start("update", 3); |
| 438 | update_node.activate(); | 436 | update_node.activate(); |
| 439 | defer update_node.end(); | 437 | defer update_node.end(); |
| 440 | | 438 | |
| ... | @@ -451,6 +449,7 @@ pub const TestContext = struct { | ... | @@ -451,6 +449,7 @@ pub const TestContext = struct { |
| 451 | | 449 | |
| 452 | switch (update.case) { | 450 | switch (update.case) { |
| 453 | .Transformation => |expected_output| { | 451 | .Transformation => |expected_output| { |
| | 452 | update_node.estimated_total_items = 5; |
| 454 | var emit_node = update_node.start("emit", null); | 453 | var emit_node = update_node.start("emit", null); |
| 455 | emit_node.activate(); | 454 | emit_node.activate(); |
| 456 | var new_zir_module = try zir.emit(allocator, module); | 455 | var new_zir_module = try zir.emit(allocator, module); |
| ... | @@ -464,9 +463,15 @@ pub const TestContext = struct { | ... | @@ -464,9 +463,15 @@ pub const TestContext = struct { |
| 464 | try new_zir_module.writeToStream(allocator, out_zir.outStream()); | 463 | try new_zir_module.writeToStream(allocator, out_zir.outStream()); |
| 465 | write_node.end(); | 464 | write_node.end(); |
| 466 | | 465 | |
| | 466 | var test_node = update_node.start("assert", null); |
| | 467 | test_node.activate(); |
| 467 | std.testing.expectEqualSlices(u8, expected_output, out_zir.items); | 468 | std.testing.expectEqualSlices(u8, expected_output, out_zir.items); |
| | 469 | test_node.end(); |
| 468 | }, | 470 | }, |
| 469 | .Error => |e| { | 471 | .Error => |e| { |
| | 472 | var test_node = update_node.start("assert", null); |
| | 473 | test_node.activate(); |
| | 474 | defer test_node.end(); |
| 470 | var handled_errors = try allocator.alloc(bool, e.len); | 475 | var handled_errors = try allocator.alloc(bool, e.len); |
| 471 | defer allocator.free(handled_errors); | 476 | defer allocator.free(handled_errors); |
| 472 | for (handled_errors) |*h| { | 477 | for (handled_errors) |*h| { |
| ... | @@ -495,6 +500,7 @@ pub const TestContext = struct { | ... | @@ -495,6 +500,7 @@ pub const TestContext = struct { |
| 495 | } | 500 | } |
| 496 | }, | 501 | }, |
| 497 | .Execution => |expected_stdout| { | 502 | .Execution => |expected_stdout| { |
| | 503 | update_node.estimated_total_items = 4; |
| 498 | var exec_result = x: { | 504 | var exec_result = x: { |
| 499 | var exec_node = update_node.start("execute", null); | 505 | var exec_node = update_node.start("execute", null); |
| 500 | exec_node.activate(); | 506 | exec_node.activate(); |
| ... | @@ -511,6 +517,10 @@ pub const TestContext = struct { | ... | @@ -511,6 +517,10 @@ pub const TestContext = struct { |
| 511 | .cwd_dir = tmp.dir, | 517 | .cwd_dir = tmp.dir, |
| 512 | }); | 518 | }); |
| 513 | }; | 519 | }; |
| | 520 | var test_node = update_node.start("test", null); |
| | 521 | test_node.activate(); |
| | 522 | defer test_node.end(); |
| | 523 | |
| 514 | defer allocator.free(exec_result.stdout); | 524 | defer allocator.free(exec_result.stdout); |
| 515 | defer allocator.free(exec_result.stderr); | 525 | defer allocator.free(exec_result.stderr); |
| 516 | switch (exec_result.term) { | 526 | switch (exec_result.term) { |