sfrehse / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

gtest_break_on_failure does not honour EXPECT_FATAL_FAILURE #227

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Compile and run the attached file with default settings. Test succeeds.
2. Run the attached file with --gtest_break_on_failure. It breaks into the 
debugger on Windows (can continue), and breaks with invalid memory access 
(cannot continue) on other platforms.

What is the expected output? What do you see instead?

I would expect it to not break since the failure is expected. On non-
windows, I would expect to at least be able to continue, but cannot since 
writing to NULL pointer stops everything.

What version of the product are you using? On what operating system?

gtest-1.4.0 on windows and, um, linux

Please provide any additional information below, such as a code snippet.

See the attached main.cpp

Original issue reported on code.google.com by villi...@gmail.com on 24 Nov 2009 at 5:03

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the report.  I set the priority low as EXPECT_FATAL_FAILURE is used
relatively rarely, and the bug doesn't affect the correctness of the tests.

Original comment by w...@google.com on 3 Dec 2009 at 4:34

GoogleCodeExporter commented 9 years ago
I'm seeing this same problem with not being able to continue from a simple 
"EXPECT_TRUE".  This is running gtest-1.6.0 on Ubuntu 12.04.

Original comment by jwerne...@gmail.com on 30 Oct 2013 at 7:43

GoogleCodeExporter commented 9 years ago
I found a quick fix by inserting a "raise(SIGINT) in gtest.cc.  Here's the diff

*** gtest.cc    2013-10-30 15:52:46.457834253 -0400
--- gtest.cc.orig       2013-10-30 16:04:55.733866604 -0400
***************
*** 63,70 ****
  # include <unistd.h>  // NOLINT
  # include <string>

- #include <signal.h>
- 
  #elif GTEST_OS_SYMBIAN
  # define GTEST_HAS_GETTIMEOFDAY_ 1
  # include <sys/time.h>  // NOLINT
--- 63,68 ----
***************
*** 3789,3796 ****
        // when a failure happens and both the --gtest_break_on_failure and
        // the --gtest_catch_exceptions flags are specified.
        DebugBreak();
- #elif GTEST_OS_LINUX
-       raise(SIGINT);
  #else
        // Dereference NULL through a volatile pointer to prevent the compiler
        // from removing. We use this rather than abort() or __builtin_trap() for
--- 3787,3792 ----

Original comment by jwerne...@gmail.com on 30 Oct 2013 at 8:07