• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2017 The Chromium OS Authors. All rights reserved.
2  * Use of this source code is governed by a BSD-style license that can be
3  * found in the LICENSE file.
4  *
5  * Main entrypoint for gtest.
6  * Redirects logging to stderr to avoid syslog logspam.
7  */
8 
9 #include <stdio.h>
10 
11 #include <gtest/gtest.h>
12 
13 #include "util.h"
14 
15 namespace {
16 
17 class Environment : public ::testing::Environment {
18  public:
19   ~Environment() override = default;
20 
SetUp()21   void SetUp() override {
22     init_logging(LOG_TO_FD, STDERR_FILENO, LOG_INFO);
23   }
24 };
25 
26 }  // namespace
27 
main(int argc,char ** argv)28 int main(int argc, char **argv) {
29   testing::InitGoogleTest(&argc, argv);
30   ::testing::AddGlobalTestEnvironment(new Environment());
31   return RUN_ALL_TESTS();
32 }
33