From a99a7e65e7809a9d01a1f78d516d62a01d4a37cf Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sat, 4 May 2024 19:47:16 -0500 Subject: [PATCH] Fix build failures when cmake never used FISH_BUILD_DIR (nominally, ./build) is created by cmake. If you only check out the project via git and then run `cargo build`, this directory won't exist and many of the tests will fail. --- src/tests/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tests/mod.rs b/src/tests/mod.rs index 21f7360ad..72932abbf 100644 --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -65,6 +65,9 @@ pub fn popd() { pub fn test_init() -> impl ScopeGuarding { static DONE: OnceCell<()> = OnceCell::new(); DONE.get_or_init(|| { + // If we are building with `cargo build` and have build w/ `cmake`, FISH_BUILD_DIR might + // not yet exist. + std::fs::create_dir_all(env!("FISH_BUILD_DIR")).unwrap(); set_current_dir(env!("FISH_BUILD_DIR")).unwrap(); { let s = CString::new("").unwrap();