Do not run run-make tests in the test source directory
This commit is contained in:
parent
468310ea0c
commit
585c898495
@ -15,7 +15,7 @@ use crate::errors::{self, Error, ErrorKind};
|
|||||||
use crate::header::TestProps;
|
use crate::header::TestProps;
|
||||||
use crate::json;
|
use crate::json;
|
||||||
use crate::read2::{read2_abbreviated, Truncated};
|
use crate::read2::{read2_abbreviated, Truncated};
|
||||||
use crate::util::{add_dylib_path, dylib_env_var, logv, PathBufExt};
|
use crate::util::{add_dylib_path, copy_dir_all, dylib_env_var, logv, PathBufExt};
|
||||||
use crate::ColorConfig;
|
use crate::ColorConfig;
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
use miropt_test_tools::{files_for_miropt_test, MiroptTest, MiroptTestFile};
|
use miropt_test_tools::{files_for_miropt_test, MiroptTest, MiroptTestFile};
|
||||||
@ -3458,6 +3458,21 @@ impl<'test> TestCx<'test> {
|
|||||||
let rmake_out_dir = base_dir.join("rmake_out");
|
let rmake_out_dir = base_dir.join("rmake_out");
|
||||||
create_dir_all(&rmake_out_dir).unwrap();
|
create_dir_all(&rmake_out_dir).unwrap();
|
||||||
|
|
||||||
|
// Copy all input files (apart from rmake.rs) to the temporary directory,
|
||||||
|
// so that the input directory structure from `tests/run-make/<test>` is mirrored
|
||||||
|
// to the `rmake_out` directory.
|
||||||
|
for path in walkdir::WalkDir::new(&self.testpaths.file).min_depth(1) {
|
||||||
|
let path = path.unwrap().path().to_path_buf();
|
||||||
|
if path.file_name().map(|s| s != OsStr::new("rmake.rs")).unwrap_or(false) {
|
||||||
|
let target = rmake_out_dir.join(path.strip_prefix(&self.testpaths.file).unwrap());
|
||||||
|
if path.is_dir() {
|
||||||
|
copy_dir_all(&path, target).unwrap();
|
||||||
|
} else {
|
||||||
|
fs::copy(&path, target).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// HACK: assume stageN-target, we only want stageN.
|
// HACK: assume stageN-target, we only want stageN.
|
||||||
let stage = self.config.stage_id.split('-').next().unwrap();
|
let stage = self.config.stage_id.split('-').next().unwrap();
|
||||||
|
|
||||||
@ -3559,7 +3574,7 @@ impl<'test> TestCx<'test> {
|
|||||||
let target_rpath_env_path = env::join_paths(target_rpath_env_path).unwrap();
|
let target_rpath_env_path = env::join_paths(target_rpath_env_path).unwrap();
|
||||||
|
|
||||||
let mut cmd = Command::new(&recipe_bin);
|
let mut cmd = Command::new(&recipe_bin);
|
||||||
cmd.current_dir(&self.testpaths.file)
|
cmd.current_dir(&rmake_out_dir)
|
||||||
.stdout(Stdio::piped())
|
.stdout(Stdio::piped())
|
||||||
.stderr(Stdio::piped())
|
.stderr(Stdio::piped())
|
||||||
.env("LD_LIB_PATH_ENVVAR", dylib_env_var())
|
.env("LD_LIB_PATH_ENVVAR", dylib_env_var())
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::common::Config;
|
use crate::common::Config;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
use std::path::PathBuf;
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
use tracing::*;
|
use tracing::*;
|
||||||
@ -76,3 +76,17 @@ pub fn add_dylib_path(cmd: &mut Command, paths: impl Iterator<Item = impl Into<P
|
|||||||
let new_paths = paths.map(Into::into).chain(old_paths.into_iter().flatten());
|
let new_paths = paths.map(Into::into).chain(old_paths.into_iter().flatten());
|
||||||
cmd.env(dylib_env_var(), env::join_paths(new_paths).unwrap());
|
cmd.env(dylib_env_var(), env::join_paths(new_paths).unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn copy_dir_all(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> std::io::Result<()> {
|
||||||
|
std::fs::create_dir_all(&dst)?;
|
||||||
|
for entry in std::fs::read_dir(src)? {
|
||||||
|
let entry = entry?;
|
||||||
|
let ty = entry.file_type()?;
|
||||||
|
if ty.is_dir() {
|
||||||
|
copy_dir_all(entry.path(), dst.as_ref().join(entry.file_name()))?;
|
||||||
|
} else {
|
||||||
|
std::fs::copy(entry.path(), dst.as_ref().join(entry.file_name()))?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user