-
-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using roswell
to run tests.
#759
Comments
So far, it looks very promising as a "one true" way to run tests. Using homebrew on this Debian install, and The first time it's invoked, it will immediately install SBCL and Quicklisp:
This is great: the only installation instruction needs to be "go install roswell". The first time |
Running tests installs dependencies seamlessly thanks to quicklisp:
|
But, adding an incorrect test (test wrong-test (is (equal "WRONG" (acronym:acronym "Readily ignited gasoline-hydrocarbon turbine"))))
|
In playing with sbcl, ccl, clisp, each interpreter has a unique way to set the exit status
|
This little shell script would work: #!/bin/sh
exercise=${PWD##*/}
tests="${exercise}-test.lisp"
if ! [ -f "${tests}" ]; then
echo "Test file not found: $tests" >&2
exit 2
fi
ros run -l "${tests}" \
-e "(${exercise}-test:run-tests)" \
-q 2>&1 \
| (
status=0;
while IFS= read -r line; do
case "$line" in
' Fail: '[1-9]*) status=1 ;;
esac
echo "$line"
done
exit $status
) Running it:
|
That would mean:
I'm not entirely happy with the shell script: it's a bit fragile in that if fiveam changes the format of the "Fail: nnn" line, then the exit status won't be set correctly. |
You might want to look at the If |
Ah, that's it!
then
|
If we still want to add a script to launch the tests: #!/bin/sh
exercise=${PWD##*/}
tests="${exercise}-test.lisp"
if ! [ -f "${tests}" ]; then
echo "Test file not found: $tests" >&2
exit 2
fi
# exit status: 0 if all tests pass, 1 otherwise
ros run --load "${tests}" \
--eval "(uiop/image:quit (if (${exercise}-test:run-tests) 0 1))" Or, this might be clearer: ros run --load "${tests}" \
--eval "
(let* ((test-status (${exercise}-test:run-tests))
(exit-status (if test-status 0 1)))
(uiop/image:quit exit-status))
" |
Looks good. I think I think the final lines of the shell script you have above are good (rather than the second which uses Can you put together a PR with instructions on installing |
<ul dir="auto"> <li>INSTALLATION and TESTS docs updated.</li> <li>exercises/shared/.docs/tests.md updated (used to create HELP.md for downloads)</li> <li>Updated exercise generator script to create test launcher scripts.</li> <li>Added launcher scripts to all exercises</li> </ul> <p dir="auto">You might want to review this by commit, the "Add launcher scripts to all exercises" commit is large and repetitive.</p> <p dir="auto"><span class="issue-keyword tooltipped tooltipped-se" aria-label="This pull request closes issue #759.">Closes</span> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1967070272" data-permission-text="Title is private" data-url="#759" data-hovercard-type="issue" data-hovercard-url="//issues/759/hovercard" href="https://github.com/exercism/common-lisp/issues/759">#759</a></p>
In #758 (comment), the topic of roswell was introduced.
Let's discuss it here.
The text was updated successfully, but these errors were encountered: