xref: /aosp_15_r20/external/crosvm/third_party/minijail/testrunner.cc (revision 4b9c6d91573e8b3a96609339b46361b5476dd0f9)
1*4b9c6d91SCole Faust /* Copyright 2017 The ChromiumOS Authors
2*4b9c6d91SCole Faust  * Use of this source code is governed by a BSD-style license that can be
3*4b9c6d91SCole Faust  * found in the LICENSE file.
4*4b9c6d91SCole Faust  *
5*4b9c6d91SCole Faust  * Main entrypoint for gtest.
6*4b9c6d91SCole Faust  * Redirects logging to stderr to avoid syslog logspam.
7*4b9c6d91SCole Faust  */
8*4b9c6d91SCole Faust 
9*4b9c6d91SCole Faust #include <stdio.h>
10*4b9c6d91SCole Faust 
11*4b9c6d91SCole Faust #include <gtest/gtest.h>
12*4b9c6d91SCole Faust 
13*4b9c6d91SCole Faust #include "util.h"
14*4b9c6d91SCole Faust 
15*4b9c6d91SCole Faust namespace {
16*4b9c6d91SCole Faust 
17*4b9c6d91SCole Faust class Environment : public ::testing::Environment {
18*4b9c6d91SCole Faust  public:
19*4b9c6d91SCole Faust   ~Environment() override = default;
20*4b9c6d91SCole Faust 
SetUp()21*4b9c6d91SCole Faust   void SetUp() override {
22*4b9c6d91SCole Faust     init_logging(LOG_TO_FD, STDERR_FILENO, LOG_INFO);
23*4b9c6d91SCole Faust   }
24*4b9c6d91SCole Faust };
25*4b9c6d91SCole Faust 
26*4b9c6d91SCole Faust }  // namespace
27*4b9c6d91SCole Faust 
main(int argc,char ** argv)28*4b9c6d91SCole Faust int main(int argc, char **argv) {
29*4b9c6d91SCole Faust   testing::InitGoogleTest(&argc, argv);
30*4b9c6d91SCole Faust   ::testing::AddGlobalTestEnvironment(new Environment());
31*4b9c6d91SCole Faust   return RUN_ALL_TESTS();
32*4b9c6d91SCole Faust }
33