summaryrefslogtreecommitdiffstatshomepage
path: root/test/tests.zig
diff options
context:
space:
mode:
authorManlio Perillo <manlio.perillo@gmail.com>2023-04-20 21:13:13 +0200
committerManlio Perillo <manlio.perillo@gmail.com>2023-04-24 10:32:08 +0200
commitcec0aa51dbb9bff30f871d3f605bc1f0fbc6b4a4 (patch)
tree4c96ddb6eb6b58332ed873889bc8e5d5c7e68ca2 /test/tests.zig
parent108c145bdd8c7f6924e0c41adb634eae90baf9c9 (diff)
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.
Diffstat (limited to 'test/tests.zig')
-rw-r--r--test/tests.zig12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/tests.zig b/test/tests.zig
index 5bd1e82..015b55a 100644
--- a/test/tests.zig
+++ b/test/tests.zig
@@ -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;
}