Merge branch 'feature/vagrant-test-4635' into next

Fixes #4635
This commit is contained in:
Gunnar Beutner 2013-11-26 18:52:29 +01:00
commit ed48934ed4
8 changed files with 87 additions and 10 deletions

View File

@ -94,7 +94,7 @@ check_function_exists(pipe2 HAVE_PIPE2)
check_library_exists(crypto BIO_f_zlib "" HAVE_BIOZLIB)
include(GNUInstallDirs)
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ESCAPE_QUOTES)
install(
FILES README COPYING COPYING.Exceptions AUTHORS ChangeLog INSTALL NEWS

View File

@ -311,17 +311,32 @@ bool Application::IsDebugging(void)
return m_Debugging;
}
/**
* Display version information.
*/
void Application::DisplayVersionMessage(void)
{
std::cerr << "***" << std::endl
<< "* Application version: " << GetVersion() << std::endl
<< "* Installation root: " << GetPrefixDir() << std::endl
<< "* Local state directory: " << GetLocalStateDir() << std::endl
<< "* Package data directory: " << GetPkgDataDir() << std::endl
<< "* State path: " << GetStatePath() << std::endl
<< "* PID path: " << GetPidPath() << std::endl
<< "* Application type: " << GetApplicationType() << std::endl
<< "***" << std::endl;
}
/**
* Displays a message that tells users what to do when they encounter a bug.
*/
void Application::DisplayBugMessage(void)
{
std::cerr << "***" << std::endl
<< "*** This would indicate a runtime problem or configuration error. If you believe this is a bug in Icinga 2" << std::endl
<< "*** please submit a bug report at https://dev.icinga.org/ and include this stack trace as well as any other" << std::endl
<< "*** information that might be useful in order to reproduce this problem." << std::endl
<< "***" << std::endl
<< std::endl;
<< "* This would indicate a runtime problem or configuration error. If you believe this is a bug in Icinga 2" << std::endl
<< "* please submit a bug report at https://dev.icinga.org/ and include this stack trace as well as any other" << std::endl
<< "* information that might be useful in order to reproduce this problem." << std::endl
<< "***" << std::endl;
}
#ifndef _WIN32
@ -360,7 +375,10 @@ void Application::SigAbrtHandler(int)
sigaction(SIGABRT, &sa, NULL);
#endif /* _WIN32 */
std::cerr << "Caught SIGABRT." << std::endl;
std::cerr << "Caught SIGABRT." << std::endl
<< std::endl;
DisplayVersionMessage();
StackTrace trace;
std::cerr << "Stacktrace:" << std::endl;
@ -399,6 +417,11 @@ void Application::ExceptionHandler(void)
sigaction(SIGABRT, &sa, NULL);
#endif /* _WIN32 */
std::cerr << "Caught unhandled exception." << std::endl
<< std::endl;
DisplayVersionMessage();
try {
throw;
} catch (const std::exception& ex) {
@ -415,7 +438,10 @@ void Application::ExceptionHandler(void)
#ifdef _WIN32
LONG CALLBACK Application::SEHUnhandledExceptionFilter(PEXCEPTION_POINTERS exi)
{
std::cerr << "Unhandled SEH exception." << std::endl;
DisplayVersionMessage();
std::cerr << "Caught unhandled SEH exception." << std::endl
<< std::endl;
StackTrace trace(exi);
std::cerr << "Stacktrace:" << std::endl;

View File

@ -122,6 +122,7 @@ private:
static LONG WINAPI SEHUnhandledExceptionFilter(PEXCEPTION_POINTERS exi);
#endif /* _WIN32 */
static void DisplayVersionMessage(void);
static void DisplayBugMessage(void);
static void SigAbrtHandler(int signum);

1
test/jenkins/README Normal file
View File

@ -0,0 +1 @@
These scripts are used by build.icinga.org to set up a test VM.

14
test/jenkins/bootstrap-vm.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
if [ "$1" != "run-by-jenkins" ]; then
echo "This script should not be run manually."
exit 1
fi
echo "10.10.27.1 packages.icinga.org" >> /etc/hosts
groupadd vagrant
rmdir /vagrant && ln -s /root/icinga2 /vagrant
puppet apply --modulepath=/vagrant/.vagrant-puppet/modules /vagrant/.vagrant-puppet/manifests/default.pp
exit 0

34
test/jenkins/run-tests.py Executable file
View File

@ -0,0 +1,34 @@
#!/usr/bin/env python
import sys
from xml.dom.minidom import getDOMImplementation
from subprocess import Popen, PIPE
impl = getDOMImplementation()
result = impl.createDocument(None, "testsuite", None)
testsuite = result.documentElement
for fn in sys.argv[1:]:
process = Popen(["./" + fn], stdout=PIPE, stderr=PIPE)
(stdoutdata, stderrdata) = process.communicate()
testcase = result.createElement("testcase")
testcase.setAttribute("classname", "vm")
testcase.setAttribute("name", fn)
systemout = result.createElement("system-out")
systemout.appendChild(result.createTextNode(stdoutdata))
testcase.appendChild(systemout)
systemerr = result.createElement("system-err")
systemerr.appendChild(result.createTextNode(stderrdata))
testcase.appendChild(systemerr)
if process.returncode != 0:
failure = result.createElement("failure")
failure.setAttribute("type", "returncode")
failure.appendChild(result.createTextNode("code: " + str(process.returncode)))
testcase.appendChild(failure)
testsuite.appendChild(testcase)
print result.toxml()

3
test/jenkins/v1.test Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
echo "Hello World!"
exit 1

View File

@ -1,2 +0,0 @@
#!/bin/sh
exec ./icinga2_test --log_format=XML --log_sink=results.xml --log_level=all --report_level=no