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