Skip to content

Commit 724ab39

Browse files
committed
remove tests after they pass
1 parent 2834fae commit 724ab39

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/bootstrap/render_tests.rs

+14-7
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
//! and rustc) libtest doesn't include the rendered human-readable output as a JSON field. We had
77
//! to reimplement all the rendering logic in this module because of that.
88
use std::collections::HashSet;
9-
use std::fs::OpenOptions;
9+
use std::fs::{File, OpenOptions};
1010
use std::io::{BufRead, BufReader, Read, Write};
11+
use std::path::Path;
1112
use std::process::{ChildStdout, Command, Stdio};
1213
use std::time::Duration;
1314

@@ -306,13 +307,19 @@ impl<'a> Renderer<'a> {
306307
fn init_tracking(&mut self) {
307308
let mut contents = String::new();
308309
{
309-
let mut file =
310-
OpenOptions::new().read(true).write(true).create(true).open(TRACKER_FILE).unwrap();
311-
file.read_to_string(&mut contents).unwrap();
312-
}
310+
let path = Path::new(TRACKER_FILE);
313311

314-
if !contents.is_empty() {
315-
self.tracker = serde_json::from_str(&contents).unwrap();
312+
if !path.exists() {
313+
let mut file = File::create(path).expect(&format!(
314+
"failed to create test.tracker | {:?}",
315+
path.canonicalize().unwrap()
316+
));
317+
file.write_all(b"[]").unwrap();
318+
} else {
319+
let mut file = File::open(path).expect("failed to open test.tracker");
320+
file.read_to_string(&mut contents).unwrap();
321+
self.tracker = serde_json::from_str(&contents).unwrap();
322+
}
316323
}
317324
}
318325

0 commit comments

Comments
 (0)