Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Chris Masone | 0e1d104 | 2011-05-09 18:07:03 -0700 | [diff] [blame] | 5 | #include <base/at_exit.h> |
Darin Petkov | 3569415 | 2011-08-17 16:55:04 -0700 | [diff] [blame] | 6 | #include <base/command_line.h> |
| 7 | #include <chromeos/syslog_logging.h> |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 8 | #include <gtest/gtest.h> |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 9 | |
Prathmesh Prabhu | f002cdb | 2014-09-17 22:41:05 -0700 | [diff] [blame] | 10 | #include "shill/logging.h" |
| 11 | |
| 12 | namespace switches { |
| 13 | |
| 14 | static const char kHelp[] = "help"; |
| 15 | |
| 16 | static const char kHelpMessage[] = "\n" |
| 17 | "Additional (non-gtest) switches:\n" |
| 18 | " --log-level=N\n" |
| 19 | " Logging level:\n" |
| 20 | " 0 = LOG(INFO), 1 = LOG(WARNING), 2 = LOG(ERROR),\n" |
| 21 | " -1 = SLOG(..., 1), -2 = SLOG(..., 2), etc.\n" |
| 22 | " --log-scopes=\"*scope1+scope2\".\n" |
| 23 | " Scopes to enable for SLOG()-based logging.\n"; |
| 24 | |
| 25 | } // namespace switches |
| 26 | |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 27 | int main(int argc, char** argv) { |
Chris Masone | 0e1d104 | 2011-05-09 18:07:03 -0700 | [diff] [blame] | 28 | base::AtExitManager exit_manager; |
Alex Vakulenko | 127f256 | 2015-04-02 14:31:10 -0700 | [diff] [blame] | 29 | base::CommandLine::Init(argc, argv); |
Paul Stewart | 1a212a6 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 30 | base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); |
Darin Petkov | 3569415 | 2011-08-17 16:55:04 -0700 | [diff] [blame] | 31 | chromeos::InitLog(chromeos::kLogToStderr); |
Prathmesh Prabhu | f002cdb | 2014-09-17 22:41:05 -0700 | [diff] [blame] | 32 | shill::SetLogLevelFromCommandLine(cl); |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 33 | ::testing::InitGoogleTest(&argc, argv); |
Prathmesh Prabhu | f002cdb | 2014-09-17 22:41:05 -0700 | [diff] [blame] | 34 | |
| 35 | if (cl->HasSwitch(switches::kHelp)) { |
| 36 | std::cerr << switches::kHelpMessage; |
| 37 | } |
Peter Qiu | 40a0148 | 2014-10-31 11:54:23 -0700 | [diff] [blame] | 38 | |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 39 | return RUN_ALL_TESTS(); |
| 40 | } |