From d519b474832e96e3140bae35b9f1128bb0caf972 Mon Sep 17 00:00:00 2001 From: Benjamin Smedberg Date: Fri, 11 Nov 2016 12:57:09 -0500 Subject: [PATCH] Bug 1306329 part B - Remove a few crashreporter tests which can no longer be implemented without linking to internal symbols. r=ted MozReview-Commit-ID: ChP1nRo2alE --HG-- extra : rebase_source : d79904ce7c33946bc61aaeb5c53195e993e55dd1 --- toolkit/crashreporter/test/CrashTestUtils.jsm | 7 ----- toolkit/crashreporter/test/nsTestCrasher.cpp | 14 ---------- .../test/unit/test_crash_runtimeabort.js | 21 --------------- .../test_crashreporter_crash_profile_lock.js | 26 ------------------- .../test/unit/test_event_files.js | 2 +- toolkit/crashreporter/test/unit/xpcshell.ini | 2 -- .../test/unit_ipc/test_content_annotation.js | 2 +- 7 files changed, 2 insertions(+), 72 deletions(-) delete mode 100644 toolkit/crashreporter/test/unit/test_crash_runtimeabort.js delete mode 100644 toolkit/crashreporter/test/unit/test_crashreporter_crash_profile_lock.js diff --git a/toolkit/crashreporter/test/CrashTestUtils.jsm b/toolkit/crashreporter/test/CrashTestUtils.jsm index 70162ab631f4..9916671d8825 100644 --- a/toolkit/crashreporter/test/CrashTestUtils.jsm +++ b/toolkit/crashreporter/test/CrashTestUtils.jsm @@ -6,7 +6,6 @@ this.EXPORTED_SYMBOLS = ["CrashTestUtils"]; this.CrashTestUtils = { // These will be defined using ctypes APIs below. crash: null, - lockDir: null, dumpHasStream: null, dumpHasInstructionPointerMemory: null, @@ -41,12 +40,6 @@ CrashTestUtils.saveAppMemory = lib.declare("SaveAppMemory", ctypes.default_abi, ctypes.uint64_t); -CrashTestUtils.lockDir = lib.declare("LockDir", - ctypes.default_abi, - ctypes.voidptr_t, // nsILocalFile* - ctypes.voidptr_t); // nsISupports* - - try { CrashTestUtils.TryOverrideExceptionHandler = lib.declare("TryOverrideExceptionHandler", ctypes.default_abi, diff --git a/toolkit/crashreporter/test/nsTestCrasher.cpp b/toolkit/crashreporter/test/nsTestCrasher.cpp index 1be001160be5..d0b7186c619e 100644 --- a/toolkit/crashreporter/test/nsTestCrasher.cpp +++ b/toolkit/crashreporter/test/nsTestCrasher.cpp @@ -3,7 +3,6 @@ #include #include "nscore.h" -#include "nsXULAppAPI.h" #include "nsExceptionHandler.h" #include "mozilla/Unused.h" @@ -43,7 +42,6 @@ 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; @@ -63,10 +61,6 @@ void Crash(int16_t how) // not reached break; } - case CRASH_RUNTIMEABORT: { - NS_RUNTIMEABORT("Intentional crash"); - break; - } case CRASH_OOM: { mozilla::Unused << moz_xmalloc((size_t) -1); mozilla::Unused << moz_xmalloc((size_t) -1); @@ -86,14 +80,6 @@ void Crash(int16_t how) } } -extern "C" NS_EXPORT -nsISupports* LockDir(nsIFile *directory) -{ - nsISupports* lockfile = nullptr; - XRE_LockProfileDirectory(directory, &lockfile); - return lockfile; -} - char testData[32]; extern "C" NS_EXPORT diff --git a/toolkit/crashreporter/test/unit/test_crash_runtimeabort.js b/toolkit/crashreporter/test/unit/test_crash_runtimeabort.js deleted file mode 100644 index ffb076cec9c1..000000000000 --- a/toolkit/crashreporter/test/unit/test_crash_runtimeabort.js +++ /dev/null @@ -1,21 +0,0 @@ -function run_test() -{ - if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) { - dump("INFO | test_crash_runtimeabort.js | Can't test crashreporter in a non-libxul build.\n"); - return; - } - - // Try crashing with a runtime abort - do_crash(function() { - crashType = CrashTestUtils.CRASH_RUNTIMEABORT; - crashReporter.annotateCrashReport("TestKey", "TestValue"); - }, - function(mdump, extra) { - do_check_eq(extra.TestKey, "TestValue"); - do_check_true(/xpcom_runtime_abort/.test(extra.Notes)); - do_check_false("OOMAllocationSize" in extra); - do_check_true(/Intentional crash/.test(extra.AbortMessage)); - }, - // process will exit with a zero exit status - true); -} diff --git a/toolkit/crashreporter/test/unit/test_crashreporter_crash_profile_lock.js b/toolkit/crashreporter/test/unit/test_crashreporter_crash_profile_lock.js deleted file mode 100644 index 78492ea5de80..000000000000 --- a/toolkit/crashreporter/test/unit/test_crashreporter_crash_profile_lock.js +++ /dev/null @@ -1,26 +0,0 @@ -function run_test() -{ - if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) { - dump("INFO | test_crashreporter.js | Can't test crashreporter in a non-libxul build.\n"); - return; - } - - // lock a profile directory, crash, and ensure that - // the profile lock signal handler doesn't interfere with - // writing a minidump - do_crash(function() { - let env = Components.classes["@mozilla.org/process/environment;1"] - .getService(Components.interfaces.nsIEnvironment); - // the python harness sets this in the environment for us - let profd = env.get("XPCSHELL_TEST_PROFILE_DIR"); - let dir = Components.classes["@mozilla.org/file/local;1"] - .createInstance(Components.interfaces.nsILocalFile); - dir.initWithPath(profd); - let lock = CrashTestUtils.lockDir(dir); - // when we crash, the lock file should be cleaned up - }, - function(mdump, extra) { - // if we got here, we have a minidump, so that's all we wanted - do_check_true(true); - }); -} diff --git a/toolkit/crashreporter/test/unit/test_event_files.js b/toolkit/crashreporter/test/unit/test_event_files.js index d57978e23d6d..facc4d035192 100644 --- a/toolkit/crashreporter/test/unit/test_event_files.js +++ b/toolkit/crashreporter/test/unit/test_event_files.js @@ -30,7 +30,7 @@ add_task(function* test_main_process_crash() { let scope = {}; Components.utils.import("resource://gre/modules/TelemetryController.jsm", scope); scope.TelemetryController.testSetup(); - crashType = CrashTestUtils.CRASH_RUNTIMEABORT; + crashType = CrashTestUtils.CRASH_MOZ_CRASH; crashReporter.annotateCrashReport("ShutdownProgress", "event-test"); }, (minidump, extra) => { diff --git a/toolkit/crashreporter/test/unit/xpcshell.ini b/toolkit/crashreporter/test/unit/xpcshell.ini index ca9778086cc3..dba80ac0f44b 100644 --- a/toolkit/crashreporter/test/unit/xpcshell.ini +++ b/toolkit/crashreporter/test/unit/xpcshell.ini @@ -8,7 +8,6 @@ support-files = [test_crash_moz_crash.js] [test_crash_purevirtual.js] -[test_crash_runtimeabort.js] [test_crash_after_js_oom_reported.js] [test_crash_after_js_oom_recovered.js] [test_crash_after_js_oom_reported_2.js] @@ -24,7 +23,6 @@ skip-if = os == 'win' [test_crash_with_memory_report.js] [test_crashreporter.js] [test_crashreporter_crash.js] -[test_crashreporter_crash_profile_lock.js] [test_override_exception_handler.js] skip-if = os != 'win' diff --git a/toolkit/crashreporter/test/unit_ipc/test_content_annotation.js b/toolkit/crashreporter/test/unit_ipc/test_content_annotation.js index 8a5c962e31f9..c0628d808d11 100644 --- a/toolkit/crashreporter/test/unit_ipc/test_content_annotation.js +++ b/toolkit/crashreporter/test/unit_ipc/test_content_annotation.js @@ -9,7 +9,7 @@ function run_test() // Try crashing with a runtime abort do_content_crash(function() { - crashType = CrashTestUtils.CRASH_RUNTIMEABORT; + crashType = CrashTestUtils.CRASH_MOZ_CRASH; crashReporter.annotateCrashReport("TestKey", "TestValue"); crashReporter.appendAppNotesToCrashReport("!!!foo!!!"); },