testrunner.cc revision 305345001d85ca2282112c2a30fe75c7a4773491
1// Copyright (c) 2012 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 5// based on pam_google_testrunner.cc 6 7#include <base/at_exit.h> 8#include <base/command_line.h> 9#include <chromeos/test_helpers.h> 10#include <glib.h> 11#include <gtest/gtest.h> 12 13#include "update_engine/terminator.h" 14 15int main(int argc, char **argv) { 16 LOG(INFO) << "started"; 17 base::AtExitManager exit_manager; 18 // 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); 24 LOG(INFO) << "parsing command line arguments"; 25 base::CommandLine::Init(argc, argv); 26 LOG(INFO) << "initializing gtest"; 27 SetUpTests(&argc, argv, true); 28 LOG(INFO) << "running unit tests"; 29 int test_result = RUN_ALL_TESTS(); 30 LOG(INFO) << "unittest return value: " << test_result; 31 return test_result; 32} 33