未验证 提交 e7501497 编写于 作者: O openharmony_ci 提交者: Gitee

!1030 解决forkpty偶现失败问题

Merge pull request !1030 from jianyang/master
......@@ -40,22 +40,24 @@ void forkpty_0100(void)
fp = fopen("test1.txt", "w+");
fwrite(sign_r, sizeof(char), strlen(sign_r), fp);
fclose(fp);
exit(EXIT_SUCCESS);
} else {
wait(NULL);
fp = fopen("test2.txt", "w+");
fwrite(sign_r, sizeof(char), strlen(sign_r), fp);
fclose(fp);
FILE *fp1 = fopen("test1.txt", "r");
FILE *fp2 = fopen("test2.txt", "r");
fread(list1, sizeof(list1), 1, fp1);
fread(list2, sizeof(list2), 1, fp2);
EXPECT_EQ("forkpty_0100", list1[0], '1');
EXPECT_EQ("forkpty_0100", list2[0], '1');
fclose(fp1);
fclose(fp2);
remove("test1.txt");
remove("test2.txt");
}
sleep(1);
FILE *fp1 = fopen("test1.txt", "r");
FILE *fp2 = fopen("test2.txt", "r");
fread(list1, sizeof(list1), 1, fp1);
fread(list2, sizeof(list2), 1, fp2);
EXPECT_EQ("forkpty_0100", list1[0], '1');
EXPECT_EQ("forkpty_0100", list2[0], '1');
fclose(fp1);
fclose(fp2);
remove("test1.txt");
remove("test2.txt");
}
int main(int argc, char *argv[])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册