Macros to execute compiled program don't force it to quit when test exits
还没有人认领这个 Issue。
- 主要语言
- C++
- 星标
- 1
- 派生
- 1
- PR 合并指标
- 30 天内没有已合并 PR
描述
If main has an infinite loop, it'll just keep running as a process in the background even after the test has failed.
This became obvious in Paint Milestone 4 tests when a window was displayed. Here's how I solved it (although in this case I was looking for a timeout):
TEST(PaintProgramTest, StartShowsImage) {
std::chrono::time_point start, end;
start = std::chrono::system_clock::now();
system("timeout 1s ./main");
end = std::chrono::system_clock::now();
std::chrono::duration elapsed_seconds = end - start;
std::chrono::milliseconds ms =
std::chrono::duration_cast(elapsed_seconds);
if (ms.count() <= 900) {
FAIL() << " main() should call PaintProgram::Start() which calls "
"Image::ShowUntilClosed().";
}
}
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先定位执行已编译程序的测试宏,以及报告中所示的 TEST 用例。使用 main 包含无限循环的程序重现该故障,然后检查宏如何启动并观察该进程。完成的标准是:失败或退出的测试不会让已编译程序继续在后台运行。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- cpp
- 领域
- testing-qa
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100