Build Test Runner
ErikSchierboom opened this issue · 12 comments
In Exercism v3, one of the biggest changes is that we'll automatically check if a submitted solution passes all the tests.
We'll check this via a new, track-specific tool: the Test Runner. Each test runner is track-specific. When a new solution is submitted, we run the track's test runner, which outputs a JSON file that describes the test results.
The test runner must be able to run the tests suites of both Concept Exercises and Practice Exercises. Depending on the test runner implementation, this could mean having to update the Practice Exercises to the format expected by the test runner.
Each track must build a test runner according to the spec. For tracks building a test runner from scratch, we have a starting guide and a generic test runner that can be used as the base for the new test runner.
- Bash (v2)
- C (v2)
- CFML (v1)
- Clojure (v1)
- ClojureScript (v1)
- CoffeeScript (v1)
- Common Lisp (v2)
- C++ (v1.5)
- Crystal (v2)
- C# (v3)
- D (v1)
- Dart (v1)
-
Delphi Pascal (? can only run on Windows?) - Elixir (v3)
- Elm (v3)
- Emacs Lisp (v1)
- Erlang (v1.5)
- F# (v1.5)
- Fortran (v2)
- Go (v2)
- Groovy (v1)
- Haskell (v1)
- Java (v1.5)
- JavaScript (v2)
- Julia (v1.5)
- Kotlin (v1.5 doesn't work without networking)
- LFE (v1)
- Lua (v1)
- MIPS Assembly (v1)
- Nim (v2)
-
Objective-C (? can only run on Mac?) - OCaml (v1)
- Perl 5 (v1)
-
Pharo (? does not have CI setup so no way to get started) - PHP (v1)
-
PL/SQL (? requires Oracle DB) - Prolog (v1)
- PureScript (v1)
- Python (v3)
- R (v1)
- Racket (v1)
- Raku (v1)
- ReasonML (v1)
- Red (v2)
- Ruby (v2)
- Rust (v1.5)
- Scala (v1.5 - functional but too slow)
- Scheme (v1.5)
- Standard ML (v1)
- Swift (v1.5) (does not yet work)
- Tcl (v1)
- TypeScript (v2)
- Vim script (v1)
- x86-64 Assembly (v1.5)
PHP and Elixir have working test runners. Elixir is to full spec, php is to reduced spec
@neenjaw Almost :) See exercism/elixir-test-runner#33
@ErikSchierboom can you please check the version from the WIP PR exercism/erlang-test-runner#7?
I know that it currently can not run some of the tests (4 of the practice exercises are failing) but I hope I'll be able to tackle that during the weekend.
@NobbZ I currently can't test Erlang due to it not syncing. I've opened a PR to fix that: exercism/erlang#464
I have merged the PR.
@NobbZ The Dockerfile would not build on my machine, which was due to the image aliases being in uppercase. After changing FROM ERLANG as BUILDER
to FROM erlang as builder
(and the other image aliases too) I could build it. Running the test runner on the hello-world
exercise fails with:
Exercise: hello-world
Solution: /mnt/exercism-iteration/
Output: /mnt/exercism-iteration/
escript: exception error: bad argument
in function binary_to_existing_atom/2
called as binary_to_existing_atom(<<"example_tests">>,utf8)
in call from etr_runner:get_test_module_from/1 (/app/src/etr_runner.erl, line 27)
in call from etr_runner:run/1 (/app/src/etr_runner.erl, line 6)
in call from erlang_test_runner:main/1 (/app/src/erlang_test_runner.erl, line 15)
in call from escript:run/2 (escript.erl, line 758)
in call from escript:start/1 (escript.erl, line 277)
in call from init:start_em/1
in call from init:do_boot/3
Is hello-world
one of the 4 failing practice exercises?
BTW If you like to easily test the Docker container, you could add a script like this: https://github.com/exercism/vimscript-test-runner/blob/main/bin/run-in-docker.sh It will allow you to do ./bin/run-in-docker.sh <slug> <input-dir> <output-dir>
Weird that you need the stage-names/aliases in lowercase… I was under the impression to have read some document saying the should be uppercase… Can't find it anymore, though good to know that this might fail.
So far I only observed podman
acting weird on casing…
Re the error you are facing now, if I understand my code correctly, this means that there is an src/example.erl
in the input and the runner searches for the corresponding test module, alternatively, you have an src/hello_world.erl
which first line is -module(example).
(or something semantically equivalent).
I really should wrap some error handling (later) that will give some proper error message on unexpected file/module names.
The currently known to fail are:
robot-simulator
nucleotide-count
rotational-cipher
sublist
They all use some lazy test generation mechanism, which I have not yet implemented in the testrunner.
And thanks for the vim-script-runner link. I'm already doing something similar in my test-suite:
https://github.com/NobbZ/erlang-test-runner/blob/main/test/runs_in_docker_SUITE.erl#L213-L224
Sole thing that is missing is the explicit type=bind
and the global --read-only
as well as the tmpfs
mount.
Therefore I really think that the docker itself is working (except for the stage-names).
@NobbZ Let's continue this discussion in exercism/erlang-test-runner#7
@ErikSchierboom I'm playing around with making a crystal test-runner. :)
@neenjaw Brilliant! Let me know if you need any help.
Will do, it's going alright so far!