bug 717758 - Breakpad test for abort() crashes. r=glandium
authorTed Mielczarek <ted@mielczarek.org>
Mon, 16 Sep 2013 14:44:25 -0400
changeset 147742 742c8c54c8fc2f74a6a73bb0bbf0c9c2255344c7
parent 147741 62cba8b2fd7d4686c92bb322b6f3904236df3c83
child 147743 751208f98deb40a28e2ef6a1f32f1ff9ffe1f66b
push id25314
push userkwierso@gmail.com
push dateWed, 18 Sep 2013 23:48:47 +0000
treeherdermozilla-central@dc09d922d41f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs717758
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 717758 - Breakpad test for abort() crashes. r=glandium
toolkit/crashreporter/test/CrashTestUtils.jsm
toolkit/crashreporter/test/nsTestCrasher.cpp
toolkit/crashreporter/test/unit/test_crash_abort.js
toolkit/crashreporter/test/unit/xpcshell.ini
--- a/toolkit/crashreporter/test/CrashTestUtils.jsm
+++ b/toolkit/crashreporter/test/CrashTestUtils.jsm
@@ -1,9 +1,10 @@
-// XXXkhuey this needs a license header.
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 this.EXPORTED_SYMBOLS = ["CrashTestUtils"];
 
 this.CrashTestUtils = {
   // These will be defined using ctypes APIs below.
   crash: null,
   lockDir: null,
   dumpHasStream: null,
@@ -11,16 +12,17 @@ this.CrashTestUtils = {
 
   // Constants for crash()
   // Keep these in sync with nsTestCrasher.cpp!
   CRASH_INVALID_POINTER_DEREF: 0,
   CRASH_PURE_VIRTUAL_CALL:     1,
   CRASH_RUNTIMEABORT:          2,
   CRASH_OOM:                   3,
   CRASH_MOZ_CRASH:             4,
+  CRASH_ABORT:                 5,
 
   // Constants for dumpHasStream()
   // From google_breakpad/common/minidump_format.h
   MD_THREAD_LIST_STREAM:       3,
   MD_MEMORY_INFO_LIST_STREAM:  16
 };
 
 // Grab APIs from the testcrasher shared library
--- a/toolkit/crashreporter/test/nsTestCrasher.cpp
+++ b/toolkit/crashreporter/test/nsTestCrasher.cpp
@@ -41,16 +41,17 @@ void PureVirtualCall()
 }
 
 // Keep these in sync with CrashTestUtils.jsm!
 const int16_t CRASH_INVALID_POINTER_DEREF = 0;
 const int16_t CRASH_PURE_VIRTUAL_CALL     = 1;
 const int16_t CRASH_RUNTIMEABORT          = 2;
 const int16_t CRASH_OOM                   = 3;
 const int16_t CRASH_MOZ_CRASH             = 4;
+const int16_t CRASH_ABORT                 = 5;
 
 extern "C" NS_EXPORT
 void Crash(int16_t how)
 {
   switch (how) {
   case CRASH_INVALID_POINTER_DEREF: {
     volatile int* foo = (int*)0x42;
     *foo = 0;
@@ -71,16 +72,20 @@ void Crash(int16_t how)
     mozilla::unused << moz_xmalloc((size_t) -1);
     mozilla::unused << moz_xmalloc((size_t) -1);
     break;
   }
   case CRASH_MOZ_CRASH: {
     MOZ_CRASH();
     break;
   }
+  case CRASH_ABORT: {
+    abort();
+    break;
+  }
   default:
     break;
   }
 }
 
 extern "C" NS_EXPORT
 nsISupports* LockDir(nsIFile *directory)
 {
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/test/unit/test_crash_abort.js
@@ -0,0 +1,16 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+function run_test()
+{
+  // Try crashing with an abort().
+  do_crash(function() {
+             crashType = CrashTestUtils.CRASH_ABORT;
+             crashReporter.annotateCrashReport("TestKey", "TestValue");
+           },
+           function(mdump, extra) {
+             do_check_eq(extra.TestKey, "TestValue");
+           },
+          // process will exit with a zero exit status
+          true);
+}
--- a/toolkit/crashreporter/test/unit/xpcshell.ini
+++ b/toolkit/crashreporter/test/unit/xpcshell.ini
@@ -3,16 +3,19 @@ head = head_crashreporter.js
 tail = 
 
 [test_crash_moz_crash.js]
 [test_crash_purevirtual.js]
 [test_crash_runtimeabort.js]
 [test_crash_oom.js]
 skip-if = os == 'win' && debug
 
+[test_crash_abort.js]
+skip-if = os == 'win'
+
 [test_crashreporter.js]
 [test_crashreporter_crash.js]
 [test_crashreporter_crash_profile_lock.js]
 [test_override_exception_handler.js]
 run-if = os == 'win'
 
 [test_crashreporter_appmem.js]
 run-if = os == 'win' || os == 'linux'