Skip to content

Commit 2d3aa52

Browse files
committed
skip the test if the binary doesn't exist (cross compile)
1 parent ce14b16 commit 2d3aa52

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/test_util_name.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ fn execution_phrase_double() {
1313
use std::process::Command;
1414

1515
let scenario = TestScenario::new("ls");
16+
if scenario.bin_path.exists() {
17+
println!("Skipping test: Binary not found at {:?}", scenario.bin_path);
18+
}
1619
let output = Command::new(&scenario.bin_path)
1720
.arg("ls")
1821
.arg("--some-invalid-arg")
@@ -32,6 +35,9 @@ fn util_name_double() {
3235
};
3336

3437
let scenario = TestScenario::new("sort");
38+
if scenario.bin_path.exists() {
39+
println!("Skipping test: Binary not found at {:?}", scenario.bin_path);
40+
}
3541
let mut child = Command::new(&scenario.bin_path)
3642
.arg("sort")
3743
.stdin(Stdio::piped())
@@ -54,6 +60,10 @@ fn util_name_single() {
5460
};
5561

5662
let scenario = TestScenario::new("sort");
63+
if scenario.bin_path.exists() {
64+
println!("Skipping test: Binary not found at {:?}", scenario.bin_path);
65+
}
66+
5767
symlink_file(&scenario.bin_path, scenario.fixtures.plus("uu-sort")).unwrap();
5868
let mut child = Command::new(scenario.fixtures.plus("uu-sort"))
5969
.stdin(Stdio::piped())
@@ -75,6 +85,9 @@ fn util_invalid_name_help() {
7585
use std::process::{Command, Stdio};
7686

7787
let scenario = TestScenario::new("invalid_name");
88+
if scenario.bin_path.exists() {
89+
println!("Skipping test: Binary not found at {:?}", scenario.bin_path);
90+
}
7891
symlink_file(&scenario.bin_path, scenario.fixtures.plus("invalid_name")).unwrap();
7992
let child = Command::new(scenario.fixtures.plus("invalid_name"))
8093
.arg("--help")
@@ -109,6 +122,10 @@ fn util_non_utf8_name_help() {
109122

110123
let scenario = TestScenario::new("invalid_name");
111124
let non_utf8_path = scenario.fixtures.plus(OsStr::from_bytes(b"\xff"));
125+
if scenario.bin_path.exists() {
126+
println!("Skipping test: Binary not found at {:?}", scenario.bin_path);
127+
}
128+
112129
symlink_file(&scenario.bin_path, &non_utf8_path).unwrap();
113130
let child = Command::new(&non_utf8_path)
114131
.arg("--help")
@@ -135,6 +152,10 @@ fn util_invalid_name_invalid_command() {
135152

136153
let scenario = TestScenario::new("invalid_name");
137154
symlink_file(&scenario.bin_path, scenario.fixtures.plus("invalid_name")).unwrap();
155+
if scenario.bin_path.exists() {
156+
println!("Skipping test: Binary not found at {:?}", scenario.bin_path);
157+
}
158+
138159
let child = Command::new(scenario.fixtures.plus("invalid_name"))
139160
.arg("definitely_invalid")
140161
.stdin(Stdio::piped())
@@ -157,6 +178,10 @@ fn util_completion() {
157178
use std::process::{Command, Stdio};
158179

159180
let scenario = TestScenario::new("completion");
181+
if scenario.bin_path.exists() {
182+
println!("Skipping test: Binary not found at {:?}", scenario.bin_path);
183+
}
184+
160185
let child = Command::new(&scenario.bin_path)
161186
.arg("completion")
162187
.arg("true")
@@ -182,6 +207,10 @@ fn util_manpage() {
182207
use std::process::{Command, Stdio};
183208

184209
let scenario = TestScenario::new("completion");
210+
if scenario.bin_path.exists() {
211+
println!("Skipping test: Binary not found at {:?}", scenario.bin_path);
212+
}
213+
185214
let child = Command::new(&scenario.bin_path)
186215
.arg("manpage")
187216
.arg("true")

0 commit comments

Comments
 (0)