catchorg / Catch2

A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)
https://discord.gg/4CWS9zD
Boost Software License 1.0
18.54k stars 3.05k forks source link

Regression with SECTIONs #1089

Open joto opened 6 years ago

joto commented 6 years ago

Description

I have a problem with some cases where SECTIONs are used. It looks like in addition to running each of the sections there is one run that goes through neither of the sections. This wasn't the case in Catch 1 and it also works on most systems on Catch 2, but on one system I see test failures because of that. The only difference I can see so far is that failing system is a 32bit Linux, everything else is 64 bit. Maybe I can dig some more, but wanted to raise this here in case somebody has an idea what it could be.

philsquared commented 6 years ago

I suspect it might be something to do with this:

https://github.com/catchorg/Catch2/blob/46c7c9d3a0cb975dabf5970cc65fd8fc72d4c5b5/docs/limitations.md#clangg----skipping-leaf-sections-after-an-exception

joto commented 6 years ago

When I run the tests by themselves, all is fine. So, yes, this could be the case you mentioned. But this used to work in Catch1, so I am not sure this is the fault of libc++. Something must have changed recently.

Seems I had problems with sections and exceptions before: #552.

horenmar commented 6 years ago

We did make one change in this - we found out that for libcxxrt we can fix the bug by using std::rethrow_exception(std::current_exception()) instead of throw;, so Catch now uses only the former way of rethrowing exceptions.


Newer version of libcxxrt have finally fixed this bug.

joto commented 6 years ago

I guess you are talking about #1028 and the fix for that in 70e0d4897. If I revert that commit, the problem goes away for me.

Only idea I have is that there could be some difference due to std::current_exception being allowed to either return a reference to the exception or a copy of it.

acidtonic commented 4 years ago

I just spent hours debugging this.... Same issue for me.

I am lining up client/server tests by spawning threads and I have matching sections for both sides....

Now my tests fail because the client skipped all sections and never tried to connect. Server path didn't skip any sections and is stuck on infinite listen(). Eventually adding variables to indicate which sections were hit showed all were skipped.