Commit graph

8 commits

Author SHA1 Message Date
Manlio Perillo
4b1e292ae4 test: fix deadlock on windows when running tests
The deadlock was caused by setting stdout behavior to ignore, when
spawning the patch command.  When the patch command writes to devnull it
causes some errors and a deadlock.

The cause of the bug is probably Zig using `\Device\Null` from `ntdll`
while git-bash uses `NUL` from `kernel32`.
2023-04-29 16:25:58 +02:00
Manlio Perillo
4f690b074a test: add a test for zig build -Dn=1
Add a test for `zig build -Dn=1` in order to test that a broken exercise
will print an hint.
2023-04-24 13:03:52 +02:00
Manlio Perillo
5b2e842157 test: change the order of zig build options
In test case 1 and 2, move the -Dhealed option before the -Dn option,
for consistency.

Fix a typo in cmd.setName in test case 1 and 2.

Remove a confusing comment in test case 1.
2023-04-24 12:19:00 +02:00
Manlio Perillo
131772edd7 test: add test for zig build and zig build -Dn=1 start
Add tests for `zig build` and `zig build -Dn=1 start`, in order to test
that the all the exercises are processed in the correct order.
2023-04-24 11:59:08 +02:00
Manlio Perillo
cec0aa51db 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.
2023-04-24 10:32:08 +02:00
Manlio Perillo
108c145bdd test: refactorize the code
Currently, if there is an error when creating the patches/healed
directory, the error message will be printed on stderr, but the build
runner will report the test as being successful.

Add the fail function and the FailStep, so that the error will be
correctly handled by the build runner.

Remove the PatchStep, and instead add the heal function so that all the
exercises are healed before starting the tests.

The heal function executes at the configuration phase, but the possible
error is handled by the build runner.
2023-04-24 10:31:06 +02:00
Manlio Perillo
647a24afae build: improve PrintStep, SkipStep and PatchStep names
Use lover case for the step names.

Add the exercise name for the SkipStep and PatchStep step name.
2023-04-11 12:45:55 +02:00
Manlio Perillo
c656536d3f build: simplify code and add tests
Simplify the code finding the exercise number from the exercise index,
when the -Dn option is set.  This is now possible since the exercise
numbers have no holes.

Add the validate_exercises function to check that exercise number are in
the correct order, and call it at the start of the build function.

Add tests, with 2 test cases.
2023-04-11 12:45:55 +02:00