gn添加测试feature,修复测试会出现换行符的问题

Signed-off-by: 徐未来 <xuweilai2@huawei.com>
This commit is contained in:
徐未来 2024-02-21 11:48:26 +08:00
parent b222404168
commit 5d7d79c29f
2 changed files with 6 additions and 3 deletions

View File

@ -43,6 +43,7 @@ ohos_rust_systemtest("rust_ylong_runtime_test_sdv") {
"--cfg=feature=\"fs\"",
"--cfg=feature=\"macros\"",
"--cfg=feature=\"net\"",
"--cfg=feature=\"process\"",
"--cfg=feature=\"sync\"",
"--cfg=feature=\"signal\"",
"--cfg=feature=\"time\"",

View File

@ -107,7 +107,8 @@ fn sdv_process_child_stdio_test1() {
let stdout_handle = ylong_runtime::spawn(async move {
let mut buf = Vec::new();
stdout.read_to_end(&mut buf).await.unwrap();
assert_eq!(buf.as_slice(), b"!dlrow ,olleH");
let str = "!dlrow ,olleH";
assert!(String::from_utf8(buf).unwrap().contains(str));
});
let mut stderr = child.take_stderr().expect("Failed to open stderr");
@ -159,7 +160,8 @@ fn sdv_process_child_stdio_test2() {
let stdout_handle = ylong_runtime::spawn(async move {
let mut buf = Vec::new();
stdout.read_to_end(&mut buf).await.unwrap();
assert_eq!(buf.as_slice(), b"!dlrow ,olleH");
let str = "!dlrow ,olleH";
assert!(String::from_utf8(buf).unwrap().contains(str));
});
let mut stderr = child.take_stderr().expect("Failed to open stderr");
@ -211,7 +213,7 @@ fn sdv_process_try_wait_test() {
let mut child = command.spawn().unwrap();
loop {
if let Some(_) = child.try_wait().unwrap() {
if child.try_wait().unwrap().is_some() {
break;
}
}