1 /* Copyright 2017 The ChromiumOS Authors 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 */ 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 SetUp()21 void SetUp() override { init_logging(LOG_TO_FD, STDERR_FILENO, LOG_INFO); } 22 }; 23 24 } // namespace 25 main(int argc,char ** argv)26int main(int argc, char** argv) { 27 testing::InitGoogleTest(&argc, argv); 28 ::testing::AddGlobalTestEnvironment(new Environment()); 29 return RUN_ALL_TESTS(); 30 } 31