ILXL / ILXL/cppaudit

Macros to execute compiled program don't force it to quit when test exits

Open
#40 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1
Forks
1
PR merge metrics
No merged PRs in 30d

Description

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().";
}
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the test macros that execute compiled programs and the TEST case shown in the report. Reproduce the failure with a program whose main has an infinite loop, then inspect how the macro launches and observes that process. Done means a failed or exiting test does not leave the compiled program running in the background.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.