diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 18:07:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 18:07:13 +0000 |
commit | 636c7dc17286d93d788c741d15fd756aeda066d5 (patch) | |
tree | e7ae158cc54f591041a061b9865bcae51854f15c /test/libapt/gtest_runner.cc | |
parent | Initial commit. (diff) | |
download | apt-upstream/1.8.2.3.tar.xz apt-upstream/1.8.2.3.zip |
Adding upstream version 1.8.2.3.upstream/1.8.2.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/libapt/gtest_runner.cc')
-rw-r--r-- | test/libapt/gtest_runner.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/libapt/gtest_runner.cc b/test/libapt/gtest_runner.cc new file mode 100644 index 0000000..5620aa0 --- /dev/null +++ b/test/libapt/gtest_runner.cc @@ -0,0 +1,26 @@ +#include <gtest/gtest.h> + +#include <apt-pkg/configuration.h> +#include <apt-pkg/error.h> +#include <apt-pkg/init.h> +#include <apt-pkg/pkgsystem.h> + +int main(int argc, char **argv) { + ::testing::InitGoogleTest(&argc, argv); + if (pkgInitSystem(*_config, _system) == false) + return 42; + int const result = RUN_ALL_TESTS(); + if (_error->empty() == false) + { + std::cerr << "The test generated the following global messages:" << std::endl; + _error->DumpErrors(std::cerr); + // messages on the stack can't be right, error out + // even if we have no idea where this message came from + if (result == 0) + { + std::cerr << "All tests successful, but messages were generated, so still a failure!" << std::endl; + return 29; + } + } + return result; +} |