boostorg / boostorg/test

Manually added test case does not timeout

Open
#283 0 comments 0 reactions 1 assignee Claimed by @raffienficiaud View on GitHub
bug
Dominant language
C++
Stars
213
Forks
149
Avg merge
18h 17m
Merged PRs (30d)
2

Description

boost version: 1.73.0

My project needs a test suite on which several functions with the same
signature are called on the same list of datasets.
I resolved that a test suite built this way (see code below) as seen
on similar examples fits my scenario.
However, manually added test cases do not abide to the timeout values assigned.

This code shows a minimal working example:
```
#include

#include
#include

using namespace boost::unit_test;
using namespace boost;

void test_f()
{
using namespace std::chrono_literals;
std::this_thread::sleep_for(5s); // this function will run for 5 seconds
}

struct my_test_suite : public test_suite
{
my_test_suite(): test_suite("A test suite")
{
auto *tc =
BOOST_TEST_CASE(test_f);
tc->p_timeout.value=1; // 1 second timeout
add(tc);
}
};

test_suite* init_unit_test_suite(int argc,char* argv[])
{
framework::master_test_suite().p_name.value = "my UT suite";
framework::master_test_suite().add( new my_test_suite );
return 0;
}
```

Expected: failure of the test for timeout.
Outcome: all test cases pass.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.