From e5a8616d266e1e53ab5d06e2a9dba8f2051d2cbf Mon Sep 17 00:00:00 2001 From: "Hoppe, Mateusz" Date: Tue, 13 Nov 2018 10:11:10 +0100 Subject: [PATCH] Test Lrca initialization - debug mode LRI must be present Change-Id: Idd9f9a85b9610177cb7ca378e37178ce333aa8b2 --- unit_tests/aub_mem_dump/CMakeLists.txt | 11 +++++++ unit_tests/aub_mem_dump/lrca_helper_tests.cpp | 31 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 unit_tests/aub_mem_dump/CMakeLists.txt create mode 100644 unit_tests/aub_mem_dump/lrca_helper_tests.cpp diff --git a/unit_tests/aub_mem_dump/CMakeLists.txt b/unit_tests/aub_mem_dump/CMakeLists.txt new file mode 100644 index 0000000000..8846aad6a7 --- /dev/null +++ b/unit_tests/aub_mem_dump/CMakeLists.txt @@ -0,0 +1,11 @@ +# +# Copyright (C) 2018 Intel Corporation +# +# SPDX-License-Identifier: MIT +# + +set(IGDRCL_SRCS_aub_mem_dump_tests + ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/lrca_helper_tests.cpp +) +target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_aub_mem_dump_tests}) diff --git a/unit_tests/aub_mem_dump/lrca_helper_tests.cpp b/unit_tests/aub_mem_dump/lrca_helper_tests.cpp new file mode 100644 index 0000000000..2fc6668420 --- /dev/null +++ b/unit_tests/aub_mem_dump/lrca_helper_tests.cpp @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2018 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "runtime/aub_mem_dump/aub_mem_dump.h" +#include "test.h" + +#include + +using namespace AubMemDump; + +TEST(LrcaHelper, WhenLrcaHelperIsInitializedThenLrcaIncludesDebugModeLri) { + LrcaHelper helper(0x2000); + + auto lrcaBufferSize = helper.sizeLRCA / sizeof(uint32_t); + auto lrca = std::unique_ptr(new uint32_t[lrcaBufferSize]); + helper.initialize(reinterpret_cast(lrca.get())); + + bool debugModeLriFound = false; + for (uint32_t i = 0; i < lrcaBufferSize; i += 2) { + if (lrca[i] == 0x20d8 && lrca[i + 1] == 0x00200020) { + debugModeLriFound = true; + break; + } + } + + EXPECT_TRUE(debugModeLriFound); +}