Coverage for /Syzygy/agent/asan/memory_interceptors_unittest.cc

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
100.0%18180.C++test

Line-by-line coverage:

   1    :  // Copyright 2014 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 "syzygy/agent/asan/memory_interceptors.h"
  16    :  
  17    :  #include "gtest/gtest.h"
  18    :  #include "syzygy/agent/asan/unittest_util.h"
  19    :  
  20    :  namespace agent {
  21    :  namespace asan {
  22    :  
  23    :  namespace {
  24    :  
  25    :  using testing::MemoryAccessorTester;
  26    :  using testing::TestMemoryInterceptors;
  27    :  
  28    :  static const TestMemoryInterceptors::InterceptFunction
  29    :      intercept_functions[] = {
  30    :  #define DEFINE_INTERCEPT_FUNCTION_TABLE(access_size, access_mode_str, \
  31    :                                          access_mode) \
  32    :    { asan_check_ ## access_size ## _byte_ ## access_mode_str, access_size },
  33    :  
  34    :  ASAN_MEM_INTERCEPT_FUNCTIONS(DEFINE_INTERCEPT_FUNCTION_TABLE)
  35    :  
  36    :  #undef DEFINE_INTERCEPT_FUNCTION_TABLE
  37    :  };
  38    :  
  39    :  static const TestMemoryInterceptors::InterceptFunction
  40    :      intercept_functions_no_flags[] = {
  41    :  #define DEFINE_INTERCEPT_FUNCTION_TABLE_NO_FLAGS(access_size, \
  42    :      access_mode_str, access_mode) \
  43    :    { asan_check_ ## access_size ## _byte_ ## access_mode_str ## _no_flags, \
  44    :      access_size },
  45    :  
  46    :  ASAN_MEM_INTERCEPT_FUNCTIONS(DEFINE_INTERCEPT_FUNCTION_TABLE_NO_FLAGS)
  47    :  
  48    :  #undef DEFINE_INTERCEPT_FUNCTION_TABLE_NO_FLAGS
  49    :  };
  50    :  
  51    :  static const TestMemoryInterceptors::StringInterceptFunction
  52    :      string_intercept_functions[] = {
  53    :  #define DEFINE_STRING_INTERCEPT_FUNCTION_TABLE(func, prefix, counter, \
  54    :      dst_mode, src_mode, access_size, compare) \
  55    :    { asan_check ## prefix ## access_size ## _byte_ ## func ## _access, \
  56    :      access_size, TestMemoryInterceptors::dst_mode, \
  57    :      TestMemoryInterceptors::src_mode, \
  58    :      TestMemoryInterceptors::kCounterInit_##counter },
  59    :  
  60    :  ASAN_STRING_INTERCEPT_FUNCTIONS(DEFINE_STRING_INTERCEPT_FUNCTION_TABLE)
  61    :  
  62    :  #undef DEFINE_STRINGINTERCEPT_FUNCTION_TABLE
  63    :  };
  64    :  
  65    :  typedef TestMemoryInterceptors MemoryInterceptorsTest;
  66    :  
  67    :  }  // namespace
  68    :  
  69  E :  TEST_F(MemoryInterceptorsTest, TestValidAccess) {
  70  E :    TestValidAccess(intercept_functions);
  71  E :    TestValidAccessIgnoreFlags(intercept_functions_no_flags);
  72  E :  }
  73    :  
  74  E :  TEST_F(MemoryInterceptorsTest, TestOverrunAccess) {
  75  E :    TestOverrunAccess(intercept_functions);
  76  E :    TestOverrunAccessIgnoreFlags(intercept_functions_no_flags);
  77  E :  }
  78    :  
  79  E :  TEST_F(MemoryInterceptorsTest, TestUnderrunAccess) {
  80  E :    TestUnderrunAccess(intercept_functions);
  81  E :    TestUnderrunAccessIgnoreFlags(intercept_functions_no_flags);
  82  E :  }
  83    :  
  84  E :  TEST_F(MemoryInterceptorsTest, TestStringValidAccess) {
  85  E :    TestStringValidAccess(string_intercept_functions);
  86  E :  }
  87    :  
  88  E :  TEST_F(MemoryInterceptorsTest, TestStringOverrunAccess) {
  89  E :    TestStringOverrunAccess(string_intercept_functions);
  90  E :  }
  91    :  
  92    :  }  // namespace asan
  93    :  }  // namespace agent

Coverage information generated Thu Mar 26 16:15:41 2015.