catchorg / catchorg/Catch2

Executable doesn't terminate

Open
#1,619 3 comments 0 reactions 0 assignees View on GitHub
Not a bug Resolved - pending review
Dominant language
C++
Stars
21.5k
Forks
3.5k
Avg merge
3d 16h
Merged PRs (30d)
2

Description

**Describe the bug**
After compiling and starting the executable, the test program starts but doesn't terminate (and also doesn't print any output)

**Expected behavior**
The program terminates with all tests (1/1, 1 assert) passed within at most 10 seconds (more like within a fraction of a second, but I'll give it 10 seconds to allow for Windows delays)

**Reproduction steps**
1. Create a directory with `catch.hpp` and a file `test.cpp` with the following test
```
#define CATCH_CONFIG_MAIN
#include "catch.hpp"

TEST_CASE( "--test name--", "[tags]" ) {
char val = GENERATE(random(0, 1));
}
```
2. Command: `g++ -Wall -Wextra -o test.exe test.cpp && echo "running tests" && ./test.exe`
(Note: also does not work with seperate g++ and running commands)

**Platform information:**

- OS: **Windows 10, build 17763.437**
- Compiler+version: **gcc version 8.2.0 (MinGW.org GCC-8.2.0-3)**
- Catch version: **v2.7.2**
- Command was ran from GitBash shell and cygwin shell, both exhibit this bug.

**Additional context**
This is a minimized version of the bug (i.e. I reduced the test to the bare minimum to get the bug to appear)
The values for `random` don't influence the bug.
The program uses 12.5% CPU time. Since I have 8 cores, I assume it is hogging a core.

Contributor guide

Open the contributing guide

Research direction

Reproduce the hang with the provided test.cpp, catch.hpp, and the g++ command on the reported Windows and MinGW setup. Start by tracing the minimal TEST_CASE that calls GENERATE(random(0, 1)); done means the executable terminates within 10 seconds and reports the single passing test with its assertion.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing
Issue type
Bug
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.