Luis Hector Chavez | 114a930 | 2017-09-05 20:36:58 -0700 | [diff] [blame] | 1 | // 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 | |
| 25 | namespace { |
| 26 | |
| 27 | class Environment : public ::testing::Environment { |
| 28 | public: |
| 29 | ~Environment() override = default; |
| 30 | |
Luis Hector Chavez | ef9e132 | 2017-09-14 10:16:02 -0700 | [diff] [blame] | 31 | void SetUp() override { |
Luis Hector Chavez | 114a930 | 2017-09-05 20:36:58 -0700 | [diff] [blame] | 32 | init_logging(LOG_TO_FD, STDERR_FILENO, LOG_INFO); |
| 33 | } |
| 34 | }; |
| 35 | |
| 36 | } // namespace |
| 37 | |
| 38 | int main(int argc, char **argv) { |
| 39 | testing::InitGoogleTest(&argc, argv); |
| 40 | ::testing::AddGlobalTestEnvironment(new Environment()); |
| 41 | return RUN_ALL_TESTS(); |
| 42 | } |