blob: dfd8a73103295504e8c018250f357f8eb9a0f07c [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>
adlr@google.comc98a7ed2009-12-04 18:54:03 +000010#include <glib.h>
rspangler@google.com49fdf182009-10-10 00:57:34 +000011#include <gtest/gtest.h>
Darin Petkov9c0baf82010-10-07 13:44:48 -070012
Darin Petkov9c0baf82010-10-07 13:44:48 -070013#include "update_engine/terminator.h"
adlr@google.comc98a7ed2009-12-04 18:54:03 +000014
rspangler@google.com49fdf182009-10-10 00:57:34 +000015int main(int argc, char **argv) {
Gilad Arnoldfc359292012-04-30 22:04:24 -070016 LOG(INFO) << "started";
Darin Petkov5c0a8af2010-08-24 13:39:13 -070017 base::AtExitManager exit_manager;
Gilad Arnold0b4a6ff2012-04-30 13:13:03 -070018 // TODO(garnold) temporarily cause the unittest binary to exit with status
19 // code 2 upon catching a SIGTERM. This will help diagnose why the unittest
20 // binary is perceived as failing by the buildbot. We should revert it to use
21 // the default exit status of 1. Corresponding reverts are necessary in
22 // terminator_unittest.cc.
23 chromeos_update_engine::Terminator::Init(2);
Gilad Arnoldfc359292012-04-30 22:04:24 -070024 LOG(INFO) << "parsing command line arguments";
Alex Vakulenkob96ecda2015-04-02 14:31:10 -070025 base::CommandLine::Init(argc, argv);
Gilad Arnoldfc359292012-04-30 22:04:24 -070026 LOG(INFO) << "initializing gtest";
Alex Deymo0bb23412015-06-19 00:04:46 -070027 SetUpTests(&argc, argv, true);
Gilad Arnoldfc359292012-04-30 22:04:24 -070028 LOG(INFO) << "running unit tests";
Gilad Arnoldfaac2a52012-04-26 14:44:17 -070029 int test_result = RUN_ALL_TESTS();
30 LOG(INFO) << "unittest return value: " << test_result;
31 return test_result;
rspangler@google.com49fdf182009-10-10 00:57:34 +000032}