Coverage for /Syzygy/common/application_impl.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
82.4%28340.C++source

Line-by-line coverage:

   1    :  // Copyright 2012 Google Inc. All Rights Reserved.
   2    :  //
   3    :  // Licensed under the Apache License, Version 2.0 (the "License");
   4    :  // you may not use this file except in compliance with the License.
   5    :  // You may obtain a copy of the License at
   6    :  //
   7    :  //     http://www.apache.org/licenses/LICENSE-2.0
   8    :  //
   9    :  // Unless required by applicable law or agreed to in writing, software
  10    :  // distributed under the License is distributed on an "AS IS" BASIS,
  11    :  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12    :  // See the License for the specific language governing permissions and
  13    :  // limitations under the License.
  14    :  //
  15    :  // Defines the template member function of the common::Application template
  16    :  // class.
  17    :  //
  18    :  // This is not meant to be included directly.
  19    :  
  20    :  #ifndef SYZYGY_COMMON_APPLICATION_IMPL_H_
  21    :  #define SYZYGY_COMMON_APPLICATION_IMPL_H_
  22    :  
  23    :  #include "base/win/scoped_com_initializer.h"
  24    :  #include "syzygy/common/syzygy_version.h"
  25    :  
  26    :  namespace common {
  27    :  
  28    :  template <typename Impl, AppLoggingFlag kInitLogging>
  29    :  Application<Impl, kInitLogging>::Application()
  30  E :      : command_line_(CommandLine::ForCurrentProcess()) {
  31  E :  }
  32    :  
  33    :  template <typename Impl, AppLoggingFlag kInitLogging>
  34  E :  int Application<Impl, kInitLogging>::Run() {
  35    :    // If we've been asked for our version, spit it out and quit.
  36  E :    if (command_line_->HasSwitch("version")) {
  37  i :      ::fprintf(out(), "%s\n", kSyzygyVersion.GetVersionString().c_str());
  38  i :      return 0;
  39    :    }
  40    :  
  41  E :    if (!InitializeLogging())
  42  i :      return 1;
  43    :  
  44  E :    LOG(INFO) << "Syzygy " << implementation_.name()
  45    :              << " Version " << kSyzygyVersion.GetVersionString() << ".";
  46  E :    LOG(INFO) << "Copyright (c) Google Inc. All rights reserved.";
  47    :  
  48  E :    base::win::ScopedCOMInitializer com_initializer;
  49  E :    if (!com_initializer.succeeded())
  50  i :      return 1;
  51    :  
  52  E :    if (!implementation_.ParseCommandLine(command_line_))
  53  E :      return 1;
  54    :  
  55  E :    if (!implementation_.SetUp())
  56  E :      return 1;
  57    :  
  58  E :    int result = implementation_.Run();
  59    :  
  60  E :    implementation_.TearDown();
  61    :  
  62  E :    return result;
  63  E :  }
  64    :  
  65    :  template <typename Impl, AppLoggingFlag kInitLogging>
  66  E :  bool Application<Impl, kInitLogging>::InitializeLogging() {
  67    :    if ((kInitLogging == INIT_LOGGING_YES) &&
  68    :        !logging::InitLogging(
  69    :            L"",
  70    :            logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG,
  71    :            logging::DONT_LOCK_LOG_FILE,
  72    :            logging::APPEND_TO_OLD_LOG_FILE,
  73  E :            logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS)) {
  74  i :      return false;
  75    :    }
  76    :  
  77  E :    if (command_line_->HasSwitch("verbose")) {
  78  E :      std::string value_str(command_line_->GetSwitchValueASCII("verbose"));
  79  E :      TrimWhitespace(value_str, TRIM_ALL, &value_str);
  80  E :      int value = 1;
  81  E :      if (!base::StringToInt(value_str, &value))
  82  i :        value = 1;
  83  E :      logging::SetMinLogLevel(-::abs(value));
  84  E :    }
  85    :  
  86  E :    return true;
  87  E :  }
  88    :  
  89    :  }  // namespace common
  90    :  
  91    :  #endif  // SYZYGY_COMMON_APPLICATION_IMPL_H_

Coverage information generated Tue Jun 25 13:56:24 2013.