blob: 162f0e573c307d65c3e4dc4de671b19597adf858 [file] [log] [blame]
Mike Frysinger50e31fa2018-01-19 18:59:49 -05001/* 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 Chavez114a9302017-09-05 20:36:58 -07008
9#include <stdio.h>
10
11#include <gtest/gtest.h>
12
13#include "util.h"
14
15namespace {
16
17class Environment : public ::testing::Environment {
18 public:
19 ~Environment() override = default;
20
Luis Hector Chavezef9e1322017-09-14 10:16:02 -070021 void SetUp() override {
Luis Hector Chavez114a9302017-09-05 20:36:58 -070022 init_logging(LOG_TO_FD, STDERR_FILENO, LOG_INFO);
23 }
24};
25
26} // namespace
27
28int main(int argc, char **argv) {
29 testing::InitGoogleTest(&argc, argv);
30 ::testing::AddGlobalTestEnvironment(new Environment());
31 return RUN_ALL_TESTS();
32}