blob: 845f16a912cfe9053f20397a47c443dc04e1874b [file] [log] [blame]
Gilad Arnold0b4a6ff2012-04-30 13:13:03 -07001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
rspangler@google.com49fdf182009-10-10 00:57:34 +00002// 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 Petkov9c0baf82010-10-07 13:44:48 -07007#include <base/at_exit.h>
8#include <base/command_line.h>
Alex Deymo0bb23412015-06-19 00:04:46 -07009#include <chromeos/test_helpers.h>
rspangler@google.com49fdf182009-10-10 00:57:34 +000010#include <gtest/gtest.h>
Darin Petkov9c0baf82010-10-07 13:44:48 -070011
Darin Petkov9c0baf82010-10-07 13:44:48 -070012#include "update_engine/terminator.h"
adlr@google.comc98a7ed2009-12-04 18:54:03 +000013
rspangler@google.com49fdf182009-10-10 00:57:34 +000014int main(int argc, char **argv) {
Gilad Arnoldfc359292012-04-30 22:04:24 -070015 LOG(INFO) << "started";
Darin Petkov5c0a8af2010-08-24 13:39:13 -070016 base::AtExitManager exit_manager;
Gilad Arnold0b4a6ff2012-04-30 13:13:03 -070017 // 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 Arnoldfc359292012-04-30 22:04:24 -070023 LOG(INFO) << "parsing command line arguments";
Alex Vakulenkob96ecda2015-04-02 14:31:10 -070024 base::CommandLine::Init(argc, argv);
Gilad Arnoldfc359292012-04-30 22:04:24 -070025 LOG(INFO) << "initializing gtest";
Alex Deymo0bb23412015-06-19 00:04:46 -070026 SetUpTests(&argc, argv, true);
Gilad Arnoldfc359292012-04-30 22:04:24 -070027 LOG(INFO) << "running unit tests";
Gilad Arnoldfaac2a52012-04-26 14:44:17 -070028 int test_result = RUN_ALL_TESTS();
29 LOG(INFO) << "unittest return value: " << test_result;
30 return test_result;
rspangler@google.com49fdf182009-10-10 00:57:34 +000031}