aboutsummaryrefslogtreecommitdiff
path: root/testrunner.cc
blob: 162f0e573c307d65c3e4dc4de671b19597adf858 (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
26
27
28
29
30
31
32
/* Copyright 2017 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 *
 * Main entrypoint for gtest.
 * Redirects logging to stderr to avoid syslog logspam.
 */

#include <stdio.h>

#include <gtest/gtest.h>

#include "util.h"

namespace {

class Environment : public ::testing::Environment {
 public:
  ~Environment() override = default;

  void SetUp() override {
    init_logging(LOG_TO_FD, STDERR_FILENO, LOG_INFO);
  }
};

}  // namespace

int main(int argc, char **argv) {
  testing::InitGoogleTest(&argc, argv);
  ::testing::AddGlobalTestEnvironment(new Environment());
  return RUN_ALL_TESTS();
}