mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
test(env): fix test_gnu_e20 for coverage run
This commit is contained in:
parent
f552a6cb8a
commit
5250b893a7
1 changed files with 13 additions and 7 deletions
|
@ -525,14 +525,20 @@ fn test_gnu_e20() {
|
||||||
let scene = TestScenario::new(util_name!());
|
let scene = TestScenario::new(util_name!());
|
||||||
|
|
||||||
let env_bin = String::from(uutests::util::get_tests_binary()) + " " + util_name!();
|
let env_bin = String::from(uutests::util::get_tests_binary()) + " " + util_name!();
|
||||||
|
let input = [
|
||||||
|
String::from("-i"),
|
||||||
|
String::from(r#"-SA="B\_C=D" "#) + env_bin.escape_default().to_string().as_str() + "",
|
||||||
|
];
|
||||||
|
|
||||||
let (input, output) = (
|
let mut output = "A=B C=D\n".to_string();
|
||||||
[
|
|
||||||
String::from("-i"),
|
// Workaround for the test to pass when coverage is being run.
|
||||||
String::from(r#"-SA="B\_C=D" "#) + env_bin.escape_default().to_string().as_str() + "",
|
// If enabled, the binary called by env_bin will most probably be
|
||||||
],
|
// instrumented for coverage, and thus will set the
|
||||||
"A=B C=D\n",
|
// __LLVM_PROFILE_RT_INIT_ONCE
|
||||||
);
|
if env::var("__LLVM_PROFILE_RT_INIT_ONCE").is_ok() {
|
||||||
|
output.push_str("__LLVM_PROFILE_RT_INIT_ONCE=__LLVM_PROFILE_RT_INIT_ONCE\n");
|
||||||
|
}
|
||||||
|
|
||||||
let out = scene.ucmd().args(&input).succeeds();
|
let out = scene.ucmd().args(&input).succeeds();
|
||||||
assert_eq!(out.stdout_str(), output);
|
assert_eq!(out.stdout_str(), output);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue