icinga2/test/test-runner.cpp
Johannes Schmidt e11aad842a Discover Boost test cases automatically after build
This adds a global fixture that can parse an additional argument to
the test executables (`--generate_ctest_config`). When run by
CMake during build, this generates a CTest script containing all
the tests and their properties.

An additional decorator, that defines CTest properties for a test case
or suite that will be added to the tests during config generation.

This version needs no hacks, no huge CMake scripts, just a bit of
additional C++ code that iterates over all test-cases and collects
the information CTest needs.

One caveat is still that this does not work with cross-compilation,
which probably isn't an issue to begin with, but there are also ways
to fix that if necessary.
2025-08-19 09:24:42 +02:00

22 lines
507 B
C++

/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
#define BOOST_TEST_MODULE icinga2
#define BOOST_TEST_NO_MAIN
#define BOOST_TEST_ALTERNATIVE_INIT_API
#include <BoostTestTargetConfig.h>
#include "test-ctest.hpp"
#include <cstdlib>
int BOOST_TEST_CALL_DECL
main(int argc, char **argv)
{
std::_Exit(boost::unit_test::unit_test_main(init_unit_test, argc, argv));
return EXIT_FAILURE;
}
#ifdef _WIN32
#include <boost/test/impl/unit_test_main.ipp>
#include <boost/test/impl/framework.ipp>
#endif /* _WIN32 */