Coverage for /Syzygy/integration_tests/instrument_integration_test.cc

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
99.3%2772790.C++source

Line-by-line coverage:

   1    :  // Copyright 2013 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    :  #include "base/environment.h"
  16    :  #include "base/string_util.h"
  17    :  #include "base/stringprintf.h"
  18    :  #include "gtest/gtest.h"
  19    :  #include "syzygy/agent/asan/asan_rtl_impl.h"
  20    :  #include "syzygy/agent/asan/asan_runtime.h"
  21    :  #include "syzygy/common/indexed_frequency_data.h"
  22    :  #include "syzygy/common/unittest_util.h"
  23    :  #include "syzygy/core/unittest_util.h"
  24    :  #include "syzygy/grinder/basic_block_util.h"
  25    :  #include "syzygy/grinder/grinder.h"
  26    :  #include "syzygy/grinder/grinders/basic_block_entry_count_grinder.h"
  27    :  #include "syzygy/grinder/grinders/coverage_grinder.h"
  28    :  #include "syzygy/instrument/instrument_app.h"
  29    :  #include "syzygy/pe/decomposer.h"
  30    :  #include "syzygy/pe/test_dll.h"
  31    :  #include "syzygy/pe/unittest_util.h"
  32    :  #include "syzygy/trace/common/unittest_util.h"
  33    :  
  34    :  namespace integration_tests {
  35    :  
  36    :  namespace {
  37    :  
  38    :  using grinder::basic_block_util::EntryCountMap;
  39    :  using grinder::basic_block_util::ModuleEntryCountMap;
  40    :  using instrument::InstrumentApp;
  41    :  using trace::parser::Parser;
  42    :  typedef block_graph::BlockGraph::Block Block;
  43    :  typedef block_graph::BlockGraph::BlockMap BlockMap;
  44    :  typedef common::Application<InstrumentApp> TestApp;
  45    :  typedef grinder::CoverageData::LineExecutionCountMap LineExecutionCountMap;
  46    :  typedef grinder::CoverageData::SourceFileCoverageData SourceFileCoverageData;
  47    :  typedef grinder::CoverageData::SourceFileCoverageDataMap
  48    :      SourceFileCoverageDataMap;
  49    :  
  50    :  enum AccessMode {
  51    :    ASAN_READ_ACCESS = agent::asan::HeapProxy::ASAN_READ_ACCESS,
  52    :    ASAN_WRITE_ACCESS = agent::asan::HeapProxy::ASAN_WRITE_ACCESS,
  53    :    ASAN_UNKNOWN_ACCESS = agent::asan::HeapProxy::ASAN_UNKNOWN_ACCESS,
  54    :  };
  55    :  
  56    :  enum BadAccessKind {
  57    :    UNKNOWN_BAD_ACCESS = agent::asan::HeapProxy::UNKNOWN_BAD_ACCESS,
  58    :    USE_AFTER_FREE = agent::asan::HeapProxy::USE_AFTER_FREE,
  59    :    HEAP_BUFFER_OVERFLOW = agent::asan::HeapProxy::HEAP_BUFFER_OVERFLOW,
  60    :    HEAP_BUFFER_UNDERFLOW = agent::asan::HeapProxy::HEAP_BUFFER_UNDERFLOW,
  61    :  };
  62    :  
  63    :  // Contains the number of ASAN errors reported with our callback.
  64    :  int asan_error_count;
  65    :  // Contains the last ASAN error reported.
  66    :  agent::asan::AsanErrorInfo last_asan_error;
  67    :  
  68  E :  void AsanSafeCallback(CONTEXT* ctx, agent::asan::AsanErrorInfo* info) {
  69  E :    asan_error_count++;
  70  E :    last_asan_error = *info;
  71  E :  }
  72    :  
  73  E :  void ResetAsanErrors() {
  74  E :    asan_error_count = 0;
  75  E :  }
  76    :  
  77  E :  void SetAsanCallBack() {
  78    :    typedef void (WINAPI *AsanSetCallBack)(AsanErrorCallBack);
  79    :  
  80  E :    HMODULE asan_module = GetModuleHandle(L"asan_rtl.dll");
  81  E :    DCHECK(asan_module != NULL);
  82    :    AsanSetCallBack set_callback = reinterpret_cast<AsanSetCallBack>(
  83  E :        ::GetProcAddress(asan_module, "asan_SetCallBack"));
  84  E :    DCHECK(set_callback != NULL);
  85    :  
  86  E :    set_callback(AsanSafeCallback);
  87  E :  };
  88    :  
  89    :  class InstrumentAppIntegrationTest : public testing::PELibUnitTest {
  90    :   public:
  91    :    typedef testing::PELibUnitTest Super;
  92    :  
  93    :    InstrumentAppIntegrationTest()
  94    :        : cmd_line_(base::FilePath(L"instrument.exe")),
  95    :          test_impl_(test_app_.implementation()),
  96  E :          image_layout_(&block_graph_) {
  97  E :    }
  98    :  
  99  E :    void SetUp() {
 100  E :      Super::SetUp();
 101    :  
 102    :      // Several of the tests generate progress and (deliberate) error messages
 103    :      // that would otherwise clutter the unittest output.
 104  E :      logging::SetMinLogLevel(logging::LOG_FATAL);
 105    :  
 106    :      // Setup the IO streams.
 107  E :      CreateTemporaryDir(&temp_dir_);
 108  E :      stdin_path_ = temp_dir_.Append(L"NUL");
 109  E :      stdout_path_ = temp_dir_.Append(L"stdout.txt");
 110  E :      stderr_path_ = temp_dir_.Append(L"stderr.txt");
 111  E :      InitStreams(stdin_path_, stdout_path_, stderr_path_);
 112    :  
 113    :      // Initialize the (potential) input and output path values.
 114    :      base::FilePath abs_input_dll_path_ =
 115  E :          testing::GetExeRelativePath(testing::kTestDllName);
 116  E :      input_dll_path_ = testing::GetRelativePath(abs_input_dll_path_);
 117  E :      output_dll_path_ = temp_dir_.Append(input_dll_path_.BaseName());
 118    :  
 119    :      // Initialize call_service output directory for produced trace files.
 120  E :      traces_dir_ = temp_dir_.Append(L"traces");
 121    :  
 122    :      // Initialize call_service session id.
 123  E :      service_.SetEnvironment();
 124    :  
 125  E :      ASSERT_NO_FATAL_FAILURE(ConfigureTestApp(&test_app_));
 126  E :    }
 127    :  
 128  E :    void TearDown() {
 129    :      // We need to release the module handle before Super::TearDown, otherwise
 130    :      // the library file cannot be deleted.
 131  E :      module_.Release();
 132    :  
 133  E :      Super::TearDown();
 134  E :    }
 135    :  
 136    :    // Points the application at the fixture's command-line and IO streams.
 137    :    template<typename TestAppType>
 138  E :    void ConfigureTestApp(TestAppType* test_app) {
 139  E :      test_app->set_command_line(&cmd_line_);
 140  E :      test_app->set_in(in());
 141  E :      test_app->set_out(out());
 142  E :      test_app->set_err(err());
 143  E :    }
 144    :  
 145  E :    void StartService() {
 146  E :      service_.Start(traces_dir_);
 147  E :    }
 148    :  
 149  E :    void StopService() {
 150  E :      service_.Stop();
 151  E :    }
 152    :  
 153    :    // Runs an instrumentation pass in the given mode and validates that the
 154    :    // resulting output DLL loads.
 155  E :    void EndToEndTest(const std::string& mode) {
 156  E :      cmd_line_.AppendSwitchPath("input-image", input_dll_path_);
 157  E :      cmd_line_.AppendSwitchPath("output-image", output_dll_path_);
 158  E :      cmd_line_.AppendSwitchASCII("mode", mode);
 159    :  
 160    :      // Create the instrumented DLL.
 161  E :      common::Application<instrument::InstrumentApp> app;
 162  E :      ASSERT_NO_FATAL_FAILURE(ConfigureTestApp(&app));
 163  E :      ASSERT_EQ(0, app.Run());
 164    :  
 165    :      // Validate that the test dll loads post instrumentation.
 166  E :      ASSERT_NO_FATAL_FAILURE(CheckTestDll(output_dll_path_, &module_));
 167  E :    }
 168    :  
 169    :    // Invoke a test function inside test_dll by addressing it with a test id.
 170    :    // Returns the value resulting of test function execution.
 171  E :    unsigned int InvokeTestDllFunction(EndToEndTestId test) {
 172    :      // Load the exported 'function_name' function.
 173    :      typedef unsigned int (CALLBACK* TestDllFuncs)(unsigned int);
 174    :      TestDllFuncs func = reinterpret_cast<TestDllFuncs>(
 175  E :          ::GetProcAddress(module_, "EndToEndTest"));
 176  E :      DCHECK(func != NULL);
 177    :  
 178    :      // Invoke it, and returns its value.
 179  E :      return func(test);
 180  E :    }
 181    :  
 182  E :    void EndToEndCheckTestDll() {
 183    :      // Validate that behavior is unchanged after instrumentation.
 184  E :      EXPECT_EQ(0xfff80200, InvokeTestDllFunction(kArrayComputation1TestId));
 185  E :      EXPECT_EQ(0x00000200, InvokeTestDllFunction(kArrayComputation2TestId));
 186  E :    }
 187    :  
 188    :    void AsanErrorCheck(EndToEndTestId test, BadAccessKind kind,
 189  E :        AccessMode mode, size_t size) {
 190    :  
 191  E :      ResetAsanErrors();
 192  E :      InvokeTestDllFunction(test);
 193  E :      EXPECT_LT(0, asan_error_count);
 194  E :      EXPECT_EQ(kind, last_asan_error.error_type);
 195  E :      EXPECT_EQ(mode, last_asan_error.access_mode);
 196  E :      EXPECT_EQ(size, last_asan_error.access_size);
 197  E :    }
 198    :  
 199  E :    void AsanErrorCheckTestDll() {
 200  E :      ASSERT_NO_FATAL_FAILURE(SetAsanCallBack());
 201    :  
 202    :      AsanErrorCheck(kAsanRead8BufferOverflowTestId, HEAP_BUFFER_OVERFLOW,
 203  E :          ASAN_READ_ACCESS, 1);
 204    :      AsanErrorCheck(kAsanRead16BufferOverflowTestId, HEAP_BUFFER_OVERFLOW,
 205  E :          ASAN_READ_ACCESS, 2);
 206    :      AsanErrorCheck(kAsanRead32BufferOverflowTestId, HEAP_BUFFER_OVERFLOW,
 207  E :          ASAN_READ_ACCESS, 4);
 208    :      AsanErrorCheck(kAsanRead64BufferOverflowTestId, HEAP_BUFFER_OVERFLOW,
 209  E :          ASAN_READ_ACCESS, 8);
 210    :  
 211    :      AsanErrorCheck(kAsanRead8BufferUnderflowTestId, HEAP_BUFFER_UNDERFLOW,
 212  E :          ASAN_READ_ACCESS, 1);
 213    :      AsanErrorCheck(kAsanRead16BufferUnderflowTestId, HEAP_BUFFER_UNDERFLOW,
 214  E :          ASAN_READ_ACCESS, 2);
 215    :      AsanErrorCheck(kAsanRead32BufferUnderflowTestId, HEAP_BUFFER_UNDERFLOW,
 216  E :          ASAN_READ_ACCESS, 4);
 217    :      AsanErrorCheck(kAsanRead64BufferUnderflowTestId, HEAP_BUFFER_UNDERFLOW,
 218  E :          ASAN_READ_ACCESS, 8);
 219    :  
 220    :      AsanErrorCheck(kAsanWrite8BufferOverflowTestId, HEAP_BUFFER_OVERFLOW,
 221  E :          ASAN_WRITE_ACCESS, 1);
 222    :      AsanErrorCheck(kAsanWrite16BufferOverflowTestId, HEAP_BUFFER_OVERFLOW,
 223  E :          ASAN_WRITE_ACCESS, 2);
 224    :      AsanErrorCheck(kAsanWrite32BufferOverflowTestId, HEAP_BUFFER_OVERFLOW,
 225  E :          ASAN_WRITE_ACCESS, 4);
 226    :      AsanErrorCheck(kAsanWrite64BufferOverflowTestId, HEAP_BUFFER_OVERFLOW,
 227  E :          ASAN_WRITE_ACCESS, 8);
 228    :  
 229    :      AsanErrorCheck(kAsanWrite8BufferUnderflowTestId, HEAP_BUFFER_UNDERFLOW,
 230  E :          ASAN_WRITE_ACCESS, 1);
 231    :      AsanErrorCheck(kAsanWrite16BufferUnderflowTestId, HEAP_BUFFER_UNDERFLOW,
 232  E :          ASAN_WRITE_ACCESS, 2);
 233    :      AsanErrorCheck(kAsanWrite32BufferUnderflowTestId, HEAP_BUFFER_UNDERFLOW,
 234  E :          ASAN_WRITE_ACCESS, 4);
 235    :      AsanErrorCheck(kAsanWrite64BufferUnderflowTestId, HEAP_BUFFER_UNDERFLOW,
 236  E :          ASAN_WRITE_ACCESS, 8);
 237    :  
 238    :      AsanErrorCheck(kAsanRead8UseAfterFreeTestId, USE_AFTER_FREE,
 239  E :          ASAN_READ_ACCESS, 1);
 240    :      AsanErrorCheck(kAsanRead16UseAfterFreeTestId, USE_AFTER_FREE,
 241  E :          ASAN_READ_ACCESS, 2);
 242    :      AsanErrorCheck(kAsanRead32UseAfterFreeTestId, USE_AFTER_FREE,
 243  E :          ASAN_READ_ACCESS, 4);
 244    :      AsanErrorCheck(kAsanRead64UseAfterFreeTestId, USE_AFTER_FREE,
 245  E :          ASAN_READ_ACCESS, 8);
 246    :  
 247    :      AsanErrorCheck(kAsanWrite8UseAfterFreeTestId, USE_AFTER_FREE,
 248  E :          ASAN_WRITE_ACCESS, 1);
 249    :      AsanErrorCheck(kAsanWrite16UseAfterFreeTestId, USE_AFTER_FREE,
 250  E :          ASAN_WRITE_ACCESS, 2);
 251    :      AsanErrorCheck(kAsanWrite32UseAfterFreeTestId, USE_AFTER_FREE,
 252  E :          ASAN_WRITE_ACCESS, 4);
 253    :      AsanErrorCheck(kAsanWrite64UseAfterFreeTestId, USE_AFTER_FREE,
 254  E :          ASAN_WRITE_ACCESS, 8);
 255  E :    }
 256    :  
 257  E :    void BBEntryInvokeTestDll() {
 258  E :      EXPECT_EQ(42, InvokeTestDllFunction(kBBEntryCallOnce));
 259  E :      EXPECT_EQ(42, InvokeTestDllFunction(kBBEntryCallTree));
 260  E :      EXPECT_EQ(42, InvokeTestDllFunction(kBBEntryCallRecursive));
 261  E :    }
 262    :  
 263  E :    void QueueTraces(Parser* parser) {
 264  E :      DCHECK(parser != NULL);
 265    :  
 266    :      // Queue up the trace file(s) we engendered.
 267    :      file_util::FileEnumerator enumerator(traces_dir_,
 268    :                                           false,
 269  E :                                           file_util::FileEnumerator::FILES);
 270  E :      while (true) {
 271  E :        base::FilePath trace_file = enumerator.Next();
 272  E :        if (trace_file.empty())
 273  E :          break;
 274  E :        ASSERT_TRUE(parser->OpenTraceFile(trace_file));
 275  E :      }
 276  E :    }
 277    :  
 278  E :    const Block* FindBlockWithName(std::string name) {
 279  E :      const BlockMap& blocks = block_graph_.blocks();
 280  E :      BlockMap::const_iterator block_iter = blocks.begin();
 281  E :      for (; block_iter != blocks.end(); ++block_iter) {
 282  E :        const Block& block = block_iter->second;
 283  E :        if (block.type() != block_graph::BlockGraph::CODE_BLOCK)
 284  E :          continue;
 285  E :        if (block.name().compare(name) == 0)
 286  E :          return &block;
 287  E :      }
 288  i :      return NULL;
 289  E :    }
 290    :  
 291  E :    int GetBlockFrequency(const EntryCountMap& entry_count, const Block* block) {
 292  E :      DCHECK(block != NULL);
 293    :      EntryCountMap::const_iterator entry =
 294  E :          entry_count.find(block->addr().value());
 295  E :      if (entry == entry_count.end())
 296  i :        return 0;
 297  E :      return entry->second;
 298  E :    }
 299    :  
 300    :    void ExpectFunctionFrequency(const EntryCountMap& entry_count,
 301    :                                 const char* function_name,
 302  E :                                 int expected_frequency) {
 303  E :      DCHECK(function_name != NULL);
 304  E :      const Block* block = FindBlockWithName(function_name);
 305  E :      ASSERT_TRUE(block != NULL);
 306  E :      int exec_frequency = GetBlockFrequency(entry_count, block);
 307  E :      EXPECT_EQ(expected_frequency, exec_frequency);
 308  E :    }
 309    :  
 310  E :    void DecomposeImage() {
 311    :      // Decompose the DLL.
 312  E :      pe_image_.Init(input_dll_path_);
 313  E :      pe::Decomposer decomposer(pe_image_);
 314  E :      ASSERT_TRUE(decomposer.Decompose(&image_layout_));
 315  E :    }
 316    :  
 317  E :    void BBEntryCheckTestDll() {
 318  E :      Parser parser;
 319  E :      grinder::grinders::BasicBlockEntryCountGrinder grinder;
 320    :  
 321    :      // Initialize trace parser.
 322  E :      ASSERT_TRUE(parser.Init(&grinder));
 323  E :      grinder.SetParser(&parser);
 324    :  
 325    :      // Add generated traces to the parser.
 326  E :      QueueTraces(&parser);
 327    :  
 328    :      // Parse all traces.
 329  E :      ASSERT_TRUE(parser.Consume());
 330  E :      ASSERT_FALSE(parser.error_occurred());
 331  E :      ASSERT_TRUE(grinder.Grind());
 332    :  
 333    :      // Retrieve basic block count information.
 334    :      const grinder::basic_block_util::ModuleEntryCountMap& module_entry_count =
 335  E :          grinder.entry_count_map();
 336  E :      ASSERT_EQ(1u, module_entry_count.size());
 337    :  
 338  E :      ModuleEntryCountMap::const_iterator entry_iter = module_entry_count.begin();
 339  E :      const EntryCountMap& entry_count = entry_iter->second;
 340    :  
 341    :      // Decompose the output image.
 342  E :      ASSERT_NO_FATAL_FAILURE(DecomposeImage());
 343    :  
 344    :      // Validate function entry counts.
 345  E :      ASSERT_NO_FATAL_FAILURE(
 346    :          ExpectFunctionFrequency(entry_count, "BBEntryCallOnce", 1));
 347  E :      ASSERT_NO_FATAL_FAILURE(
 348    :          ExpectFunctionFrequency(entry_count, "BBEntryCallTree", 1));
 349  E :      ASSERT_NO_FATAL_FAILURE(
 350    :          ExpectFunctionFrequency(entry_count, "BBEntryFunction1", 4));
 351  E :      ASSERT_NO_FATAL_FAILURE(
 352    :          ExpectFunctionFrequency(entry_count, "BBEntryFunction2", 2));
 353  E :      ASSERT_NO_FATAL_FAILURE(
 354    :          ExpectFunctionFrequency(entry_count, "BBEntryFunction3", 1));
 355  E :      ASSERT_NO_FATAL_FAILURE(
 356    :          ExpectFunctionFrequency(entry_count, "BBEntryCallRecursive", 1));
 357  E :      ASSERT_NO_FATAL_FAILURE(
 358    :          ExpectFunctionFrequency(entry_count, "BBEntryFunctionRecursive", 42));
 359  E :    }
 360    :  
 361  E :    bool GetLineInfoExecution(const SourceFileCoverageData* data, size_t line) {
 362  E :      DCHECK(data != NULL);
 363    :  
 364  E :      const LineExecutionCountMap& lines = data->line_execution_count_map;
 365  E :      LineExecutionCountMap::const_iterator look = lines.find(line);
 366  E :      if (look != lines.end()) {
 367  E :        if (look->second != 0)
 368  E :          return true;
 369    :      }
 370    :  
 371  E :      return false;
 372  E :    }
 373    :  
 374  E :    void CoverageInvokeTestDll() {
 375  E :      EXPECT_EQ(182, InvokeTestDllFunction(kCoverage1));
 376  E :      EXPECT_EQ(182, InvokeTestDllFunction(kCoverage2));
 377  E :      EXPECT_EQ(2, InvokeTestDllFunction(kCoverage3));
 378  E :    }
 379    :  
 380  E :    void CoverageCheckTestDll() {
 381  E :      Parser parser;
 382  E :      grinder::grinders::CoverageGrinder grinder;
 383    :  
 384    :      // Initialize trace parser.
 385  E :      ASSERT_TRUE(parser.Init(&grinder));
 386  E :      grinder.SetParser(&parser);
 387    :  
 388    :      // Add generated traces to the parser.
 389  E :      QueueTraces(&parser);
 390    :  
 391    :      // Parse all traces.
 392  E :      ASSERT_TRUE(parser.Consume());
 393  E :      ASSERT_FALSE(parser.error_occurred());
 394  E :      ASSERT_TRUE(grinder.Grind());
 395    :  
 396    :      // Retrieve coverage information.
 397  E :      const grinder::CoverageData& coverage_data = grinder.coverage_data();
 398    :      const SourceFileCoverageDataMap& files =
 399  E :          coverage_data.source_file_coverage_data_map();
 400    :  
 401    :      // Find file "test_dll_cov.cc".
 402  E :      SourceFileCoverageDataMap::const_iterator file = files.begin();
 403  E :      const SourceFileCoverageData* data = NULL;
 404  E :      for (; file != files.end(); ++file) {
 405  E :        if (EndsWith(file->first, "test_dll_cov.cc", true)) {
 406  E :          data = &file->second;
 407  E :          break;
 408    :        }
 409  E :      }
 410  E :      ASSERT_TRUE(data != NULL);
 411    :  
 412    :      // Validate function entry counts.
 413    :      // Function: coverage_func1.
 414  E :      EXPECT_TRUE(GetLineInfoExecution(data, 26));
 415  E :      EXPECT_TRUE(GetLineInfoExecution(data, 27));
 416    :  
 417    :      // Function: coverage_func2.
 418  E :      EXPECT_TRUE(GetLineInfoExecution(data, 33));
 419  E :      EXPECT_TRUE(GetLineInfoExecution(data, 34));
 420  E :      EXPECT_TRUE(GetLineInfoExecution(data, 35));
 421  E :      EXPECT_FALSE(GetLineInfoExecution(data, 38));
 422  E :      EXPECT_TRUE(GetLineInfoExecution(data, 40));
 423    :  
 424    :      // Function: coverage_func3.
 425  E :      EXPECT_TRUE(GetLineInfoExecution(data, 45));
 426  E :      EXPECT_FALSE(GetLineInfoExecution(data, 47));
 427  E :      EXPECT_FALSE(GetLineInfoExecution(data, 48));
 428  E :      EXPECT_TRUE(GetLineInfoExecution(data, 50));
 429  E :      EXPECT_TRUE(GetLineInfoExecution(data, 52));
 430  E :    }
 431    :  
 432    :    // Stashes the current log-level before each test instance and restores it
 433    :    // after each test completes.
 434    :    testing::ScopedLogLevelSaver log_level_saver;
 435    :  
 436    :    // @name The application under test.
 437    :    // @{
 438    :    TestApp test_app_;
 439    :    TestApp::Implementation& test_impl_;
 440    :    base::FilePath temp_dir_;
 441    :    base::FilePath stdin_path_;
 442    :    base::FilePath stdout_path_;
 443    :    base::FilePath stderr_path_;
 444    :    // @}
 445    :  
 446    :    // @name Command-line, parameters and outputs.
 447    :    // @{
 448    :    CommandLine cmd_line_;
 449    :    base::FilePath input_dll_path_;
 450    :    base::FilePath output_dll_path_;
 451    :    base::FilePath traces_dir_;
 452    :    // @}
 453    :  
 454    :    // The test_dll module.
 455    :    testing::ScopedHMODULE module_;
 456    :  
 457    :    // Our call trace service process instance.
 458    :    testing::CallTraceService service_;
 459    :  
 460    :    // Decomposed image.
 461    :    pe::PEFile pe_image_;
 462    :    pe::ImageLayout image_layout_;
 463    :    block_graph::BlockGraph block_graph_;
 464    :  };
 465    :  
 466    :  }  // namespace
 467    :  
 468  E :  TEST_F(InstrumentAppIntegrationTest, AsanEndToEnd) {
 469  E :    ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan"));
 470  E :    ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll());
 471  E :    ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll());
 472  E :  }
 473    :  
 474  E :  TEST_F(InstrumentAppIntegrationTest, LivenessAsanEndToEnd) {
 475  E :    cmd_line_.AppendSwitchPath("use-liveness-analysis", input_dll_path_);
 476  E :    ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan"));
 477  E :    ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll());
 478  E :    ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll());
 479  E :  }
 480    :  
 481  E :  TEST_F(InstrumentAppIntegrationTest, RedundantMemoryAsanEndToEnd) {
 482  E :    cmd_line_.AppendSwitchPath("remove-redundant-checks", input_dll_path_);
 483  E :    ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan"));
 484  E :    ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll());
 485  E :    ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll());
 486  E :  }
 487    :  
 488  E :  TEST_F(InstrumentAppIntegrationTest, FullOptimizedAsanEndToEnd) {
 489  E :    cmd_line_.AppendSwitchPath("use-liveness-analysis", input_dll_path_);
 490  E :    cmd_line_.AppendSwitchPath("remove-redundant-checks", input_dll_path_);
 491  E :    ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan"));
 492  E :    ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll());
 493  E :    ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll());
 494  E :  }
 495    :  
 496  E :  TEST_F(InstrumentAppIntegrationTest, BBEntryEndToEnd) {
 497  E :    ASSERT_NO_FATAL_FAILURE(StartService());
 498  E :    ASSERT_NO_FATAL_FAILURE(EndToEndTest("bbentry"));
 499  E :    ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll());
 500  E :    ASSERT_NO_FATAL_FAILURE(BBEntryInvokeTestDll());
 501  E :    ASSERT_NO_FATAL_FAILURE(StopService());
 502  E :    ASSERT_NO_FATAL_FAILURE(BBEntryCheckTestDll());
 503  E :  }
 504    :  
 505  E :  TEST_F(InstrumentAppIntegrationTest, InlineFastPathBBEntryEndToEnd) {
 506  E :    cmd_line_.AppendSwitchPath("inline-fast-path", input_dll_path_);
 507  E :    ASSERT_NO_FATAL_FAILURE(StartService());
 508  E :    ASSERT_NO_FATAL_FAILURE(EndToEndTest("bbentry"));
 509  E :    ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll());
 510  E :    ASSERT_NO_FATAL_FAILURE(BBEntryInvokeTestDll());
 511  E :    ASSERT_NO_FATAL_FAILURE(StopService());
 512  E :    ASSERT_NO_FATAL_FAILURE(BBEntryCheckTestDll());
 513  E :  }
 514    :  
 515  E :  TEST_F(InstrumentAppIntegrationTest, CallTraceEndToEnd) {
 516  E :    ASSERT_NO_FATAL_FAILURE(EndToEndTest("calltrace"));
 517  E :    ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll());
 518  E :  }
 519    :  
 520  E :  TEST_F(InstrumentAppIntegrationTest, CoverageEndToEnd) {
 521  E :    ASSERT_NO_FATAL_FAILURE(StartService());
 522  E :    ASSERT_NO_FATAL_FAILURE(EndToEndTest("coverage"));
 523  E :    ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll());
 524  E :    ASSERT_NO_FATAL_FAILURE(CoverageInvokeTestDll());
 525  E :    ASSERT_NO_FATAL_FAILURE(StopService());
 526  E :    ASSERT_NO_FATAL_FAILURE(CoverageCheckTestDll());
 527  E :  }
 528    :  
 529  E :  TEST_F(InstrumentAppIntegrationTest, BBEntryCoverageEndToEnd) {
 530    :    // Coverage grinder must be able to process traces produced by bbentry
 531    :    // instrumentation.
 532  E :    ASSERT_NO_FATAL_FAILURE(StartService());
 533  E :    ASSERT_NO_FATAL_FAILURE(EndToEndTest("bbentry"));
 534  E :    ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll());
 535  E :    ASSERT_NO_FATAL_FAILURE(CoverageInvokeTestDll());
 536  E :    ASSERT_NO_FATAL_FAILURE(StopService());
 537  E :    ASSERT_NO_FATAL_FAILURE(CoverageCheckTestDll());
 538  E :  }
 539    :  
 540  E :  TEST_F(InstrumentAppIntegrationTest, ProfileEndToEnd) {
 541  E :    ASSERT_NO_FATAL_FAILURE(EndToEndTest("profile"));
 542  E :    ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll());
 543  E :  }
 544    :  
 545    :  }  // namespace integration_tests

Coverage information generated Thu Jul 04 09:34:53 2013.