blob: 62ef6d709a0181507ea4d7b337720e7140e8082c [file] [log] [blame]
Luis Hector Chavez114a9302017-09-05 20:36:58 -07001// testrunner.cpp
2// Copyright (C) 2017 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16// Main entrypoint for gtest.
17// Redirects logging to stderr to avoid syslog logspam.
18
19#include <stdio.h>
20
21#include <gtest/gtest.h>
22
23#include "util.h"
24
25namespace {
26
27class Environment : public ::testing::Environment {
28 public:
29 ~Environment() override = default;
30
Luis Hector Chavezef9e1322017-09-14 10:16:02 -070031 void SetUp() override {
Luis Hector Chavez114a9302017-09-05 20:36:58 -070032 init_logging(LOG_TO_FD, STDERR_FILENO, LOG_INFO);
33 }
34};
35
36} // namespace
37
38int main(int argc, char **argv) {
39 testing::InitGoogleTest(&argc, argv);
40 ::testing::AddGlobalTestEnvironment(new Environment());
41 return RUN_ALL_TESTS();
42}