-
Notifications
You must be signed in to change notification settings - Fork 16
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
Make qcheck-lin and qcheck-stm available on OCaml 4.x #329
Conversation
This is great, many thanks! 😃 👍
|
I moved the test that depended on OCaml 5's RNG to the
(it also doesn't seem to be actually running any tests, but thats fine I guess for now, this is well tested on OCaml 5...) |
Sorry, for the confusion - I was too brief and unclear: 😬
In our CI we have a separate step to first run and check the former and subsequently the latter. With the above in mind, marking a test in This following comment was targeted at the
|
I'll take a look whether it is possible to use dune's |
Sounds good! There's yet another approach (using |
Their Thread mode is useful for testing OCaml 4.x code too. Unfortunately 'enabled_if' in 'test' stanza in dune doesn't work: it still attempts to build it, which would fail on OCaml 4, so have to use separate executable/runtest alias where 'enabled_if' works properly. The following now compiles: ``` dune build -p qcheck-multicoretests-util,qcheck-stm,qcheck-lin ``` The tests run, but the output is currently different from OCaml 5: ``` dune runtest -p qcheck-multicoretests-util,qcheck-stm,qcheck-lin ``` Signed-off-by: Edwin Török <[email protected]>
It uses a different RNG. Signed-off-by: Edwin Török <[email protected]>
It uses some new functions from Seq. Signed-off-by: Edwin Török <[email protected]>
I've created 32 and 64-bit versions of the .expected files now (using |
I've tried this out locally and it works nicely as intended 👍 Bonus points for realizing that Q: I see this requires 4.14 now. What prevents us from lowering the required version? |
On 18 April 2023 16:33:10 BST, Jan Midtgaard ***@***.***> wrote:
I've tried this out locally and it works nicely as intended :+1:
Both the 4.x and 5.x `Thread` modes don't work as nicely as the 5.x `Domain` ones unfortunately.
There are some previous attempts to improve them in #99
Bonus points for realizing that `base-domains` are not required for `qcheck-multicoretests-util` 🥇😃
Q: I see this requires 4.14 now. What prevents us from lowering the required version?
Note: I'm not asking you to lower it! I'm just trying to understand if we are using some `Stdlib` bindings added in 4.14 (I've had my share of lower bound battles during QCheck releases... 😅 )
Seq.iteri and Seq.equal. I do actually have a ocaml4.13 branch where I replaced these 2 functions (haven't tried further back). If there is interest in lowering the min version I can open a PR with that.
…--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
The CI is green modulo unrelated failures:
A Changes entry would be nice to help document the change in the forthcoming release notes. |
I've now added a CHANGES entry in 04df34f. |
Sorry, I got distracted by trying out the code and writing some tests using it. It does work, although writing custom shrinking and printing functions is highly recommended: makes shrinking results a lot more useful and finish in a reasonable time.
This relies on the assumption (that at least in my code) bugs have 2 origins: due to the byte values contained in the string (in which case small string should be able to fully exercise that), or due to the length of the string (in which case trying to generate different bytes, or different short strings won't reproduce the bug and make shrinking take a huge amount of time, just leave long strings as they were for now if short ones don't repro the problem). I might submit a separate PR to add some examples to the docs about writing a |
Conditional
A nice and tempting rabbit hole starts here: c-cube/qcheck#242 and continues here: c-cube/qcheck#268 Needlessly long strings being printed also sounds familiar. I created #308 to keep track of it.
In contrast to
Indeed, without supplying
Yep, the horror cabinet starts in #308 😅 |
Hmm,interruptible shrinking might be useful, e.g. if I happen to notice that shrinking is taking a long time (how long, will it take hours or days to finish, and meanwhile seeing even the potentially tiny bit longer error might already be useful...), dumping some sort of "state" that can be printed and further shrunk might be useful although that would require 'cmd' to be both serializable and deserializable. |
Limiting the length of the generated commands might help, and is what Jepsen recommends in their tutorials |
I know this is the 'multicoretests' repo, but the Thread mode of qcheck-lin appears to be useful for testing OCaml 4.x code too :)
Unfortunately 'enabled_if' in 'test' stanza in dune doesn't work: it still attempts to build it, which would fail on OCaml 4, so have to use separate executable/runtest alias where 'enabled_if' works properly.
The following now compiles:
The tests run, but the output is currently different from OCaml 5:
I haven't added enabled_if to all the other tests that are part of the multicoretests package, too much churn, and most tests wouldn't run because they link both the thread and domain versions.
What do you think?