-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SIGABRT - Abort (abnormal termination) signal #1169
Comments
One of your tests calls to |
Catch does not support multiple threads hitting assertions/sections, but as long as only one thread touches these, the use of multiple threads is OK. However, the test as it is now has another problem, in that if the assertions fail, it attempts to destruct a non-joined/non-detached thread, which aborts the program. Judging by your symptoms, my guess is that
Checking this is easy enough, just detach the thread after starting it. It shouldn't abort anymore, but you will have a permanently running thread instead. Alternatively use debugger to look around the incriminating code. |
Could it be the same problem I'm hitting? I have my own my_assert macro implementation and my unit test program provides a bool report_failure() function, which is invoked by my_assert when the condition is false. In this case its body is just REQUIRE_FALSE(assert_msg), where assert_msg is a const char* != null. In my actual non-unit test code I have:
The unit test I'm writing is for making sure that assert triggers correctly. To recap:
I get this output:
I can't really figure out what's going on, but it seems to be happening after Catch's ~AssertionHandler() returns. I don't spawn any threads, unlike the OP. Any help is very appreciated. |
@KingDuckZ If I understand you correctly, The problem here is that you are throwing an exception in a destructor that is not marked |
facepalm of course, I forgot destructors are implicitly noexcept! I could add some test_noexcept macro to every destructor declaration but that sounds hard to maintain and easy to forget... so I'll stick to just using CHECK. I hope this "REQUIRE throws, CHECK doesn't" rule is never going to change in Catch2! Thanks for spotting the problem! |
It won't, because the fundamental difference between the two assertion families is that a failed |
Description
Hi,guys, I'm using Catch2 to do unit testting for my project, I'm stuck with this exception:
The problem is that I write code on Mac os with (gcc 5.5.0 homebrew version not clang),and these tests work well, but it just raises exception on Debain.
Both of these compilers raise the above exception,and I also tried catch1.x, and still doesn't work.
Any help would be great appreciated.
The text was updated successfully, but these errors were encountered: