Skip ElfCoreDumpTest and LinuxCoreDumperTest on Android if no core file is dumped.

On certain versions of Android (specifically JellyBean MR2 on Nexus 7, possibly
others too) no ELF core dump is created for crashing processes.  Check for this
and skip the test if so.

BUG=364943
R=thestig@chromium.org

Review URL: https://breakpad.appspot.com/1624003

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1318 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
rmcilroy@chromium.org 2014-04-23 10:20:00 +00:00
parent d4f5ca2275
commit 1c8e155b3a
2 changed files with 20 additions and 0 deletions

View File

@ -79,7 +79,18 @@ TEST(LinuxCoreDumperTest, VerifyDumpWithMultipleThreads) {
const string core_file = crash_generator.GetCoreFilePath(); const string core_file = crash_generator.GetCoreFilePath();
const string procfs_path = crash_generator.GetDirectoryOfProcFilesCopy(); const string procfs_path = crash_generator.GetDirectoryOfProcFilesCopy();
#if defined(__ANDROID__)
struct stat st;
if (stat(core_file.c_str(), &st) != 0) {
fprintf(stderr, "LinuxCoreDumperTest.VerifyDumpWithMultipleThreads test is "
"skipped due to no core file being generated");
return;
}
#endif
LinuxCoreDumper dumper(child_pid, core_file.c_str(), procfs_path.c_str()); LinuxCoreDumper dumper(child_pid, core_file.c_str(), procfs_path.c_str());
EXPECT_TRUE(dumper.Init()); EXPECT_TRUE(dumper.Init());
EXPECT_TRUE(dumper.IsPostMortem()); EXPECT_TRUE(dumper.IsPostMortem());

View File

@ -146,6 +146,15 @@ TEST(ElfCoreDumpTest, ValidCoreFile) {
expected_thread_ids.insert(crash_generator.GetThreadId(i)); expected_thread_ids.insert(crash_generator.GetThreadId(i));
} }
#if defined(__ANDROID__)
struct stat st;
if (stat(crash_generator.GetCoreFilePath().c_str(), &st) != 0) {
fprintf(stderr, "ElfCoreDumpTest.ValidCoreFile test is skipped "
"due to no core file being generated");
return;
}
#endif
MemoryMappedFile mapped_core_file; MemoryMappedFile mapped_core_file;
ASSERT_TRUE(mapped_core_file.Map(crash_generator.GetCoreFilePath().c_str())); ASSERT_TRUE(mapped_core_file.Map(crash_generator.GetCoreFilePath().c_str()));