Gilad Arnold | 0b4a6ff | 2012-04-30 13:13:03 -0700 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
rspangler@google.com | 49fdf18 | 2009-10-10 00:57:34 +0000 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | // based on pam_google_testrunner.cc |
| 6 | |
Darin Petkov | 9c0baf8 | 2010-10-07 13:44:48 -0700 | [diff] [blame] | 7 | #include <base/at_exit.h> |
| 8 | #include <base/command_line.h> |
Alex Deymo | 0bb2341 | 2015-06-19 00:04:46 -0700 | [diff] [blame] | 9 | #include <chromeos/test_helpers.h> |
rspangler@google.com | 49fdf18 | 2009-10-10 00:57:34 +0000 | [diff] [blame] | 10 | #include <gtest/gtest.h> |
Darin Petkov | 9c0baf8 | 2010-10-07 13:44:48 -0700 | [diff] [blame] | 11 | |
Darin Petkov | 9c0baf8 | 2010-10-07 13:44:48 -0700 | [diff] [blame] | 12 | #include "update_engine/terminator.h" |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 13 | |
rspangler@google.com | 49fdf18 | 2009-10-10 00:57:34 +0000 | [diff] [blame] | 14 | int main(int argc, char **argv) { |
Gilad Arnold | fc35929 | 2012-04-30 22:04:24 -0700 | [diff] [blame] | 15 | LOG(INFO) << "started"; |
Darin Petkov | 5c0a8af | 2010-08-24 13:39:13 -0700 | [diff] [blame] | 16 | base::AtExitManager exit_manager; |
Gilad Arnold | 0b4a6ff | 2012-04-30 13:13:03 -0700 | [diff] [blame] | 17 | // TODO(garnold) temporarily cause the unittest binary to exit with status |
| 18 | // code 2 upon catching a SIGTERM. This will help diagnose why the unittest |
| 19 | // binary is perceived as failing by the buildbot. We should revert it to use |
| 20 | // the default exit status of 1. Corresponding reverts are necessary in |
| 21 | // terminator_unittest.cc. |
| 22 | chromeos_update_engine::Terminator::Init(2); |
Gilad Arnold | fc35929 | 2012-04-30 22:04:24 -0700 | [diff] [blame] | 23 | LOG(INFO) << "parsing command line arguments"; |
Alex Vakulenko | b96ecda | 2015-04-02 14:31:10 -0700 | [diff] [blame] | 24 | base::CommandLine::Init(argc, argv); |
Gilad Arnold | fc35929 | 2012-04-30 22:04:24 -0700 | [diff] [blame] | 25 | LOG(INFO) << "initializing gtest"; |
Alex Deymo | 0bb2341 | 2015-06-19 00:04:46 -0700 | [diff] [blame] | 26 | SetUpTests(&argc, argv, true); |
Gilad Arnold | fc35929 | 2012-04-30 22:04:24 -0700 | [diff] [blame] | 27 | LOG(INFO) << "running unit tests"; |
Gilad Arnold | faac2a5 | 2012-04-26 14:44:17 -0700 | [diff] [blame] | 28 | int test_result = RUN_ALL_TESTS(); |
| 29 | LOG(INFO) << "unittest return value: " << test_result; |
| 30 | return test_result; |
rspangler@google.com | 49fdf18 | 2009-10-10 00:57:34 +0000 | [diff] [blame] | 31 | } |