Left: | ||
Right: |
OLD | NEW |
---|---|
1 // Copyright (c) 2011 Google Inc. | 1 // Copyright (c) 2011 Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 21 matching lines...) Expand all Loading... | |
32 #include <sys/stat.h> | 32 #include <sys/stat.h> |
33 #include <sys/syscall.h> | 33 #include <sys/syscall.h> |
34 #include <sys/types.h> | 34 #include <sys/types.h> |
35 #include <ucontext.h> | 35 #include <ucontext.h> |
36 #include <unistd.h> | 36 #include <unistd.h> |
37 | 37 |
38 #include <string> | 38 #include <string> |
39 | 39 |
40 #include "breakpad_googletest_includes.h" | 40 #include "breakpad_googletest_includes.h" |
41 #include "client/linux/handler/exception_handler.h" | 41 #include "client/linux/handler/exception_handler.h" |
42 #include "client/linux/minidump_writer/linux_core_dumper.h" | |
42 #include "client/linux/minidump_writer/linux_dumper.h" | 43 #include "client/linux/minidump_writer/linux_dumper.h" |
43 #include "client/linux/minidump_writer/minidump_writer.h" | 44 #include "client/linux/minidump_writer/minidump_writer.h" |
44 #include "client/linux/minidump_writer/minidump_writer_unittest_utils.h" | 45 #include "client/linux/minidump_writer/minidump_writer_unittest_utils.h" |
45 #include "common/linux/eintr_wrapper.h" | 46 #include "common/linux/eintr_wrapper.h" |
46 #include "common/linux/file_id.h" | 47 #include "common/linux/file_id.h" |
47 #include "common/linux/ignore_ret.h" | 48 #include "common/linux/ignore_ret.h" |
48 #include "common/linux/safe_readlink.h" | 49 #include "common/linux/safe_readlink.h" |
50 #include "common/linux/tests/crash_generator.h" | |
49 #include "common/scoped_ptr.h" | 51 #include "common/scoped_ptr.h" |
50 #include "common/tests/auto_tempdir.h" | 52 #include "common/tests/auto_tempdir.h" |
51 #include "common/tests/file_utils.h" | 53 #include "common/tests/file_utils.h" |
52 #include "common/using_std_string.h" | 54 #include "common/using_std_string.h" |
53 #include "google_breakpad/processor/minidump.h" | 55 #include "google_breakpad/processor/minidump.h" |
54 | 56 |
55 using namespace google_breakpad; | 57 using namespace google_breakpad; |
56 | 58 |
57 // Length of a formatted GUID string = | 59 // Length of a formatted GUID string = |
58 // sizeof(MDGUID) * 2 + 4 (for dashes) + 1 (null terminator) | 60 // sizeof(MDGUID) * 2 + 4 (for dashes) + 1 (null terminator) |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
746 const int min_expected_reduction = (kNumberOfThreadsInHelperProgram - | 748 const int min_expected_reduction = (kNumberOfThreadsInHelperProgram - |
747 kLimitBaseThreadCount) * kMinPerExtraThreadStackReduction; | 749 kLimitBaseThreadCount) * kMinPerExtraThreadStackReduction; |
748 EXPECT_LT(total_limit_stack_size, | 750 EXPECT_LT(total_limit_stack_size, |
749 total_normal_stack_size - min_expected_reduction); | 751 total_normal_stack_size - min_expected_reduction); |
750 } | 752 } |
751 | 753 |
752 // Kill the helper program. | 754 // Kill the helper program. |
753 kill(child_pid, SIGKILL); | 755 kill(child_pid, SIGKILL); |
754 } | 756 } |
755 | 757 |
758 TEST(MinidumpWriterTest, WriteMinidumpFromCore) { | |
759 const unsigned kNumOfThreads = 3; | |
760 const unsigned kCrashThread = 1; | |
761 const int kCrashSignal = SIGABRT; | |
762 pid_t child_pid = 0; | |
763 | |
764 CrashGenerator crash_generator; | |
765 if (!crash_generator.CreateCoreDumpForTest( | |
766 "MinidumpWriterTest.WriteMinidumpFromCore", | |
767 kNumOfThreads, kCrashThread, kCrashSignal, &child_pid)) { | |
768 return; | |
vapier
2015/02/02 18:23:12
shouldn't there be an ASSERT here instead of silen
Ben Chan
2015/02/02 19:53:06
it's not breakpad's fault if the core file isn't g
vapier
2015/02/02 20:37:14
it might be breakpad's fault :)
i tried grepping
| |
769 } | |
770 | |
771 const string core_file = crash_generator.GetCoreFilePath(); | |
772 const string procfs_path = crash_generator.GetDirectoryOfProcFilesCopy(); | |
773 | |
774 AutoTempDir temp_dir; | |
775 string templ = temp_dir.path() + kMDWriterUnitTestFileName; | |
776 MappingList mappings; | |
777 AppMemoryList memory_list; | |
778 LinuxCoreDumper dumper(child_pid, core_file.c_str(), procfs_path.c_str()); | |
779 EXPECT_TRUE(WriteMinidump(templ.c_str(), mappings, memory_list, &dumper)); | |
780 } | |
781 | |
756 } // namespace | 782 } // namespace |
OLD | NEW |