Skip to content

Commit

Permalink
chore: fallback to cwd if CARGO_MANIFEST_DIR env var is not set
Browse files Browse the repository at this point in the history
Needed when running `cargo flamegraph --root` for #317
  • Loading branch information
greenhat committed Sep 11, 2024
1 parent e1c3e88 commit f23a2e7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/integration/src/compiler_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use core::panic;
use std::{
borrow::Cow,
fmt, fs,
env, fmt, fs,
io::Read,
path::{Path, PathBuf},
process::{Command, Stdio},
Expand Down Expand Up @@ -1174,7 +1174,8 @@ pub fn sdk_crate_path() -> PathBuf {
/// Get the directory for the top-level workspace
fn get_workspace_dir() -> String {
// Get the directory for the integration test suite project
let cargo_manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
let cargo_manifest_dir = std::env::var("CARGO_MANIFEST_DIR")
.unwrap_or(env::current_dir().unwrap().to_str().unwrap().to_string());
let cargo_manifest_dir_path = Path::new(&cargo_manifest_dir);
// "Exit" the integration test suite project directory to the compiler workspace directory
// i.e. out of the `tests/integration` directory
Expand Down

0 comments on commit f23a2e7

Please sign in to comment.