CCTLib
Calling-context and data-object attribution library for Intel Pin
shadow_memory_unittest.cpp File Reference
#include <cstdio>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <thread>
#include <vector>
#include <atomic>
#include "shadow_memory.H"
+ Include dependency graph for shadow_memory_unittest.cpp:

Go to the source code of this file.

Macros

#define CHECK_EQ(actual, expected, msg)
 
#define RUN_TEST(fn)
 

Functions

static void test_shadow_write_read_single ()
 
static void test_shadow_multiple_addresses_same_page ()
 
static void test_shadow_multiple_pages ()
 
static void test_shadow_multi_type_tuple ()
 
static void test_shadow_free_fn_matches_base_fn ()
 
static void test_shadow_base_fn_matches_free_fn ()
 
static void test_shadow_pointer_stable ()
 
static void test_shadow_init_pattern ()
 
static void test_concurrent_write_read_single ()
 
static void test_concurrent_free_fn_matches_base_fn ()
 
static void test_concurrent_multi_type_tuple ()
 
static void test_concurrent_multi_thread ()
 
static void test_concurrent_init_pattern_data_centric_shape ()
 
int main ()
 

Variables

static int g_failures = 0
 
static int g_checks = 0
 

Macro Definition Documentation

◆ CHECK_EQ

#define CHECK_EQ (   actual,
  expected,
  msg 
)
Value:
do { \
++g_checks; \
auto _a = (actual); \
auto _e = (expected); \
if (_a != _e) { \
fprintf(stderr, " FAIL %s:%d %s: got %lld expected %lld\n", \
__FILE__, __LINE__, msg, \
(long long)_a, (long long)_e); \
} \
} while (0)
static int g_failures
static int g_checks

Definition at line 39 of file shadow_memory_unittest.cpp.

◆ RUN_TEST

#define RUN_TEST (   fn)
Value:
do { \
int before = g_failures; \
fprintf(stderr, "[RUN ] %s\n", #fn); \
fn(); \
fprintf(stderr, "[%s] %s\n", \
(g_failures == before) ? "PASS" : "FAIL", #fn); \
} while (0)

Definition at line 52 of file shadow_memory_unittest.cpp.

Function Documentation

◆ main()

◆ test_concurrent_free_fn_matches_base_fn()

static void test_concurrent_free_fn_matches_base_fn ( )
static

Definition at line 193 of file shadow_memory_unittest.cpp.

References CHECK_EQ, PAGE_OFFSET, PinCCTLib::sm, and value.

Referenced by main().

◆ test_concurrent_init_pattern_data_centric_shape()

static void test_concurrent_init_pattern_data_centric_shape ( )
static

Definition at line 258 of file shadow_memory_unittest.cpp.

References CHECK_EQ, h(), and PinCCTLib::sm.

Referenced by main().

◆ test_concurrent_multi_thread()

static void test_concurrent_multi_thread ( )
static

Definition at line 216 of file shadow_memory_unittest.cpp.

References CHECK_EQ, and PinCCTLib::sm.

Referenced by main().

◆ test_concurrent_multi_type_tuple()

static void test_concurrent_multi_type_tuple ( )
static

Definition at line 204 of file shadow_memory_unittest.cpp.

References CHECK_EQ, and PinCCTLib::sm.

Referenced by main().

◆ test_concurrent_write_read_single()

static void test_concurrent_write_read_single ( )
static

Definition at line 183 of file shadow_memory_unittest.cpp.

References CHECK_EQ, PinCCTLib::sm, and value.

Referenced by main().

◆ test_shadow_base_fn_matches_free_fn()

static void test_shadow_base_fn_matches_free_fn ( )
static

Definition at line 141 of file shadow_memory_unittest.cpp.

References CHECK_EQ, PAGE_OFFSET, PinCCTLib::sm, and value.

Referenced by main().

◆ test_shadow_free_fn_matches_base_fn()

static void test_shadow_free_fn_matches_base_fn ( )
static

Definition at line 129 of file shadow_memory_unittest.cpp.

References CHECK_EQ, PAGE_OFFSET, PinCCTLib::sm, and value.

Referenced by main().

◆ test_shadow_init_pattern()

static void test_shadow_init_pattern ( )
static

Definition at line 166 of file shadow_memory_unittest.cpp.

References CHECK_EQ, and PinCCTLib::sm.

Referenced by main().

◆ test_shadow_multi_type_tuple()

static void test_shadow_multi_type_tuple ( )
static

Definition at line 117 of file shadow_memory_unittest.cpp.

References CHECK_EQ, and PinCCTLib::sm.

Referenced by main().

◆ test_shadow_multiple_addresses_same_page()

static void test_shadow_multiple_addresses_same_page ( )
static

Definition at line 81 of file shadow_memory_unittest.cpp.

References CHECK_EQ, and PinCCTLib::sm.

Referenced by main().

◆ test_shadow_multiple_pages()

static void test_shadow_multiple_pages ( )
static

Definition at line 95 of file shadow_memory_unittest.cpp.

References CHECK_EQ, and PinCCTLib::sm.

Referenced by main().

◆ test_shadow_pointer_stable()

static void test_shadow_pointer_stable ( )
static

Definition at line 155 of file shadow_memory_unittest.cpp.

References CHECK_EQ, and PinCCTLib::sm.

Referenced by main().

◆ test_shadow_write_read_single()

static void test_shadow_write_read_single ( )
static

Definition at line 69 of file shadow_memory_unittest.cpp.

References CHECK_EQ, PinCCTLib::sm, and value.

Referenced by main().

Variable Documentation

◆ g_checks

int g_checks = 0
static

Definition at line 37 of file shadow_memory_unittest.cpp.

Referenced by main().

◆ g_failures

int g_failures = 0
static

Definition at line 36 of file shadow_memory_unittest.cpp.

Referenced by main().