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 Bump version of object and related crates 2023-04-19 12:42:20 +08:00
core Rollup merge of #110955 - fee1-dead-contrib:sus-operation, r=compiler-errors 2023-05-02 11:44:52 +05:30
panic_abort Remove unnecessary raw pointer in __rust_start_panic arg 2023-03-26 16:40:18 +00:00
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 Auto merge of #109002 - michaelvanstraten:master, r=petrochenkov 2023-04-21 10:47:27 +00:00
profiler_builtins Fully stabilize NLL 2022-06-03 17:16:41 -04:00
rtstartup Remove custom frame info registration on i686-pc-windows-gnu 2022-08-23 16:12:58 +08:00
rustc-std-workspace-alloc Replace libstd, libcore, liballoc in line comments. 2022-12-30 14:00:42 +01:00
rustc-std-workspace-core Switch all libraries to the 2021 edition 2021-12-23 19:03:47 +08:00
rustc-std-workspace-std Switch all libraries to the 2021 edition 2021-12-23 19:03:47 +08:00
std Rollup merge of #110895 - Ayush1325:thread-local-fix, r=thomcc 2023-05-02 11:44:52 +05:30
stdarch@b655243782 Update stdarch 2023-03-19 20:41:22 +00:00
test Ensure test library issues json string line-by-line 2023-05-01 10:27:37 +02:00
unwind Rollup merge of #96971 - zhaixiaojuan:master, r=wesleywiser 2023-04-11 20:28:45 -07:00