Skip to content

Commit fb5c86e

Browse files
committed
Add proper static storage for callback maps
1 parent 6905624 commit fb5c86e

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

source/mock/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@
33
# See LICENSE.TXT
44
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55

6-
add_library (ur_mock_headers INTERFACE)
6+
add_library (ur_mock_headers SHARED
7+
"${CMAKE_CURRENT_SOURCE_DIR}/ur_mock_helpers.cpp")
8+
79
target_include_directories(ur_mock_headers
810
INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}"
911
)
1012

13+
target_link_libraries(ur_mock_headers PRIVATE
14+
${PROJECT_NAME}::headers
15+
)
16+
1117
add_library(${PROJECT_NAME}::mock ALIAS ur_mock_headers)

source/mock/ur_mock_helpers.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
*
3+
* Copyright (C) 2024 Intel Corporation
4+
*
5+
* Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
6+
* See LICENSE.TXT
7+
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8+
*
9+
* @file ur_mock_helpers.cpp
10+
*
11+
*/
12+
13+
#include "ur_mock_helpers.hpp"
14+
15+
namespace mock {
16+
17+
std::unordered_map<std::string, ur_mock_callback_t> callbacks::beforeCallbacks;
18+
std::unordered_map<std::string, ur_mock_callback_t> callbacks::replaceCallbacks;
19+
std::unordered_map<std::string, ur_mock_callback_t> callbacks::afterCallbacks;
20+
21+
} // namespace mock

source/mock/ur_mock_helpers.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* See LICENSE.TXT
77
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
88
*
9-
* @file ur_nullddi.cpp
9+
* @file ur_mock_helpers.hpp
1010
*
1111
*/
1212

0 commit comments

Comments
 (0)