summaryrefslogtreecommitdiff
path: root/test/libapt/gtest_runner.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-04-22 16:21:05 +0200
committerMichael Vogt <mvo@debian.org>2014-04-22 16:21:05 +0200
commita298a1dc595c548e6c10b48b8e69d987e5be1c42 (patch)
tree75bbda565cefad82c558605da697ad91c820f165 /test/libapt/gtest_runner.cc
parent6f34deead51a1c200589994a4cf46b7d79a45e69 (diff)
parenta268c98635f96a5ebb432c14f3c5ba6bbd605281 (diff)
Merge remote-tracking branch 'upstream/debian/sid' into debian/sid
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;
+}