Need a way to report failed unit test to Jenkins

476 views
Skip to first unread message

satory66

unread,
Nov 7, 2013, 3:51:52 AM11/7/13
to googletes...@googlegroups.com
Hi,
I'm using google test to run unit tests on a build server. During a test execution I run "--gtest_output=xml:" to generate XML which will be parsed by Jenkins. Lately I noticed that some of unit tests being crashed with Segmentation Fault, but XML was created and it wasn't inidicate any failure and parsed by Jenkins as a succesfull test. I need a way to reflect crashed tests and mark them as failure. Please advise.

Josh Kelley

unread,
Nov 8, 2013, 9:03:53 AM11/8/13
to satory66, Google C++ Testing Framework
If your tests are segfaulting, then the test executable should have a nonzero exit status, and you should be able to set up your Jenkins job so that Jenkins sees the nonzero exit status and interprets it as a failed job (not just a failed test).  This is what we do for our unit tests.

Another option is to turn the segfault into a failed test.  On Windows, this involves using Structured Exception Handling.  (See http://stackoverflow.com/a/8234993/25507 for details for Visual C++.)  On Linux, this usually involves setting up a signal handler for SIGSEGV.  (Due to how signals work in POSIX, this can be difficult to do correctly and portably.)  See http://stackoverflow.com/q/2663456/25507 or http://linux.die.net/man/7/signal.

--
Josh Kelley


On Thu, Nov 7, 2013 at 3:51 AM, satory66 <sato...@gmail.com> wrote:
Hi,
I'm using google test to run unit tests on a build server. During a test execution I run "--gtest_output=xml:" to generate XML which will be parsed by Jenkins. Lately I noticed that some of unit tests being crashed with Segmentation Fault, but XML was created and it wasn't inidicate any failure and parsed by Jenkins as a succesfull test. I need a way to reflect crashed tests and mark them as failure. Please advise.

--
 
---
You received this message because you are subscribed to the Google Groups "Google C++ Testing Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to googletestframe...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages