mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[platform] making restarter smoke test work on Windows
GitOrigin-RevId: db2251bbe12df368334856791384d603a36fa8e7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
69770b8a9d
commit
8bbdae0fa9
@@ -4,22 +4,26 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn smoke_test() {
|
||||
let restarter_file = env::current_exe().unwrap()
|
||||
.parent().unwrap().parent().unwrap()
|
||||
.join(if cfg!(target_os = "windows") { "restarter.exe" } else { "restarter" });
|
||||
let test_file = env::current_exe().unwrap();
|
||||
let bin_dir = test_file.parent().unwrap().parent().unwrap();
|
||||
let restarter_file = bin_dir.join(if cfg!(target_os = "windows") { "restarter.exe" } else { "restarter" });
|
||||
if !restarter_file.exists() {
|
||||
panic!("Does not exist: {restarter_file:?}");
|
||||
}
|
||||
|
||||
let list_cmd = if cfg!(target_os = "windows") { "dir" } else { "ls" };
|
||||
let file_path = restarter_file.to_str().unwrap();
|
||||
let output = std::process::Command::new(&restarter_file)
|
||||
.args(vec!["777777777", "2", list_cmd, file_path])
|
||||
.args(if cfg!(target_os = "windows") {
|
||||
vec!["777777777", "4", "cmd", "/c", "dir", file_path]
|
||||
} else {
|
||||
vec!["777777777", "2", "ls", file_path]
|
||||
})
|
||||
.output().unwrap();
|
||||
|
||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
let marker = if cfg!(target_os = "windows") { bin_dir.to_str().unwrap() } else { file_path };
|
||||
assert!(output.status.success(), "Failed: {}\n== stdout:\n{}\n== stderr:\n{}", output.status, stdout, stderr);
|
||||
assert!(stdout.contains(file_path), "Line '{}' not found in the output:\n{}", file_path, stdout);
|
||||
assert!(stdout.contains(marker), "Line '{}' not found in the output:\n{}", marker, stdout);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user