Mike Frysinger | 50e31fa | 2018-01-19 18:59:49 -0500 | [diff] [blame] | 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 | */ |
Luis Hector Chavez | 114a930 | 2017-09-05 20:36:58 -0700 | [diff] [blame] | 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 | |
Luis Hector Chavez | ef9e132 | 2017-09-14 10:16:02 -0700 | [diff] [blame] | 21 | void SetUp() override { |
Luis Hector Chavez | 114a930 | 2017-09-05 20:36:58 -0700 | [diff] [blame] | 22 | init_logging(LOG_TO_FD, STDERR_FILENO, LOG_INFO); |
| 23 | } |
| 24 | }; |
| 25 | |
| 26 | } // namespace |
| 27 | |
| 28 | int main(int argc, char **argv) { |
| 29 | testing::InitGoogleTest(&argc, argv); |
| 30 | ::testing::AddGlobalTestEnvironment(new Environment()); |
| 31 | return RUN_ALL_TESTS(); |
| 32 | } |