-
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
Be able to allocate a formatter for stdout/stderr #399
Merged
Conversation
This file contains 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
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
force-pushed
the
safe-formatter
branch
from
January 20, 2024 19:11
3aff1ce
to
d591896
Compare
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. |
MisterDA
approved these changes
May 30, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
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)
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
formatter
s used by Alcotest where they are also used by something else likeLogs
in a parallel task. Currently, this PR is a draft because I'm not really sure about the design. Three points are importants:stdout
/stderr
and 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.formatter
which does not usesStdlib.std{out,err}
(something likeFormat.str_formatter
for instance).httpcats
which launches several tasks in parallel and usesLogs
in these parallel tasks withFormat.{std,err}_formatter
pp_summary
where the newline does not appear anymore but I don't really understand why. Otherwise, the ouput seems the same as before.