-
Type:
Improvement
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: Testing Infrastructure
-
None
-
Fully Compatible
-
0
Unit tests that cause segfaults (access violations) exit silently (or almost silently) with a non-zero exit code. They should instead print a message indicating that a segfault has occurred, print a stack trace, and then exit.
Sample code:
TEST_F(AllNodesDown, ReadFromPrimary) { #if 1 char* crash = reinterpret_cast<char*>(0x123); *crash = 'A'; #endif // ... }
Program output:
4:05:01.15 C:\Visual Studio 2010 Projects\mongodev> build\win32\64\dd\mongo\dbclient_rs_test.exe Mon Aug 05 04:05:43.286 going to run suite: AllNodesDown Mon Aug 05 04:05:43.289 going to run test: ReadFromPrimary 4:05:45.45 C:\Visual Studio 2010 Projects\mongodev> echo %ERRORLEVEL% -1073741819
tad@Ubuntu-1204-x64 ~/mongo/mongodev (SERVER-8707-04) $ build/linux2/64/dd/mongo/dbclient_rs_test Mon Aug 5 04:15:07.794 going to run suite: AllNodesDown Mon Aug 5 04:15:07.801 going to run test: ReadFromPrimary Segmentation fault (core dumped) tad@Ubuntu-1204-x64 ~/mongo/mongodev (SERVER-8707-04) $ echo $? 139