diff options
| author | David Tolnay <dtolnay@gmail.com> | 2023-05-14 07:13:00 -0700 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2023-05-14 07:16:17 -0700 |
| commit | 6b7b7758d00710d093c542d3f8dbbf434cb26df3 (patch) | |
| tree | 86d05f3e6f23b601e6ed5d9cb97d0c3b30eb4e8b | |
| parent | 3603a84a3d74d0b70dbbdaa47ed8f8a306f3fe7f (diff) | |
| download | rust-6b7b7758d00710d093c542d3f8dbbf434cb26df3.tar.gz rust-6b7b7758d00710d093c542d3f8dbbf434cb26df3.zip | |
Include better context for "already exists" error in compiletest
| -rw-r--r-- | Cargo.lock | 1 | ||||
| -rw-r--r-- | src/tools/compiletest/Cargo.toml | 1 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 7 |
3 files changed, 8 insertions, 1 deletions
diff --git a/Cargo.lock b/Cargo.lock index 60686c87359..e71d97a6303 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -723,6 +723,7 @@ dependencies = [ name = "compiletest" version = "0.0.0" dependencies = [ + "anyhow", "build_helper", "colored", "diff", diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml index 0d42504c7f4..e5297d41a61 100644 --- a/src/tools/compiletest/Cargo.toml +++ b/src/tools/compiletest/Cargo.toml @@ -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" diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 4ede4603789..5bc4d164265 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -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(); } |
