summaryrefslogtreecommitdiff
path: root/test/libapt/gtest_runner.cc
blob: 29f6313269deb9ab390a8293ba8524422e503877 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <gtest/gtest.h>

#include <apt-pkg/error.h>
#include <apt-pkg/cmndline.h>

bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const *) {return false;}
std::vector<CommandLine::DispatchWithHelp> GetCommands() {return {};}

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;
}