Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Unified Diff: syzygy/agent/asan/rtl_impl_unittest.cc

Issue 2576003002: Add the ability to defer the initialization of the SyzyAsan crash reporter. (Closed)
Patch Set: x64 def file. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: syzygy/agent/asan/rtl_impl_unittest.cc
diff --git a/syzygy/agent/asan/rtl_impl_unittest.cc b/syzygy/agent/asan/rtl_impl_unittest.cc
index 4a8426db9e6c520c560ccc71acdb101b8e13dfe5..5f00595d2cf5b9aaf4a99d5f152ea35f47caa32f 100644
--- a/syzygy/agent/asan/rtl_impl_unittest.cc
+++ b/syzygy/agent/asan/rtl_impl_unittest.cc
@@ -23,6 +23,9 @@
#include "syzygy/agent/asan/unittest_util.h"
#include "syzygy/core/unittest_util.h"
+namespace agent {
+namespace asan {
+
namespace {
class AsanRtlImplTest : public testing::TestWithAsanLogger {
@@ -32,7 +35,7 @@ class AsanRtlImplTest : public testing::TestWithAsanLogger {
void SetUp() override {
testing::TestWithAsanLogger::SetUp();
- asan_runtime_.SetUp(std::wstring());
+ asan_runtime_.SetUp(runtime_command_line_);
agent::asan::SetUpRtl(&asan_runtime_);
heap_ = asan_HeapCreate(0, 0, 0);
ASSERT_TRUE(heap_ != NULL);
@@ -56,6 +59,11 @@ class AsanRtlImplTest : public testing::TestWithAsanLogger {
// Scratch heap handle valid from SetUp to TearDown.
HANDLE heap_;
+
+ // The command line used to initialize the runtime. Empty by default but
+ // can be override by the derived classes to enable some runtime flags
+ // during setup.
+ std::wstring runtime_command_line_;
};
} // namespace
@@ -151,3 +159,24 @@ TEST_F(AsanRtlImplTest, SetInformationWithNullHeapPtr) {
asan_HeapSetInformation(NULL, HeapEnableTerminationOnCorruption,
NULL, 0));
}
+
+namespace {
+
+// Derived class that defers the crash reporter initialization.
+class AsanRtlImplTestCrashHandlerInitialization : public AsanRtlImplTest {
+ public:
+ AsanRtlImplTestCrashHandlerInitialization() {
+ runtime_command_line_ = L"--defer_crash_reporter_initialization";
+ }
+};
+
+} // namespace
+
+TEST_F(AsanRtlImplTestCrashHandlerInitialization, InitializeCrashHandler) {
+ EXPECT_FALSE(asan_runtime_.crash_reporter_initialized());
+ asan_InitializeCrashHandler();
+ EXPECT_TRUE(asan_runtime_.crash_reporter_initialized());
+}
+
+} // namespace asan
+} // namespace agent

Powered by Google App Engine
This is Rietveld 408576698