summaryrefslogtreecommitdiff
path: root/test/libapt/gtest_runner.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@ubuntu.com>2014-05-07 15:41:54 +0200
committerMichael Vogt <mvo@ubuntu.com>2014-05-07 15:41:54 +0200
commitff94be47f5dbdcf99cea23fad8c9b992a8e5a67e (patch)
treedd57b80bf6ecd853fb3c6d5eab041630ecd1e75e /test/libapt/gtest_runner.cc
parente39698a485e332742b935292dc4329abf19cbb53 (diff)
parent98c934f2723d63d00908803ad47ab1359081ec2d (diff)
Merge branch 'debian/sid' into bugfix/update-progress-reporting
Diffstat (limited to 'test/libapt/gtest_runner.cc')
-rw-r--r--test/libapt/gtest_runner.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/libapt/gtest_runner.cc b/test/libapt/gtest_runner.cc
new file mode 100644
index 000000000..5823c55de
--- /dev/null
+++ b/test/libapt/gtest_runner.cc
@@ -0,0 +1,19 @@
+#include <gtest/gtest.h>
+#include <apt-pkg/error.h>
+int main(int argc, char **argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ int 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;
+}