Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(908)

Unified Diff: src/common/linux/elf_core_dump_unittest.cc

Issue 4714002: Refactor common code for ensuring core dump for unit tests. Base URL: http://google-breakpad.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/common/linux/elf_core_dump_unittest.cc
===================================================================
--- src/common/linux/elf_core_dump_unittest.cc (revision 1419)
+++ src/common/linux/elf_core_dump_unittest.cc (working copy)
@@ -128,18 +128,17 @@
}
TEST(ElfCoreDumpTest, ValidCoreFile) {
+ const unsigned kNumOfThreads = 3;
+ const unsigned kCrashThread = 1;
+ const int kCrashSignal = SIGABRT;
+
CrashGenerator crash_generator;
- if (!crash_generator.HasDefaultCorePattern()) {
- fprintf(stderr, "ElfCoreDumpTest.ValidCoreFile test is skipped "
- "due to non-default core pattern");
+ if (!crash_generator.CreateCoreDumpForTest(
+ "ElfCoreDumpTest.ValidCoreFile",
+ kNumOfThreads, kCrashThread, kCrashSignal, NULL)) {
return;
}
- const unsigned kNumOfThreads = 3;
- const unsigned kCrashThread = 1;
- const int kCrashSignal = SIGABRT;
- ASSERT_TRUE(crash_generator.CreateChildCrash(kNumOfThreads, kCrashThread,
- kCrashSignal, NULL));
pid_t expected_crash_thread_id = crash_generator.GetThreadId(kCrashThread);
set<pid_t> expected_thread_ids;
for (unsigned i = 0; i < kNumOfThreads; ++i) {
@@ -146,15 +145,6 @@
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;
ASSERT_TRUE(
mapped_core_file.Map(crash_generator.GetCoreFilePath().c_str(), 0));
« no previous file with comments | « src/client/linux/minidump_writer/linux_core_dumper_unittest.cc ('k') | src/common/linux/tests/crash_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1004:630ec63f810e-tainted