Repository navigation
Make alcotest usable on Mirage - #238
Conversation
|
Thanks for the contribution! Mirage support is very fitting (and overdue). The implementation looks good overall (though I have some quibbles such as a general lack of documentation for the new module types). I'm less keen about the naming of the package split (
My counter-proposal is to split as follows:
If I understand correctly, this split has the benefit of being invisible to all current users of Alcotest. It also avoids the question of what to do about the CLI params that don't make sense without file redirection ( |
|
Thanks for your patch! A very quick review: I like the approach of the patch (abstracting away the platform specific bits). However I am not fond of changing UX regarding |
|
Dune virtual libraries might be a good fit to solve this problem. In this case |
|
Hi, we improved this PR as you requested. Now, there is a The AppVeyor error is unrelated ( We hope this version works for you and can be merged. If not, ping us. |
craigfe
left a comment
There was a problem hiding this comment.
Regarding the Alcotest_core__Core vs Alcotest_core.Core discrepancy, we can special case this as a regex in the output sanitizer. We're already handling similar platform-dependent output re. test duration, UUIDs, and build output paths.
Some thoughts:
-
The core test runner currently makes some assumptions about the platform that are not true for the Mirage backend. This manifests in stdout referencing output directories and in the CLI options / documentation that refer to file redirection. The easiest solution here is probably to add a warning at the top of the
Alcotest_miragepackage that such features are not supported by this backend. -
Alcotest_corewants an explicit wrapper module to hide internal helpers likepp.mlandutils.ml. This module can contain the previously-existing documentation which is currently missing (c.f. https://github.com/mirage/alcotest/pull/238/files#diff-2edb92d4351d349aecce1206918a2d26L127-L143).
|
Thanks for your changes. I'll review this more carefully next week, but I don't think that adding a new opam package ( |
Co-Authored-By: linse <[email protected]>
Adapt tests to use Alcotest_unix.run Co-Authored-By: linse <[email protected]>
Co-Authored-By: linse <[email protected]>
Co-Authored-By: linse <[email protected]>
Co-Authored-By: linse <[email protected]>
The new alcotest-core package is independent of unix The alcotest API is mostly unmodified Co-Authored-By: linse <[email protected]>
Co-Authored-By: linse <[email protected]>
Co-Authored-By: linse <[email protected]>
Co-Authored-By: linse <[email protected]>
… suggested by @craigfe Co-Authored-By: linse <[email protected]>
Co-Authored-By: linse <[email protected]>
Co-Authored-By: linse <[email protected]>
Co-Authored-By: linse <[email protected]>
|
LGTM @craigfe you mentioned this could break for projects using |
@samoht: for instance, the type of test filters is no longer observable without explicitly including On closer inspection, this may be the only such case (in which case it's hardly an issue). The greater breakage is probably that the |
I'm not a fan of re-exporting modules, that's why they no longer exist - if you re-export them and then use the functors with the wrong paths, this leads to compilation errors. I also think of them as internal modules, and unlikely being used outside of alcotest.
I don't mind either. |
I don't think it's a case of re-exporting modules so much as pre-applying them with the I've PRed into this one with some proposed changes (see https://github.com/roburio/alcotest/pull/1). Copying the PR description from there:
In my opinion, with those changes the PR can be merged. Don't let that block further discussion if you disagree with my proposals. |
Assorted cleanup to the proposed alcotest-mirage package
|
@craigfe thanks for your PR, we merged it. This is good to be merged now. |
|
Thanks for the contribution 😊 |
…age (1.2.0) CHANGES: - Add an `alcotest-mirage` package, allowing the construction of MirageOS unikernels that run Alcotest test suites. (mirage/alcotest#238, @hannesm @linse) - Add `Alcotest.check'`, a variant of `Alcotest.check` with labeled arguments. (mirage/alcotest#239, @hartmut27) - Add a testable for the `bytes` type. (mirage/alcotest#253, @mefyl) - Many assorted improvements to Alcotest output formatting. (mirage/alcotest#246, @craigfe) - Default to `--color=always` when running inside Dune (mirage/alcotest#242, @craigfe). The value can be overridden by setting the `ALCOTEST_COLOR` variable in a `dune` file, for example: ```dune (env (_ (env-vars (ALCOTEST_COLOR auto)))) ``` - Support all UTF-8 characters in test names and suite names, by normalising them for file-system interactions. (mirage/alcotest#249, @gs0510; mirage/alcotest#246, @craigfe) - Fix various crashes when using non-filesystem-safe characters in test suite names (these break Alcotest when attempting to generate a corresponding log file). (mirage/alcotest#241, @mefyl; mirage/alcotest#246 @craigfe)
With this PR, we make alcotest usable in a MirageOS unikernel.
We moved the unix-specific code into the
alcotest.unixsublibrary and defined the module signaturePlatformfor code that depends on the platform. In there, we doWe implemented the opam package alcotest-mirage for MirageOS unikernel testing. An example is in
test/e2e/alcotest-mirage.We would love your input on
Alcotest.run: no longer redirects output to files, independent of Unix - is that change a problem?Alcotest_unix.runbehaves likeAlcotest.run=> shouldAlcotest.runbe removed (API change)?Alcotest.run?