mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-12-21 21:53:11 -05:00
test: fix incorrect cleanup code
The current cleanup code is incorrect, since it may delete the healed directory while one test case is running. The solution is to make each test case isolate, with its own setup and teardown. Unfortunately it is currently not possible, since each test case modify the same directory. Disable the cleanup step, until a better solution is found.
This commit is contained in:
parent
108c145bdd
commit
cec0aa51db
1 changed files with 7 additions and 5 deletions
|
@ -7,8 +7,8 @@ const fs = std.fs;
|
|||
|
||||
const Allocator = std.mem.Allocator;
|
||||
const Build = std.build;
|
||||
const Step = Build.Step;
|
||||
const RunStep = std.Build.RunStep;
|
||||
const Step = Build.Step;
|
||||
|
||||
const Exercise = root.Exercise;
|
||||
|
||||
|
@ -27,9 +27,9 @@ pub fn addCliTests(b: *std.Build, exercises: []const Exercise) *Step {
|
|||
};
|
||||
|
||||
{
|
||||
// Test that `zig build -Dn=n -Dhealed test` selects the nth exercise.
|
||||
const case_step = createCase(b, "case-1");
|
||||
|
||||
// Test that `zig build -Dn=n -Dhealed test` selects the nth exercise.
|
||||
var i: usize = 0;
|
||||
for (exercises[0 .. exercises.len - 1]) |ex| {
|
||||
i += 1;
|
||||
|
@ -54,9 +54,9 @@ pub fn addCliTests(b: *std.Build, exercises: []const Exercise) *Step {
|
|||
}
|
||||
|
||||
{
|
||||
// Test that `zig build -Dn=n -Dhealed test` skips disabled esercises.
|
||||
const case_step = createCase(b, "case-2");
|
||||
|
||||
// Test that `zig build -Dn=n -Dhealed test` skips disabled esercises.
|
||||
var i: usize = 0;
|
||||
for (exercises[0 .. exercises.len - 1]) |ex| {
|
||||
i += 1;
|
||||
|
@ -76,8 +76,10 @@ pub fn addCliTests(b: *std.Build, exercises: []const Exercise) *Step {
|
|||
step.dependOn(case_step);
|
||||
}
|
||||
|
||||
const cleanup = b.addRemoveDirTree(outdir);
|
||||
step.dependOn(&cleanup.step);
|
||||
// Don't add the cleanup step, since it may delete outdir while a test case
|
||||
// is running.
|
||||
//const cleanup = b.addRemoveDirTree(outdir);
|
||||
//step.dependOn(&cleanup.step);
|
||||
|
||||
return step;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue