mirror of
https://github.com/Icinga/icinga2.git
synced 2025-09-22 17:28:02 +02:00
Test code for feature/improve-crashlog branch
This commit is contained in:
parent
16c6a5a652
commit
01d8c768a0
@ -210,6 +210,20 @@ static double GetDebugWorkerDelay()
|
||||
}
|
||||
#endif /* I2_DEBUG */
|
||||
|
||||
void throw_test_exception() {
|
||||
if (!Utility::GetFromEnvironment("DEBUG_ABORT").IsEmpty()) {
|
||||
abort();
|
||||
}
|
||||
if (!Utility::GetFromEnvironment("DEBUG_THROW_CXX").IsEmpty()) {
|
||||
throw std::runtime_error("test exception");
|
||||
}
|
||||
#ifdef _WIN32
|
||||
if (!Utility::GetFromEnvironment("DEBUG_THROW_SEH").IsEmpty()) {
|
||||
RaiseException(42, 0, 0, nullptr);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the actual work (config loading, ...)
|
||||
*
|
||||
@ -285,6 +299,8 @@ int RunWorker(const std::vector<std::string>& configs, bool closeConsoleLog = fa
|
||||
}
|
||||
}
|
||||
|
||||
throw_test_exception();
|
||||
|
||||
/* Create the internal API object storage. Do this here too with setups without API. */
|
||||
ConfigObjectUtility::CreateStorage();
|
||||
|
||||
@ -520,6 +536,7 @@ static pid_t StartUnixWorker(const std::vector<std::string>& configs, bool close
|
||||
|
||||
_exit(RunWorker(configs, closeConsoleLog, stderrFile));
|
||||
} catch (...) {
|
||||
throw;
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user