crashpad/util/util_test.gyp

236 lines
7.6 KiB
Plaintext
Raw Normal View History

# Copyright 2014 The Crashpad Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
{
'includes': [
'../build/crashpad.gypi',
],
'targets': [
{
'target_name': 'crashpad_util_test',
'type': 'executable',
'dependencies': [
'util.gyp:crashpad_util',
win: Crash handler server This replaces the registration server, and adds dispatch to a delegate on crash requests. (As you are already aware) we went around in circles on trying to come up with a slightly-too-fancy threading design. All of them seemed to have problems when it comes to out of order events, and orderly shutdown, so I've gone back to something not-too-fancy. Two named pipe instances (that clients connect to) are created. These are used only for registration (which should take <1ms), so 2 should be sufficient to avoid any waits. When a client registers, we duplicate an event to it, which is used to signal when it wants a dump taken. The server registers threadpool waits on that event, and also on the process handle (which will be signalled when the client process exits). These requests (in particular the taking of the dump) are serviced on the threadpool, which avoids us needing to manage those threads, but still allows parallelism in taking dumps. On process termination, we use an IO Completion Port to post a message back to the main thread to request cleanup. This complexity is necessary so that we can unregister the threadpool waits without being on the threadpool, which we need to do synchronously so that we can be sure that no further callbacks will execute (and expect to have the client data around still). In a followup, I will readd support for DumpWithoutCrashing -- I don't think it will be too difficult now that we have an orderly way to clean up client records in the server. R=cpu@chromium.org, mark@chromium.org, jschuh@chromium.org BUG=crashpad:1,crashpad:45 Review URL: https://codereview.chromium.org/1301853002 .
2015-09-03 11:06:17 -07:00
'../client/client.gyp:crashpad_client',
'../compat/compat.gyp:crashpad_compat',
Update gtest to e3f0319d89f4cbf32993de595d984183b1a9fc57 I’m most interested in picking up 1b3eb6ef3462, “Explicitly define copy constructors used in googletest tests.” This also reorganizes files and rewrites text to refer to this project as Google Test and googletest (and Google Mock and googlemock), as it prefers to be known. Some filenames are left at gtest_* following the precedent set by gtest itself. For example, #include "gtest/gtest.h" is still used, so #include "test/gtest_death.h" is retained too. gtest_all_test OutputFileHelpersTest.GetCurrentExecutableName hard-codes the expected executable name as gtest_all_test among other options that do not include googletest_all_test, so test executables retain their names as well. fb19f57880f6 Add GTEST_BRIEF option 3549237957a1 Ensure that gtest/gmock pkgconfig requirements specify version 189299e957bb Merge branch 'master' into quiet-flag 5504ded3ab5c Fix a typo in .travis.yml 6ed4e7168f54 Replace the last instance of `throw()` with `noexcept`. NFC 879fd9b45299 Remove duplicate codes existed in get-nprocessors.sh 644f3a992c28 gtest-unittest-api_test - fix warning in clang build 0b6d567619fe Remove redundant .c_str() be3ac45cf673 fix signed/unsigned comparison issue (on OpenBSD) b51a49e0cb82 Merge pull request #2773 from Quuxplusone:replace-noexcept c2032090f373 Merge pull request #2772 from Quuxplusone:travis 4fe5ac53337e Merge pull request #2756 from Conan-Kudo:fix-pkgconfig-reqs 373d72b6986f Googletest export 4c8e6a9fe1c8 Merge pull request #2810 from ptahmose:master 71d5df6c6b67 Merge pull request #2802 from e-i-n-s:fix_clang_warning dcc92d0ab6c4 Merge pull request #2805 from pepsiman:patch-1 4f002f1e236c VariadicMatcher needs a non-defaulted move constructor for compile-time performance 9d580ea80592 Enable protobuf printing for open-source proto messages 766ac2e1a413 Remove all uses of GTEST_DISALLOW_{MOVE_,}ASSIGN_ 11b3cec177b1 Fix a -Wdeprecated warning 01c0ff5e2373 Fix a -Wdeprecated warning c7d8ec72cc4b Fix a -Wdeprecated warning 1b066f4edfd5 Add -Wdeprecated to the build configuration 4bab55dc54b4 Removed a typo in README.md a67701056425 Googletest export fb5d9b66c5b0 Googletest export 1b3eb6ef3462 Googletest export b0e53e2d64db Merge pull request #2797 from Jyun-Neng:master d7ca9af0049e Googletest export 955552518b4e Googletest export ef25d27d4604 Merge pull request #2815 from Quuxplusone:simple 129329787429 Googletest export b99b421d8d68 Merge pull request #2818 from inazarenko:master 472cd8fd8b1c Merge pull request #2818 from inazarenko:master 3cfb4117f7e5 Googletest export 0eea2e9fc634 Googletest export a9f6c1ed1401 Googletest export 1a9c3e441407 Merge pull request #2830 from keshavgbpecdelhi:patch-1 e589a3371705 Merge pull request #2751 from calumr:quiet-flag Change-Id: Id788a27aa884ef68a21bae6c178cd456f5f6f2b0 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2186009 Reviewed-by: Joshua Peraza <jperaza@chromium.org> Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-05-06 20:39:19 -04:00
'../test/test.gyp:crashpad_googlemock_main',
'../test/test.gyp:crashpad_test',
Update gtest to e3f0319d89f4cbf32993de595d984183b1a9fc57 I’m most interested in picking up 1b3eb6ef3462, “Explicitly define copy constructors used in googletest tests.” This also reorganizes files and rewrites text to refer to this project as Google Test and googletest (and Google Mock and googlemock), as it prefers to be known. Some filenames are left at gtest_* following the precedent set by gtest itself. For example, #include "gtest/gtest.h" is still used, so #include "test/gtest_death.h" is retained too. gtest_all_test OutputFileHelpersTest.GetCurrentExecutableName hard-codes the expected executable name as gtest_all_test among other options that do not include googletest_all_test, so test executables retain their names as well. fb19f57880f6 Add GTEST_BRIEF option 3549237957a1 Ensure that gtest/gmock pkgconfig requirements specify version 189299e957bb Merge branch 'master' into quiet-flag 5504ded3ab5c Fix a typo in .travis.yml 6ed4e7168f54 Replace the last instance of `throw()` with `noexcept`. NFC 879fd9b45299 Remove duplicate codes existed in get-nprocessors.sh 644f3a992c28 gtest-unittest-api_test - fix warning in clang build 0b6d567619fe Remove redundant .c_str() be3ac45cf673 fix signed/unsigned comparison issue (on OpenBSD) b51a49e0cb82 Merge pull request #2773 from Quuxplusone:replace-noexcept c2032090f373 Merge pull request #2772 from Quuxplusone:travis 4fe5ac53337e Merge pull request #2756 from Conan-Kudo:fix-pkgconfig-reqs 373d72b6986f Googletest export 4c8e6a9fe1c8 Merge pull request #2810 from ptahmose:master 71d5df6c6b67 Merge pull request #2802 from e-i-n-s:fix_clang_warning dcc92d0ab6c4 Merge pull request #2805 from pepsiman:patch-1 4f002f1e236c VariadicMatcher needs a non-defaulted move constructor for compile-time performance 9d580ea80592 Enable protobuf printing for open-source proto messages 766ac2e1a413 Remove all uses of GTEST_DISALLOW_{MOVE_,}ASSIGN_ 11b3cec177b1 Fix a -Wdeprecated warning 01c0ff5e2373 Fix a -Wdeprecated warning c7d8ec72cc4b Fix a -Wdeprecated warning 1b066f4edfd5 Add -Wdeprecated to the build configuration 4bab55dc54b4 Removed a typo in README.md a67701056425 Googletest export fb5d9b66c5b0 Googletest export 1b3eb6ef3462 Googletest export b0e53e2d64db Merge pull request #2797 from Jyun-Neng:master d7ca9af0049e Googletest export 955552518b4e Googletest export ef25d27d4604 Merge pull request #2815 from Quuxplusone:simple 129329787429 Googletest export b99b421d8d68 Merge pull request #2818 from inazarenko:master 472cd8fd8b1c Merge pull request #2818 from inazarenko:master 3cfb4117f7e5 Googletest export 0eea2e9fc634 Googletest export a9f6c1ed1401 Googletest export 1a9c3e441407 Merge pull request #2830 from keshavgbpecdelhi:patch-1 e589a3371705 Merge pull request #2751 from calumr:quiet-flag Change-Id: Id788a27aa884ef68a21bae6c178cd456f5f6f2b0 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2186009 Reviewed-by: Joshua Peraza <jperaza@chromium.org> Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-05-06 20:39:19 -04:00
'../third_party/googletest/googlemock.gyp:googlemock',
'../third_party/googletest/googletest.gyp:googletest',
'../third_party/lss/lss.gyp:lss',
'../third_party/mini_chromium/mini_chromium.gyp:base',
'../third_party/zlib/zlib.gyp:zlib',
],
'include_dirs': [
'..',
],
'sources': [
'file/delimited_file_reader_test.cc',
'file/directory_reader_test.cc',
'file/file_io_test.cc',
util/file: Handle oversized reads and writes gracefully file_io and the FileReader family had a few loose ends regarding big reads and writes. It’s not likely that we’ve experienced these conditions yet, but they’d be likely to appear in a potential future involving full memory dumps. This specifies the behavior with large reads and writes, consolidates some logic, and improves some interfaces. ReadFile() should always return without retrying after a short read, and in fact does return after short reads since 00b64427523b. It is straightforward to limit the maximum read size based on a parameter limitation of the underlying operation, or a limitation of the type used for FileOperationResult. In contrast, WriteFile() should always retry after a short write, including a write shortened because of a parameter limitation of the underlying operation, or a limitation of the type used for FileOperationResult. This allows its return value to be simplified to a “bool”. The platform-specific WriteFile() code has been moved to internal::NativeWriteFile(), and the platform-independent loop that retries following a short write has been refactored into internal::WriteAllInternal so that it can be used by a new test. The platform-agnostic ReadFileExactlyInternal() implementation has been refactored into internal::ReadExactlyInternal so that it can be used by a new test and by FileReaderInterface::ReadExactly(), which had a nearly identical implementation. Test: crashpad_util_test FileIO.ReadExactly_*:FileIO.WriteAll_*:FileReader.ReadExactly_* Change-Id: I487450322ab049c6f2acd4061ea814037cc9a864 Reviewed-on: https://chromium-review.googlesource.com/456824 Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-03-21 15:08:05 -04:00
'file/file_reader_test.cc',
'file/filesystem_test.cc',
'file/string_file_test.cc',
'linux/auxiliary_vector_test.cc',
'linux/memory_map_test.cc',
'linux/proc_stat_reader_test.cc',
'linux/proc_task_reader_test.cc',
'linux/ptrace_broker_test.cc',
'linux/ptracer_test.cc',
'linux/scoped_ptrace_attach_test.cc',
'linux/socket_test.cc',
'mac/launchd_test.mm',
'mac/mac_util_test.mm',
'mac/service_management_test.mm',
'mac/xattr_test.cc',
'mach/child_port_handshake_test.cc',
'mach/child_port_server_test.cc',
'mach/composite_mach_message_server_test.cc',
'mach/exc_client_variants_test.cc',
'mach/exc_server_variants_test.cc',
'mach/exception_behaviors_test.cc',
'mach/exception_ports_test.cc',
'mach/exception_types_test.cc',
'mach/mach_extensions_test.cc',
'mach/mach_message_server_test.cc',
'mach/mach_message_test.cc',
'mach/notify_server_test.cc',
'mach/scoped_task_suspend_test.cc',
'mach/symbolic_constants_mach_test.cc',
'misc/arraysize_test.cc',
'misc/capture_context_test.cc',
'misc/capture_context_test_util.h',
'misc/capture_context_test_util_linux.cc',
'misc/capture_context_test_util_mac.cc',
'misc/capture_context_test_util_win.cc',
'misc/clock_test.cc',
'misc/from_pointer_cast_test.cc',
'misc/initialization_state_dcheck_test.cc',
'misc/initialization_state_test.cc',
'misc/paths_test.cc',
'misc/scoped_forbid_return_test.cc',
'misc/random_string_test.cc',
'misc/range_set_test.cc',
'misc/reinterpret_bytes_test.cc',
'misc/time_test.cc',
'misc/uuid_test.cc',
'net/http_body_gzip_test.cc',
'net/http_body_test.cc',
'net/http_body_test_util.cc',
'net/http_body_test_util.h',
'net/http_multipart_builder_test.cc',
'net/http_transport_test.cc',
'net/url_test.cc',
'numeric/checked_address_range_test.cc',
'numeric/checked_range_test.cc',
'numeric/in_range_cast_test.cc',
'numeric/int128_test.cc',
'posix/process_info_test.cc',
'posix/scoped_mmap_test.cc',
'posix/signals_test.cc',
'posix/symbolic_constants_posix_test.cc',
'process/process_memory_mac_test.cc',
'process/process_memory_range_test.cc',
'process/process_memory_test.cc',
'stdlib/aligned_allocator_test.cc',
'stdlib/map_insert_test.cc',
'stdlib/string_number_conversion_test.cc',
'stdlib/strlcpy_test.cc',
'stdlib/strnlen_test.cc',
'stdlib/thread_safe_vector_test.cc',
'string/split_string_test.cc',
'synchronization/semaphore_test.cc',
'thread/thread_log_messages_test.cc',
'thread/thread_test.cc',
'thread/worker_thread_test.cc',
'win/command_line_test.cc',
'win/critical_section_with_debug_info_test.cc',
win: Crash handler server This replaces the registration server, and adds dispatch to a delegate on crash requests. (As you are already aware) we went around in circles on trying to come up with a slightly-too-fancy threading design. All of them seemed to have problems when it comes to out of order events, and orderly shutdown, so I've gone back to something not-too-fancy. Two named pipe instances (that clients connect to) are created. These are used only for registration (which should take <1ms), so 2 should be sufficient to avoid any waits. When a client registers, we duplicate an event to it, which is used to signal when it wants a dump taken. The server registers threadpool waits on that event, and also on the process handle (which will be signalled when the client process exits). These requests (in particular the taking of the dump) are serviced on the threadpool, which avoids us needing to manage those threads, but still allows parallelism in taking dumps. On process termination, we use an IO Completion Port to post a message back to the main thread to request cleanup. This complexity is necessary so that we can unregister the threadpool waits without being on the threadpool, which we need to do synchronously so that we can be sure that no further callbacks will execute (and expect to have the client data around still). In a followup, I will readd support for DumpWithoutCrashing -- I don't think it will be too difficult now that we have an orderly way to clean up client records in the server. R=cpu@chromium.org, mark@chromium.org, jschuh@chromium.org BUG=crashpad:1,crashpad:45 Review URL: https://codereview.chromium.org/1301853002 .
2015-09-03 11:06:17 -07:00
'win/exception_handler_server_test.cc',
'win/get_function_test.cc',
'win/handle_test.cc',
'win/initial_client_data_test.cc',
'win/process_info_test.cc',
'win/registration_protocol_win_test.cc',
win: Wrap TerminateProcess() to accept cdecl patches on x86 TerminateProcess(), like most of the Windows API, is declared WINAPI, which is __stdcall on 32-bit x86. That means that the callee, TerminateProcess() itself, is responsible for cleaning up parameters on the stack on return. In https://crashpad.chromium.org/bug/179, crashes in ExceptionHandlerServer::OnNonCrashDumpEvent() were observed in ways that make it evident that TerminateProcess() has been patched with a __cdecl routine. The crucial difference between __stdcall and __cdecl is that the caller is responsible for stack parameter cleanup in __cdecl. The mismatch means that nobody cleans parameters from the stack, and the stack pointer has an unexpected value, which in the case of the Crashpad handler crash, results in TerminateProcess()’s second argument erroneously being used as the lock address in the call to ReleaseSRWLockExclusive() or LeaveCriticalSection(). As a workaround, on 32-bit x86, call through SafeTerminateProcess(), a custom assembly routine that’s compatible with either __stdcall or __cdecl implementations of TerminateProcess() by not trusting the value of the stack pointer on return from that function. Instead, the stack pointer is restored directly from the frame pointer. Bug: crashpad:179 Test: crashpad_util_test SafeTerminateProcess.*, others Change-Id: If9508f4eb7631020ea69ddbbe4a22eb335cdb325 Reviewed-on: https://chromium-review.googlesource.com/481180 Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-19 13:22:08 -04:00
'win/safe_terminate_process_test.cc',
'win/scoped_process_suspend_test.cc',
'win/session_end_watcher_test.cc',
],
'conditions': [
['OS=="mac"', {
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
],
},
}],
['OS=="win"', {
'dependencies': [
'crashpad_util_test_process_info_test_child',
win: Wrap TerminateProcess() to accept cdecl patches on x86 TerminateProcess(), like most of the Windows API, is declared WINAPI, which is __stdcall on 32-bit x86. That means that the callee, TerminateProcess() itself, is responsible for cleaning up parameters on the stack on return. In https://crashpad.chromium.org/bug/179, crashes in ExceptionHandlerServer::OnNonCrashDumpEvent() were observed in ways that make it evident that TerminateProcess() has been patched with a __cdecl routine. The crucial difference between __stdcall and __cdecl is that the caller is responsible for stack parameter cleanup in __cdecl. The mismatch means that nobody cleans parameters from the stack, and the stack pointer has an unexpected value, which in the case of the Crashpad handler crash, results in TerminateProcess()’s second argument erroneously being used as the lock address in the call to ReleaseSRWLockExclusive() or LeaveCriticalSection(). As a workaround, on 32-bit x86, call through SafeTerminateProcess(), a custom assembly routine that’s compatible with either __stdcall or __cdecl implementations of TerminateProcess() by not trusting the value of the stack pointer on return from that function. Instead, the stack pointer is restored directly from the frame pointer. Bug: crashpad:179 Test: crashpad_util_test SafeTerminateProcess.*, others Change-Id: If9508f4eb7631020ea69ddbbe4a22eb335cdb325 Reviewed-on: https://chromium-review.googlesource.com/481180 Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-19 13:22:08 -04:00
'crashpad_util_test_safe_terminate_process_test_child',
],
'link_settings': {
'libraries': [
'-ladvapi32.lib',
'-limagehlp.lib',
'-lrpcrt4.lib',
'-luser32.lib',
],
},
}],
['OS=="android"', {
# Things not yet ported to Android
'sources/' : [
['exclude', '^net/http_transport_test\\.cc$'],
]
}],
['OS=="linux" or OS=="android"', {
'sources': [
'process/process_memory_sanitized_test.cc',
],
}],
['OS!="linux" and OS!="android"', {
'sources/': [
['exclude', '^process/'],
],
}],
],
'target_conditions': [
['OS=="android"', {
'sources/': [
['include', '^linux/'],
['include', '^misc/capture_context_test_util_linux\\.cc$'],
],
}],
],
},
],
'conditions': [
['OS!="android"', {
'targets': [
{
'target_name': 'http_transport_test_server',
'type': 'executable',
'dependencies': [
'../third_party/mini_chromium/mini_chromium.gyp:base',
'../third_party/zlib/zlib.gyp:zlib',
'../tools/tools.gyp:crashpad_tool_support',
'../util/util.gyp:crashpad_util',
],
'sources': [
'net/http_transport_test_server.cc',
],
'include_dirs': [
'..',
],
'xcode_settings': {
'WARNING_CFLAGS!': [
'-Wexit-time-destructors',
],
},
'cflags!': [
'-Wexit-time-destructors',
],
'conditions': [
['OS=="win"', {
'link_settings': {
'libraries': [
'-lws2_32.lib',
],
},
}],
],
},
],
}],
['OS=="win"', {
'targets': [
{
'target_name': 'crashpad_util_test_process_info_test_child',
'type': 'executable',
'sources': [
'win/process_info_test_child.cc',
],
},
win: Wrap TerminateProcess() to accept cdecl patches on x86 TerminateProcess(), like most of the Windows API, is declared WINAPI, which is __stdcall on 32-bit x86. That means that the callee, TerminateProcess() itself, is responsible for cleaning up parameters on the stack on return. In https://crashpad.chromium.org/bug/179, crashes in ExceptionHandlerServer::OnNonCrashDumpEvent() were observed in ways that make it evident that TerminateProcess() has been patched with a __cdecl routine. The crucial difference between __stdcall and __cdecl is that the caller is responsible for stack parameter cleanup in __cdecl. The mismatch means that nobody cleans parameters from the stack, and the stack pointer has an unexpected value, which in the case of the Crashpad handler crash, results in TerminateProcess()’s second argument erroneously being used as the lock address in the call to ReleaseSRWLockExclusive() or LeaveCriticalSection(). As a workaround, on 32-bit x86, call through SafeTerminateProcess(), a custom assembly routine that’s compatible with either __stdcall or __cdecl implementations of TerminateProcess() by not trusting the value of the stack pointer on return from that function. Instead, the stack pointer is restored directly from the frame pointer. Bug: crashpad:179 Test: crashpad_util_test SafeTerminateProcess.*, others Change-Id: If9508f4eb7631020ea69ddbbe4a22eb335cdb325 Reviewed-on: https://chromium-review.googlesource.com/481180 Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-19 13:22:08 -04:00
{
'target_name': 'crashpad_util_test_safe_terminate_process_test_child',
'type': 'executable',
'sources': [
'win/safe_terminate_process_test_child.cc',
],
},
]
}],
],
}