fix(ci): fix tests

This commit is contained in:
2026-07-23 19:53:24 +08:00
parent 594007f022
commit 5aefbc6498
2 changed files with 66 additions and 20 deletions

View File

@@ -119,6 +119,36 @@ pub fn host_profile_dir(project_root: &Path, profile: &str) -> PathBuf {
}
#[allow(dead_code)]
pub fn default_artifact_path(project_root: &Path, project_name: &str) -> PathBuf {
host_profile_dir(project_root, "debug").join(project_name)
pub fn bin_name(project_name: &str) -> String {
if cfg!(windows) {
format!("{project_name}.exe")
} else {
project_name.to_string()
}
}
#[allow(dead_code)]
pub fn default_artifact_path(project_root: &Path, project_name: &str) -> PathBuf {
host_profile_dir(project_root, "debug").join(bin_name(project_name))
}
#[allow(dead_code)]
pub fn artifact_candidates(dir: &Path, project_name: &str) -> Vec<PathBuf> {
let base = bin_name(project_name);
let bare = project_name.to_string();
vec![
dir.join(&base),
dir.join(&bare),
dir.join(format!("{project_name}.exe")),
]
}
#[allow(dead_code)]
pub fn assert_artifact_in(dir: &Path, project_name: &str, ctx: &str) {
let candidates = artifact_candidates(dir, project_name);
assert!(
candidates.iter().any(|p| p.is_file()),
"{ctx}: expected binary in {}, candidates: {candidates:?}",
dir.display()
);
}