// Copyright 2011 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifdef HAVE_CONFIG_H #include <config.h> // Must come first #endif #include <fcntl.h> #include <poll.h> #include <sys/stat.h> #include <sys/syscall.h> #include <sys/types.h> #include <ucontext.h> #include <unistd.h> #include <string> #include "breakpad_googletest_includes.h" #include "client/linux/handler/exception_handler.h" #include "client/linux/minidump_writer/linux_dumper.h" #include "client/linux/minidump_writer/minidump_writer.h" #include "client/linux/minidump_writer/minidump_writer_unittest_utils.h" #include "common/linux/breakpad_getcontext.h" #include "common/linux/eintr_wrapper.h" #include "common/linux/file_id.h" #include "common/linux/ignore_ret.h" #include "common/linux/safe_readlink.h" #include "common/scoped_ptr.h" #include "common/tests/auto_tempdir.h" #include "common/tests/file_utils.h" #include "common/using_std_string.h" #include "google_breakpad/processor/minidump.h" usingnamespacegoogle_breakpad; FileID; kDefaultBuildIdSize; namespace { MinidumpWriterTest; const char kMDWriterUnitTestFileName[] = …; TEST(MinidumpWriterTest, SetupWithPath) { … } TEST(MinidumpWriterTest, SetupWithFD) { … } // Test that mapping info can be specified when writing a minidump, // and that it ends up in the module list of the minidump. TEST(MinidumpWriterTest, MappingInfo) { … } // Test that minidumping is skipped while writing minidumps if principal mapping // is not referenced. TEST(MinidumpWriterTest, MinidumpSkippedIfRequested) { … } // Test that minidumping is skipped while writing minidumps if principal mapping // is not referenced. TEST(MinidumpWriterTest, MinidumpStacksSkippedIfRequested) { … } // Test that stacks can be sanitized while writing minidumps. TEST(MinidumpWriterTest, StacksAreSanitizedIfRequested) { … } // Test that a binary with a longer-than-usual build id note // makes its way all the way through to the minidump unscathed. // The linux_client_unittest is linked with an explicit --build-id // in Makefile.am. TEST(MinidumpWriterTest, BuildIDLong) { … } // Test that mapping info can be specified, and that it overrides // existing mappings that are wholly contained within the specified // range. TEST(MinidumpWriterTest, MappingInfoContained) { … } TEST(MinidumpWriterTest, DeletedBinary) { … } // Test that an additional memory region can be added to the minidump. TEST(MinidumpWriterTest, AdditionalMemory) { … } // Test that an invalid thread stack pointer still results in a minidump. TEST(MinidumpWriterTest, InvalidStackPointer) { … } // Test that limiting the size of the minidump works. TEST(MinidumpWriterTest, MinidumpSizeLimit) { … } } // namespace