summaryrefslogtreecommitdiff
path: root/test/libapt/gtest_runner.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-04-25 13:51:50 +0200
committerMichael Vogt <mvo@debian.org>2014-04-25 13:51:50 +0200
commit15ccc2a685b0b884b393e356f9960e86f97f532d (patch)
tree920a1fcf6fa2c92a05d0d1d2ccb22eb32b88522e /test/libapt/gtest_runner.cc
parenta40c6649b99814c7d30964accdd5ecc4f1ce369a (diff)
parent506ab3c78fb67f5e452a1748f4870af767de5ebb (diff)
Merge branch 'debian/sid' into ubuntu/master
Conflicts: debian/changelog
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;
+}