Closed jmid closed 10 months ago
For 4. I realize now that running the Gospel tool itself might have helped me.
Is that the proposed tool cycle: run gospel file && ortac ...options... file
?
If so, could one consider invoking Gospel from Ortac, so that end-users would only have to invoke one command?
Thank you for your feedback, that’s very helpful!
1 and 3: Very good point! The Ortac runtime implements Gospelstdlib.List.tl
(and all such partial functions) by using the equivalent OCaml function. Maybe we should implement them so that they report an Ortac-specific exception that makes it easier to understand that the specification was partial and should be fixed. :thinking:
2: I agree. I’ve been advocating for using an OCaml-compatible syntax in order to reuse the OCaml parser.
4: Hopefully, the tutorial will guide users into writing it as necessary :sweat_smile:
For 4. I realize now that running the Gospel tool itself might have helped me.
I’m not sure I follow what you are referring to: Ortac does start by running the Gospel typechecker (if only because it is using its typed AST) and that’s why it reports: Gospel error: ...
with the error message as produced by the typechecker.
For 1. and 3. a Partial function application failed exception
would help indeed. That the exception is raised during generation (which should be pure in STM) in 1. and also 3. is the reason why no cmd
is printed I think.
I'm not sure what would be a good fix for it though... :thinking:
2: I agree. I’ve been advocating for using an OCaml-compatible syntax in order to reuse the OCaml parser.
Fair enough :+1:
4: Hopefully, the tutorial will guide users into writing it as necessary 😅
I would expect an error message telling me which ensures clause part is not translatable, no? The tutorial should certainly help - but it shouldn't replace informative error messages?
Thanks again for the indeed very helpful feedback :-)
Regarding 4
, I think that translatable
is a bit confusing as the problem is not that a specific Gospel clause is not translatable into OCaml, but rather that there is not one clause that is suitable to generate the next_state
case.
Nice - I can see I completely misunderstood the original error message :grimacing: I think #152 is a nice improvement! :tada:
BTW, I have a QCheck-STM
WIP patch to give a more useful error message on exceptions during next_state
.
This should let us print a call sequence in 1. and 3.
FYI, ocaml-multicore/multicoretests#400 has been released with version 0.3 of qcheck-stm
https://github.com/ocaml-multicore/multicoretests/releases/tag/0.3 so a fresh install should give a more informative error message in 1. and 3. :slightly_smiling_face:
AFAICS, a number of improvements have come out of this experience report: :tada:
qcheck-stm
improvement to print a failing cmd
I'll close it now though, as I don't think we can get more out of it.
I've just tried out the Ortac qcheck-stm plugin, taking baby steps to write a
Queue
specification. My efforts are in https://github.com/jmid/ortac/tree/add-queue where I mimicked the hashtbl test's files and dune rules.When developing these I used the following invocation to get error messages
and afterwards a
dune build @launchtests
or a direct invocation of_build/default/plugins/qcheck-stm/test/queue_stm_tests.exe -v
to invoke the extracted tests.There are 4 commits in there - here's feedback for these 4 steps from yours truly: a naive, well-intending, first-time user from hell :smile:
Not_found
exception - as an end-user I was missing some information as to what call sequence caused the exception:--- Failure --------------------------------------------------------------------
Test STM Lib test sequential failed:
ERROR: uncaught exception in generator for test STM Lib test sequential after 1000 steps: Exception: Failure("tl") Backtrace:
failure (1 tests failed, 0 tests errored, ran 1 tests)
File "test/queue.mli", line 16, characters 11-12: 16 | raises (Failure _) -> q.contents = [] ^ Error: Gospel error: Syntax error.
jmi@MintPad:~/software/ortac/plugins/qcheck-stm$ ../../_build/default/plugins/qcheck-stm/test/queue_stm_tests.exe -v random seed: 363694356 generated error fail pass / total time test name [ ] 0 0 0 0 / 1000 0.0s STM Lib test sequential (generating)Fatal error: exception Failure("tl")