Skip to content

Commit

Permalink
win: Fix SimulateCrash.ChildDumpWithoutCrashing under ASAN, disable o…
Browse files Browse the repository at this point in the history
…thers

SimulateCrash.ChildDumpWithoutCrashing needed a larger threshold due to
ASAN instrumentation.

These tests expect children to crash, but ASAN captures the exception
before letting Crashpad handle it:

CrashpadClient.HandlerLaunchFailureCrash
CrashpadClient.HandlerLaunchFailureDumpAndCrash
CrashpadHandler.ExtensibilityCalloutsWork
ExceptionSnapshotWinTest.ChildCrash

(which is an upstreaming of https://chromium-review.googlesource.com/1067151).

Additionally, because Chrome doesn't build all, I noticed a missing
dependency on a test binary which is added here.


Bug: chromium:845011
Change-Id: I5c3ae5673512be29edad21e7d20dd57b8b5ce2bf
Reviewed-on: https://chromium-review.googlesource.com/1075715
Reviewed-by: Joshua Peraza <[email protected]>
Commit-Queue: Scott Graham <[email protected]>
  • Loading branch information
sgraham authored and Commit Bot committed May 29, 2018
1 parent 3033802 commit 5191992
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
17 changes: 15 additions & 2 deletions client/crashpad_client_win_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,13 @@ class HandlerLaunchFailureCrash : public WinMultiprocess {
}
};

TEST(CrashpadClient, HandlerLaunchFailureCrash) {
#if defined(ADDRESS_SANITIZER)
// https://crbug.com/845011
#define MAYBE_HandlerLaunchFailureCrash DISABLED_HandlerLaunchFailureCrash
#else
#define MAYBE_HandlerLaunchFailureCrash HandlerLaunchFailureCrash
#endif
TEST(CrashpadClient, MAYBE_HandlerLaunchFailureCrash) {
WinMultiprocess::Run<HandlerLaunchFailureCrash>();
}

Expand All @@ -150,7 +156,14 @@ class HandlerLaunchFailureDumpAndCrash : public WinMultiprocess {
}
};

TEST(CrashpadClient, HandlerLaunchFailureDumpAndCrash) {
#if defined(ADDRESS_SANITIZER)
// https://crbug.com/845011
#define MAYBE_HandlerLaunchFailureDumpAndCrash \
DISABLED_HandlerLaunchFailureDumpAndCrash
#else
#define MAYBE_HandlerLaunchFailureDumpAndCrash HandlerLaunchFailureDumpAndCrash
#endif
TEST(CrashpadClient, MAYBE_HandlerLaunchFailureDumpAndCrash) {
WinMultiprocess::Run<HandlerLaunchFailureDumpAndCrash>();
}

Expand Down
1 change: 1 addition & 0 deletions handler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ source_set("handler_test") {
if (crashpad_is_win) {
data_deps = [
":crashpad_handler_test_extended_handler",
":fake_handler_that_crashes_at_startup",
]
}
}
Expand Down
8 changes: 7 additions & 1 deletion handler/crashpad_handler_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,13 @@ void CrashWithExtendedHandler::ValidateGeneratedDump() {
EXPECT_EQ(found_extension_streams, 1u);
}

TEST(CrashpadHandler, ExtensibilityCalloutsWork) {
#if defined(ADDRESS_SANITIZER)
// https://crbug.com/845011
#define MAYBE_ExtensibilityCalloutsWork DISABLED_ExtensibilityCalloutsWork
#else
#define MAYBE_ExtensibilityCalloutsWork ExtensibilityCalloutsWork
#endif
TEST(CrashpadHandler, MAYBE_ExtensibilityCalloutsWork) {
WinMultiprocessWithTempDir::Run<CrashWithExtendedHandler>();
}

Expand Down
14 changes: 13 additions & 1 deletion snapshot/win/exception_snapshot_win_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,13 @@ void TestCrashingChild(TestPaths::Architecture architecture) {
EXPECT_EQ(child.WaitForExit(), EXCEPTION_BREAKPOINT);
}

TEST(ExceptionSnapshotWinTest, ChildCrash) {
#if defined(ADDRESS_SANITIZER)
// https://crbug.com/845011
#define MAYBE_ChildCrash DISABLED_ChildCrash
#else
#define MAYBE_ChildCrash ChildCrash
#endif
TEST(ExceptionSnapshotWinTest, MAYBE_ChildCrash) {
TestCrashingChild(TestPaths::Architecture::kDefault);
}

Expand Down Expand Up @@ -204,7 +210,13 @@ class SimulateDelegate : public ExceptionHandlerServer::Delegate {

// Verify the dump was captured at the expected location with some slop
// space.
#if defined(ADDRESS_SANITIZER)
// ASan instrumentation inserts more instructions between the expected
// location and what's reported. https://crbug.com/845011.
constexpr uint64_t kAllowedOffset = 500;
#else
constexpr uint64_t kAllowedOffset = 100;
#endif
EXPECT_GT(snapshot.Exception()->Context()->InstructionPointer(),
dump_near_);
EXPECT_LT(snapshot.Exception()->Context()->InstructionPointer(),
Expand Down

0 comments on commit 5191992

Please sign in to comment.