diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/runtime/atomic-print.rs | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/runtime/atomic-print.rs')
-rw-r--r-- | src/test/ui/runtime/atomic-print.rs | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/test/ui/runtime/atomic-print.rs b/src/test/ui/runtime/atomic-print.rs deleted file mode 100644 index fe5791053..000000000 --- a/src/test/ui/runtime/atomic-print.rs +++ /dev/null @@ -1,45 +0,0 @@ -// run-pass - -#![allow(unused_must_use)] -#![allow(deprecated)] -// ignore-emscripten no threads support -// ignore-sgx no processes - -use std::{env, fmt, process, sync, thread}; - -struct SlowFmt(u32); -impl fmt::Debug for SlowFmt { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - thread::sleep_ms(3); - self.0.fmt(f) - } -} - -fn do_print(x: u32) { - let x = SlowFmt(x); - println!("{:?}{:?}{:?}{:?}{:?}", x, x, x, x, x); -} - -fn main(){ - if env::args().count() == 2 { - let barrier = sync::Arc::new(sync::Barrier::new(2)); - let tbarrier = barrier.clone(); - let t = thread::spawn(move || { - tbarrier.wait(); - do_print(1); - }); - barrier.wait(); - do_print(2); - t.join(); - } else { - let this = env::args().next().unwrap(); - let output = process::Command::new(this).arg("-").output().unwrap(); - for line in String::from_utf8(output.stdout).unwrap().lines() { - match line.chars().next().unwrap() { - '1' => assert_eq!(line, "11111"), - '2' => assert_eq!(line, "22222"), - chr => panic!("unexpected character {:?}", chr) - } - } - } -} |