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

Terminal color is not reset when a test fails with some signal #122

Closed
obfuscated opened this Issue Apr 9, 2018 · 12 comments

Comments

Projects
None yet
5 participants
@obfuscated
Copy link

obfuscated commented Apr 9, 2018

This simple test code:

TEST_CASE("failure") { int *a=nullptr; *a=5; }

can be used to reproduce the problem.

I'm testing on OS X at the moment. Don't know if this reproduces on Linux/Windows...

@onqtam

This comment has been minimized.

Copy link
Owner

onqtam commented Apr 30, 2018

Couldn't reproduce on Windows, but I checked the logic aaand:

  • if there is a signal and it is caught - the printSummary() function is called and it resets the terminal color at its end properly.
  • if the signal is not caught then the framework cannot do anything anyway

Do you get the SIGSEGV - Segmentation violation signal string printed?

@onqtam onqtam closed this Apr 30, 2018

@obfuscated

This comment has been minimized.

Copy link
Author

obfuscated commented Apr 30, 2018

Yes, I get a signal. What do you mean by not caught? You can always install signal handlers for SIGSEGV and do the correct thing when detected. The only signal that cannot be caught by an application is SIGKILL.

Windows has fake signals, so it is not a good idea to test there for this. Test on linux.

@onqtam

This comment has been minimized.

Copy link
Owner

onqtam commented May 3, 2018

By "not caught" I mean environments such as virtual machines with some linux where I've been unable to catch signals from crashes. But I'll reopen this issue to test it at some point in time.

@onqtam onqtam reopened this May 3, 2018

@patryk-oleniuk

This comment has been minimized.

Copy link

patryk-oleniuk commented Jul 26, 2018

I was able to reproduce this issue on Linux (Ubuntu 14.04)

test-error

@piluke

This comment has been minimized.

Copy link

piluke commented Nov 21, 2018

This is also happening for me when I kill it with Ctrl-C. I'm using doctest version 2.0.1.

@DenisYaroshevskiy

This comment has been minimized.

Copy link

DenisYaroshevskiy commented Feb 9, 2019

Hi

Just wanted to +1. Mac.

@onqtam

This comment has been minimized.

Copy link
Owner

onqtam commented Feb 9, 2019

@DenisYaroshevskiy I just pushed a change - let me know if it works for you!

@DenisYaroshevskiy

This comment has been minimized.

Copy link

DenisYaroshevskiy commented Feb 9, 2019

@onqtam - didn't help.
Did you update the single header?

@onqtam

This comment has been minimized.

Copy link
Owner

onqtam commented Feb 9, 2019

@DenisYaroshevskiy I did - but in the dev branch - it's not yet in master (should have clarified that). I also managed to reproduce the issue on my local linux and this commit managed to fix it: 2d36c23

Can you confirm that you indeed tried the dev branch? If so, I'll think about it more perhaps tomorrow.

@DenisYaroshevskiy

This comment has been minimized.

Copy link

DenisYaroshevskiy commented Feb 9, 2019

@onqtam - I used the link from the docs, so I doubt it. Can you give me a link to a new file?

@onqtam

This comment has been minimized.

Copy link
Owner

onqtam commented Feb 9, 2019

@DenisYaroshevskiy https://github.com/onqtam/doctest/blob/dev/doctest/doctest.h (the dev part from the URL is the branch - can be substituted for master or a specific version tag like 2.2.0)

@DenisYaroshevskiy

This comment has been minimized.

Copy link

DenisYaroshevskiy commented Feb 9, 2019

@onqtam - yes, now it fixed, thanks.

Thanks for letting me know about your test library - I'd use it from now on for my projects since it compiles so fast even with main in regular tests!

@onqtam onqtam closed this in 2d36c23 Feb 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment