Skip to content

Commit 9cbdece

Browse files
committed
fix(go-runner): run tests in real project dir
1 parent f29b574 commit 9cbdece

1 file changed

Lines changed: 5 additions & 14 deletions

File tree

go-runner/src/integration_tests.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,6 @@ use tempfile::TempDir;
66

77
use crate::results::walltime_results::WalltimeResults;
88

9-
fn setup_test_project(project_name: &str) -> anyhow::Result<TempDir> {
10-
let project_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
11-
.join("testdata/projects")
12-
.join(project_name);
13-
println!("Project path: {project_path:?}");
14-
15-
let temp_dir = TempDir::new()?;
16-
crate::utils::copy_dir_recursively(&project_path, &temp_dir)?;
17-
18-
Ok(temp_dir)
19-
}
20-
219
fn assert_results_snapshots(profile_dir: &Path, project_name: &str) {
2210
let glob_pattern = profile_dir.join("results");
2311
if !glob_pattern.exists() {
@@ -73,19 +61,22 @@ fn assert_results_snapshots(profile_dir: &Path, project_name: &str) {
7361
#[case::fuego("fuego")]
7462
#[case::cli_runtime("cli-runtime")]
7563
fn test_build_and_run(#[case] project_name: &str) {
76-
let temp_dir = setup_test_project(project_name).unwrap();
64+
let project_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
65+
.join("testdata/projects")
66+
.join(project_name);
7767

7868
// Mutex to prevent concurrent tests from interfering with CODSPEED_PROFILE_FOLDER env var
7969
static ENV_MUTEX: Mutex<()> = Mutex::new(());
8070
let _env_guard = ENV_MUTEX.lock().unwrap_or_else(|e| e.into_inner());
8171

72+
let temp_dir = TempDir::new().unwrap();
8273
let profile_dir = temp_dir.path().join("profile");
8374
unsafe { std::env::set_var("CODSPEED_PROFILE_FOLDER", &profile_dir) };
8475
let cli = crate::cli::Cli {
8576
benchtime: "1x".into(),
8677
..Default::default()
8778
};
88-
if let Err(error) = crate::run_benchmarks(temp_dir.path(), &cli) {
79+
if let Err(error) = crate::run_benchmarks(project_dir.as_path(), &cli) {
8980
panic!("Benchmarks couldn't run: {error}");
9081
}
9182

0 commit comments

Comments
 (0)