]> git.saurik.com Git - apt.git/blame - test/libapt/gtest_runner.cc
warn if apt-key is used in scripts/its output parsed
[apt.git] / test / libapt / gtest_runner.cc
CommitLineData
f00832cc 1#include <gtest/gtest.h>
011188e3 2
b7aa74a1
DK
3#include <apt-pkg/configuration.h>
4#include <apt-pkg/pkgsystem.h>
f00832cc 5#include <apt-pkg/error.h>
b7aa74a1 6#include <apt-pkg/init.h>
011188e3 7
f00832cc
DK
8int main(int argc, char **argv) {
9 ::testing::InitGoogleTest(&argc, argv);
b7aa74a1
DK
10 if (pkgInitSystem(*_config, _system) == false)
11 return 42;
12 int const result = RUN_ALL_TESTS();
f00832cc
DK
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}