Include better context for "already exists" error in compiletest

This commit is contained in:
David Tolnay 2023-05-14 07:13:00 -07:00
parent 3603a84a3d
commit 6b7b7758d0
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
3 changed files with 8 additions and 1 deletions

View File

@ -723,6 +723,7 @@ dependencies = [
name = "compiletest"
version = "0.0.0"
dependencies = [
"anyhow",
"build_helper",
"colored",
"diff",

View File

@ -20,6 +20,7 @@ once_cell = "1.16.0"
walkdir = "2"
glob = "0.3.0"
lazycell = "1.3.0"
anyhow = "1"
[target.'cfg(unix)'.dependencies]
libc = "0.2"

View File

@ -32,6 +32,7 @@ use std::process::{Child, Command, ExitStatus, Output, Stdio};
use std::str;
use std::sync::Arc;
use anyhow::Context;
use glob::glob;
use once_cell::sync::Lazy;
use tracing::*;
@ -131,7 +132,11 @@ pub fn run(config: Arc<Config>, testpaths: &TestPaths, revision: Option<&str>) {
}
let cx = TestCx { config: &config, props: &props, testpaths, revision };
create_dir_all(&cx.output_base_dir()).unwrap();
create_dir_all(&cx.output_base_dir())
.with_context(|| {
format!("failed to create output base directory {}", cx.output_base_dir().display())
})
.unwrap();
if props.incremental {
cx.init_incremental_test();
}