aboutsummaryrefslogtreecommitdiff
path: root/src/common/linux/tests
Commit message (Collapse)AuthorAgeFilesLines
* fix pointer style to match the style guideMike Frysinger2020-07-151-1/+1
| | | | | | | | | | We do this in a lot of places, but we're inconsistent. Normalize the code to the Google C++ style guide. Change-Id: Ic2aceab661ce8f6b993dda21b1cdf5d2198dcbbf Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2262932 Reviewed-by: Sterling Augustine <saugustine@google.com> Reviewed-by: Mark Mentovai <mark@chromium.org>
* Use sched_yield instead of pthread_yieldMichael Forney2020-03-101-1/+2
| | | | | | | | | | | | | | | | | | | | | pthread_yield is not a standard POSIX function, and is not available in musl libc. The man page says to "Use the standardized sched_yield(2) instead"[0]. On glibc, pthread_yield is exactly equivalent to sched_yield[1]. On bionic, pthread_yield is also not available, so on Android, the tests define a wrapper that just calls sched_yield. This wrapper is no longer necessary if we just use sched_yield in the first place. [0] http://man7.org/linux/man-pages/man3/pthread_yield.3.html [1] https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/pthread_yield.c Bug: google-breakpad:631 Change-Id: Ie4c6be8c17cdc2f5396a7fe972fa51a97573b049 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2097340 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Make breakpad_unittests work with Chrome's test runner instead of gtest'sMark Mentovai2019-04-191-0/+6
| | | | | | | | | | | | | | | | | | | Chrome's test runner on Linux installs its own StackDumpSignalHandler which swallows signals and doesn't re-raise them. This is sloppy, but apparently there are reasons (https://crbug.com/551681). For breakpad_unittests, it causes problems where a test process expects (via waitpid()) to observe a child crash. Deal with those cases by explicitly restoring the default signal handler. In another case, Chrome's test runner seems to have been arriving at the conclusion that it was to expect output from a child. Transitioning from exit() to _exit() fixes this problem, and it's not necessarily a bad idea to do this in post-fork() children without an execve() anyway. Bug: chromium:949098 Change-Id: I5a6af0c2a09cd8eac9998358f6d5ea665288236f Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1575670 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Update linksOrgad Shaneh2016-11-181-1/+1
| | | | | | | | | | code.google.com is obsolete. Fix all broken markdown links while at it. Change-Id: I6a337bf4b84eacd5f5c749a4ee61331553279009 Reviewed-on: https://chromium-review.googlesource.com/411800 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Limit the workaround in r1313 to Android only.thestig@chromium.org2014-04-151-2/+9
| | | | | | | | | BUG=579 R=rmcilroy@chromium.org, vapier@chromium.org Review URL: https://breakpad.appspot.com/1564002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1314 4c0a9323-5329-0410-9bdc-e9ce6186880e
* [Android]: Fix hang in CreateChildCrash() on Android.rmcilroy@chromium.org2014-04-151-13/+19
| | | | | | | | | | | | | | After r1299, the LinuxCoreDumperTest::VerifyDumpWithMultipleThreads and ElfCoreDumpTest::ValidCoreFile would both hang on Android. This appears to be due to the tkill signal not being recieved by the thread which is meant to crash, even though tkill returns 0. This CL retries sending the tkill signal multiple times, which prevents the Hang. BUG=579 R=thestig@chromium.org Review URL: https://breakpad.appspot.com/1524002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1313 4c0a9323-5329-0410-9bdc-e9ce6186880e
* fix races in CrashGenerator::CreateChildCrashvapier@chromium.org2014-04-021-6/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current CreateChildCrash logic is racy when it comes to creating a crash dump for two reasons: The main thread that calls kill() on a different thread is guaranteed the signal will be *queued* when it returns, but not *delivered*. If the kernel doesn't automatically schedule the receiving thread, but instead lets the main thread run to the exit() call, then the signal never triggers a coredump and the whole process simply exits. The main thread is using kill() to try to deliver a signal to a specific thread, but that function is for sending signals to a process. That means the kernel is free to deliver the signal to any thread in the process and not just the one requested. This manifests itself as the pr_pid in the coredump not being the one expected. Instead, we must use tkill() with the tid (which we already took care of gathering) to deliver to a specific thread. These are a lot easier to see on a UMP system as contention is heavier. BUG=chromium:207918 TEST=`dumper_unittest` still passes, and doesn't flake out in a UMP system TEST=`linux_client_unittest` still passes R=benchan@chromium.org Review URL: https://breakpad.appspot.com/1304005 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1299 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Add missing #include of eintr_wrapper.h to auto_testfile.h. Since it'smark@chromium.org2013-12-031-0/+124
| | | | | | | | | | | | | Linux-specific, shuffle the files around a bit. (The implementation is actually POSIX-specific, but it's currently only used on Linux.) R=blundell@chromium.org Review URL: https://breakpad.appspot.com/804002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1240 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix Breakpad unit tests build for Android.digit@chromium.org2012-08-231-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch contains the source-related fixes to ensure that the Breakpad unit tests build properly when targetting Android. Calling 'make check' still fails because there is still no way to run the unit test programs on a device. This will be addressed by a future patch. Important notes: - You must target Android API level 9 (Gingerbread) or higher to build the unit tests. This requirement is due to the current GTest revision used in the breakpad source tree. - This patch adds headers providing inlined C library functions missing from the NDK (see src/common/android/testing). They are inlined to avoid modifying Makefile.am and other build files. - Similarly, the <wchar.h> header-fix under src/common/android/testing/include is only required by GTest's current revision. E.g. it's not needed when building Breakpad as part of Chromium which uses a more up-to-date revision. Review URL: https://breakpad.appspot.com/439002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1020 4c0a9323-5329-0410-9bdc-e9ce6186880e
* This change allows compiling the google-breakpad code using a global ↵ivan.penkov@gmail.com2012-06-282-5/+7
| | | | | | ::string class instead of std::string. For more details take a look at common/using_std_string.h git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@974 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix crash_generator error messageted.mielczarek2012-04-111-1/+4
| | | | | | | Patch by Chris Dearman <chris@mips.com> R=ted at http://breakpad.appspot.com/374001/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@950 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Modify CrashGenerator::CreateChildCrash to copy proc files.benchan@chromium.org2012-02-232-7/+53
| | | | | | | | | | | | | | | | | | | | | This patch is taken from the downstream version of breakpad in Chromium OS: https://gerrit.chromium.org/gerrit/15148 LinuxCoreDumperTest previously assumes the proc files of the child process created by CrashGenerator::CreateChildCrash() have the same content as its parent process, which may not be true. This CL modifies CrashGenerator to copy the proc files of the child process, created by CreateChildCrash(), before crashing that process. BUG=chromium-os:25252 TEST=Verified the following: TEST=Tested the following: 1. Build on 32-bit and 64-bit Linux with gcc 4.4.3 and gcc 4.6. 2. Build on Mac OS X 10.6.8 with gcc 4.2 and clang 3.0 (with latest gmock). 3. All unit tests pass. Review URL: https://breakpad.appspot.com/353001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@925 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Implement core dump to minidump conversion.benchan@chromium.org2012-01-192-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is part of a bigger patch that helps merging the breakpad code with the modified version in Chromium OS. Specifically, this patch makes the following changes: 1. Turn the LinuxDumper class into a base class and move ptrace related code into a new derived class, LinuxPtraceDumper. 2. Add a LinuxCoreDumper class, which is derived from LinuxDumper, to extract information from a crashed process via a core dump file instead of ptrace. 3. Add a WriteMinidumpFromCore function to src/client/linux/minidump_writer/minidump_writer.h, which uses LinuxCoreDumper to extract information from a core dump file. 4. Add a core2md utility, which simply wraps WriteMinidumpFromCore, for converting a core dump to a minidump. BUG=455 TEST=Tested the following: 1. Build on 32-bit and 64-bit Linux with gcc 4.4.3 and gcc 4.6. 2. Build on Mac OS X 10.6.8 with gcc 4.2 and clang 3.0 (with latest gmock). 3. All unit tests pass. 4. Run Chromium OS tests to test core2md. Review URL: http://breakpad.appspot.com/343001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@905 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Skip ElfCoreDumpTest.ValidCoreFile test if no core dump is generated.benchan@chromium.org2012-01-111-8/+33
| | | | | | | | | | | | | | | CrashGenerator::CreateChildCrash() may have some flakiness. This patch changes ElfCoreDumpTest to temporarily skip the ValidCoreFile test if no core dump is generated by CrashGenerator::CreateChildCrash(), but print out the error message to help debug the flakiness. BUG=chromium-os:24982 TEST=Tested the following: 1. Build on 32-bit and 64-bit Linux with gcc 4.6. 2. All unit tests pass. Review URL: http://breakpad.appspot.com/342001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@904 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Add utilities for processing Linux core dump files.benchan@chromium.org2012-01-072-0/+314
This patch is part of a bigger patch that helps merging the breakpad code with the modified version in Chromium OS. Specifically, this patch makes the following changes: 1. Add an ElfCoreDump class for processing Linux core dump files, which will later be used to implement the core dump to minidump conversion. 2. Add a CrashGenerator class for generating a crash with a core dump file for testing the functionalities of ElfCoreDump. 3. Move some utility functions for reading/writing files to file_utils.h. BUG=455 TEST=Tested the following: 1. Build on 32-bit and 64-bit Linux with gcc 4.4.3 and gcc 4.6. 2. Build on Mac OS X 10.6.8 with gcc 4.2 and clang 3.0 (with latest gmock). 3. All unit tests pass. Review URL: http://breakpad.appspot.com/337001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@900 4c0a9323-5329-0410-9bdc-e9ce6186880e