diff options
Diffstat (limited to 'test/core/util/test_config.c')
-rw-r--r-- | test/core/util/test_config.c | 95 |
1 files changed, 59 insertions, 36 deletions
diff --git a/test/core/util/test_config.c b/test/core/util/test_config.c index f5d5cdb57c..eb2ff22c8b 100644 --- a/test/core/util/test_config.c +++ b/test/core/util/test_config.c @@ -42,58 +42,81 @@ double g_fixture_slowdown_factor = 1.0; #if GPR_GETPID_IN_UNISTD_H #include <unistd.h> -static unsigned seed(void) { return (unsigned)getpid(); } +static unsigned +seed (void) +{ + return (unsigned) getpid (); +} #endif #if GPR_GETPID_IN_PROCESS_H #include <process.h> -static unsigned seed(void) { return _getpid(); } +static unsigned +seed (void) +{ + return _getpid (); +} #endif #if GPR_WINDOWS_CRASH_HANDLER -LONG crash_handler(struct _EXCEPTION_POINTERS* ex_info) { - gpr_log(GPR_DEBUG, "Exception handler called, dumping information"); - while (ex_info->ExceptionRecord) { - DWORD code = ex_info->ExceptionRecord->ExceptionCode; - DWORD flgs = ex_info->ExceptionRecord->ExceptionFlags; - PVOID addr = ex_info->ExceptionRecord->ExceptionAddress; - gpr_log("code: %x - flags: %d - address: %p", code, flgs, addr); - ex_info->ExceptionRecord = ex_info->ExceptionRecord->ExceptionRecord; - } - if (IsDebuggerPresent()) { - __debugbreak(); - } else { - _exit(1); - } +LONG +crash_handler (struct _EXCEPTION_POINTERS * ex_info) +{ + gpr_log (GPR_DEBUG, "Exception handler called, dumping information"); + while (ex_info->ExceptionRecord) + { + DWORD code = ex_info->ExceptionRecord->ExceptionCode; + DWORD flgs = ex_info->ExceptionRecord->ExceptionFlags; + PVOID addr = ex_info->ExceptionRecord->ExceptionAddress; + gpr_log ("code: %x - flags: %d - address: %p", code, flgs, addr); + ex_info->ExceptionRecord = ex_info->ExceptionRecord->ExceptionRecord; + } + if (IsDebuggerPresent ()) + { + __debugbreak (); + } + else + { + _exit (1); + } return EXCEPTION_EXECUTE_HANDLER; } -void abort_handler(int sig) { - gpr_log(GPR_DEBUG, "Abort handler called."); - if (IsDebuggerPresent()) { - __debugbreak(); - } else { - _exit(1); - } +void +abort_handler (int sig) +{ + gpr_log (GPR_DEBUG, "Abort handler called."); + if (IsDebuggerPresent ()) + { + __debugbreak (); + } + else + { + _exit (1); + } } -static void install_crash_handler() { - SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)crash_handler); - _set_abort_behavior(0, _WRITE_ABORT_MSG); - _set_abort_behavior(0, _CALL_REPORTFAULT); - signal(SIGABRT, abort_handler); +static void +install_crash_handler () +{ + SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) crash_handler); + _set_abort_behavior (0, _WRITE_ABORT_MSG); + _set_abort_behavior (0, _CALL_REPORTFAULT); + signal (SIGABRT, abort_handler); } #else -static void install_crash_handler() {} +static void +install_crash_handler () +{ +} #endif -void grpc_test_init(int argc, char** argv) { - install_crash_handler(); - gpr_log(GPR_DEBUG, "test slowdown: machine=%f build=%f total=%f", - (double)GRPC_TEST_SLOWDOWN_MACHINE_FACTOR, - (double)GRPC_TEST_SLOWDOWN_BUILD_FACTOR, - (double)GRPC_TEST_SLOWDOWN_FACTOR); +void +grpc_test_init (int argc, char **argv) +{ + install_crash_handler (); + gpr_log (GPR_DEBUG, "test slowdown: machine=%f build=%f total=%f", (double) GRPC_TEST_SLOWDOWN_MACHINE_FACTOR, (double) GRPC_TEST_SLOWDOWN_BUILD_FACTOR, (double) GRPC_TEST_SLOWDOWN_FACTOR); /* seed rng with pid, so we don't end up with the same random numbers as a concurrently running test binary */ - srand(seed()); + srand (seed ()); } |