testrunner.cc revision 461b259af8815d782200782c5ba3599d8de4a66c
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 <dbus/dbus-glib.h> 11#include <dbus/dbus-glib-bindings.h> 12#include <dbus/dbus-glib-lowlevel.h> 13#include <glib.h> 14#include <glib-object.h> 15#include <gtest/gtest.h> 16 17#include "update_engine/terminator.h" 18 19int main(int argc, char **argv) { 20 LOG(INFO) << "started"; 21 ::g_type_init(); 22 dbus_threads_init_default(); 23 base::AtExitManager exit_manager; 24 // TODO(garnold) temporarily cause the unittest binary to exit with status 25 // code 2 upon catching a SIGTERM. This will help diagnose why the unittest 26 // binary is perceived as failing by the buildbot. We should revert it to use 27 // the default exit status of 1. Corresponding reverts are necessary in 28 // terminator_unittest.cc. 29 chromeos_update_engine::Terminator::Init(2); 30 LOG(INFO) << "parsing command line arguments"; 31 base::CommandLine::Init(argc, argv); 32 LOG(INFO) << "initializing gtest"; 33 SetUpTests(&argc, argv, true); 34 LOG(INFO) << "running unit tests"; 35 int test_result = RUN_ALL_TESTS(); 36 LOG(INFO) << "unittest return value: " << test_result; 37 return test_result; 38} 39