Repository navigation
Be able to allocate a formatter for stdout/stderr - #399
Merged
Merged
Conversation
using OCaml's formatter - fix some data-race when some parallel tasks use the same formatter. This commit tries to solve an issue about OCaml 5 and parallelism. Alcotest uses OCaml's formatter which can be used by some libraries such as Logs. In this situation and if Logs is used into a parallel task, a data-race exists about the internal queue used by formatters. This commit allows the user to allocate its own formatter for stdout/stderr and give them to Alcotest.
dinosaure
commented
Oct 13, 2023
…ge about the newline for pp_summary)
dinosaure
force-pushed
the
safe-formatter
branch
from
October 13, 2023 14:38
4179b7d to
f690bde
Compare
dinosaure
marked this pull request as ready for review
October 15, 2023 09:15
dinosaure
force-pushed
the
safe-formatter
branch
from
January 20, 2024 19:11
3aff1ce to
d591896
Compare
Member
Author
|
It will be really pleasant if someone can look on this PR and merge it. Tests are passing and a real issue exists in the actual state of Alcotest. |
This was referenced May 31, 2024
samoht
added a commit
to samoht/opam-repository
that referenced
this pull request
Jul 25, 2024
CHANGES: - Add `match_raises`, a generalized version of `check_raises` (mirage/alcotest#88, mirage/alcotest#386, @JoanThibault) - Update JaneStreet core and async to v0.16 (mirage/alcotest#390 @tmcgilchrist) - Fix division by zero when size of the terminal is incorrectly reported as zero. (fix mirage/alcotest#356, mirage/alcotest#381, @MisterDA) - Enable terminal size reporting on macOS and Windows. Also report the terminal size even when the test is run buffered by Dune. (mirage/alcotest#381, mirage/alcotest#396, @MisterDA) - Allow overriding the number of columns with `ALCOTEST_COLUMNS` env var. (mirage/alcotest#322, mirage/alcotest#381, @MisterDA) - Be able to allocate and use user's formatters for stdout/stderr (mirage/alcotest#399, @dinosaure) - Stop detecting ocamlci specifically, since there's nothing specific about it. Simply use the `CI` env var to detect CIs. Improve CI detection. (mirage/alcotest#397, @MisterDA)
Halbaroth
pushed a commit
to Halbaroth/opam-repository
that referenced
this pull request
Jul 26, 2024
CHANGES: - Add `match_raises`, a generalized version of `check_raises` (mirage/alcotest#88, mirage/alcotest#386, @JoanThibault) - Update JaneStreet core and async to v0.16 (mirage/alcotest#390 @tmcgilchrist) - Fix division by zero when size of the terminal is incorrectly reported as zero. (fix mirage/alcotest#356, mirage/alcotest#381, @MisterDA) - Enable terminal size reporting on macOS and Windows. Also report the terminal size even when the test is run buffered by Dune. (mirage/alcotest#381, mirage/alcotest#396, @MisterDA) - Allow overriding the number of columns with `ALCOTEST_COLUMNS` env var. (mirage/alcotest#322, mirage/alcotest#381, @MisterDA) - Be able to allocate and use user's formatters for stdout/stderr (mirage/alcotest#399, @dinosaure) - Stop detecting ocamlci specifically, since there's nothing specific about it. Simply use the `CI` env var to detect CIs. Improve CI detection. (mirage/alcotest#397, @MisterDA)
avsm
pushed a commit
to avsm/opam-repository
that referenced
this pull request
Sep 5, 2024
CHANGES: - Add `match_raises`, a generalized version of `check_raises` (mirage/alcotest#88, mirage/alcotest#386, @JoanThibault) - Update JaneStreet core and async to v0.16 (mirage/alcotest#390 @tmcgilchrist) - Fix division by zero when size of the terminal is incorrectly reported as zero. (fix mirage/alcotest#356, mirage/alcotest#381, @MisterDA) - Enable terminal size reporting on macOS and Windows. Also report the terminal size even when the test is run buffered by Dune. (mirage/alcotest#381, mirage/alcotest#396, @MisterDA) - Allow overriding the number of columns with `ALCOTEST_COLUMNS` env var. (mirage/alcotest#322, mirage/alcotest#381, @MisterDA) - Be able to allocate and use user's formatters for stdout/stderr (mirage/alcotest#399, @dinosaure) - Stop detecting ocamlci specifically, since there's nothing specific about it. Simply use the `CI` env var to detect CIs. Improve CI detection. (mirage/alcotest#397, @MisterDA)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull-request, as a draft, wants to solve the issue #398 and solve a data-race on
formatters used by Alcotest where they are also used by something else likeLogsin a parallel task. Currently, this PR is a draft because I'm not really sure about the design. Three points are importants:stdout/stderrand what is required byalcotest-engine(eg.Platform), the user is only able to create these values viaAlcotest.Global.make_{stdout,stderr}to ensure that these values useStdlib.std{out,err}. Indeed, we don't want to let the user to create aFormat.formatterwhich does not usesStdlib.std{out,err}(something likeFormat.str_formatterfor instance).httpcatswhich launches several tasks in parallel and usesLogsin these parallel tasks withFormat.{std,err}_formatterpp_summarywhere the newline does not appear anymore but I don't really understand why. Otherwise, the ouput seems the same as before.