rust/library
bors b4571bed99 Auto merge of #109729 - fortanix:raoul/bugfix_libtest_json_synchronization, r=pietroalbini
Ensure test library issues json string line-by-line

#108659 introduces a custom test display implementation. It does so by using libtest to output json. The stdout is read line by line and parsed. The code trims the line read and checks whether it starts with a `{` and ends with a `}`.

Unfortunately, there is a race condition in how json data is written to stdout. The `write_message` function calls `self.out.write_all` repeatedly to write a buffer that contains (partial) json data, or a new line. There is no lock around the `self.out.write_all` functions. Similarly, the `write_message` function itself is called with only partial json data. As these functions are called from concurrent threads, this may result in json data ending up on the same stdout line. This PR avoids this by buffering the complete json data before issuing a single `self.out.write_all`.

(#109484 implemented a partial fix for this issue; it only avoids that failed json parsing would result in a panic.)

cc: `@jethrogb,` `@pietroalbini`
2023-05-02 21:28:53 +00:00
..
alloc Auto merge of #103406 - Jules-Bertholet:from_clone_slice_to_box, r=dtolnay 2023-04-30 13:58:00 +00:00
backtrace@8ad84ca5ad
core Rollup merge of #110955 - fee1-dead-contrib:sus-operation, r=compiler-errors 2023-05-02 11:44:52 +05:30
panic_abort
panic_unwind Partial stabilisation of c_unwind 2023-04-29 13:01:44 +01:00
portable-simd Make sure that signatures aren't accidental refinements 2023-04-28 17:36:49 +00:00
proc_macro
profiler_builtins
rtstartup
rustc-std-workspace-alloc
rustc-std-workspace-core
rustc-std-workspace-std
std Rollup merge of #110895 - Ayush1325:thread-local-fix, r=thomcc 2023-05-02 11:44:52 +05:30
stdarch@b655243782
test Ensure test library issues json string line-by-line 2023-05-01 10:27:37 +02:00
unwind