]> git.saurik.com Git - apt.git/blob - test/libapt/gtest_runner.cc
Merge branch 'feature/apt-dpkg-comm'
[apt.git] / test / libapt / gtest_runner.cc
1 #include <gtest/gtest.h>
2
3 #include <apt-pkg/configuration.h>
4 #include <apt-pkg/pkgsystem.h>
5 #include <apt-pkg/error.h>
6 #include <apt-pkg/init.h>
7
8 int main(int argc, char **argv) {
9 ::testing::InitGoogleTest(&argc, argv);
10 if (pkgInitSystem(*_config, _system) == false)
11 return 42;
12 int const result = RUN_ALL_TESTS();
13 if (_error->empty() == false)
14 {
15 std::cerr << "The test generated the following global messages:" << std::endl;
16 _error->DumpErrors(std::cerr);
17 // messages on the stack can't be right, error out
18 // even if we have no idea where this message came from
19 if (result == 0)
20 {
21 std::cerr << "All tests successful, but messages were generated, so still a failure!" << std::endl;
22 return 29;
23 }
24 }
25 return result;
26 }