Skip to content

Commit deab9a3

Browse files
Move os context tests to os interface tests
Change-Id: I409d988c6c561bca6fc6dcb0ff16583131f0cf5a Signed-off-by: Mateusz Jablonski <[email protected]>
1 parent a807b9a commit deab9a3

File tree

6 files changed

+28
-80
lines changed

6 files changed

+28
-80
lines changed

unit_tests/os_interface/linux/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ set(IGDRCL_SRCS_tests_os_interface_linux
4040
${CMAKE_CURRENT_SOURCE_DIR}/mock_os_time_linux.h
4141
${CMAKE_CURRENT_SOURCE_DIR}/mock_performance_counters_linux.cpp
4242
${CMAKE_CURRENT_SOURCE_DIR}/mock_performance_counters_linux.h
43-
${CMAKE_CURRENT_SOURCE_DIR}/os_context_linux_tests.cpp
4443
${CMAKE_CURRENT_SOURCE_DIR}/os_interface_linux_tests.cpp
4544
${CMAKE_CURRENT_SOURCE_DIR}/os_time_test.cpp
4645
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_linux_tests.cpp

unit_tests/os_interface/linux/os_context_linux_tests.cpp

Lines changed: 0 additions & 34 deletions
This file was deleted.

unit_tests/os_interface/linux/os_interface_linux_tests.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* OTHER DEALINGS IN THE SOFTWARE.
2121
*/
2222

23+
#include "runtime/os_interface/os_context.h"
2324
#include "runtime/os_interface/os_interface.h"
2425
#include "gtest/gtest.h"
2526

@@ -33,4 +34,10 @@ TEST(OsInterfaceTest, GivenLinuxOsInterfaceWhenDeviceHandleQueriedthenZeroIsRetu
3334
OSInterface osInterface;
3435
EXPECT_EQ(0u, osInterface.getDeviceHandle());
3536
}
37+
38+
TEST(OsContextTest, WhenOsContextIsCreatedThenImplIsAvailable) {
39+
OSInterface osInterface;
40+
auto osContext = std::make_unique<OsContext>(osInterface);
41+
EXPECT_NE(nullptr, osContext->get());
42+
}
3643
} // namespace OCLRT

unit_tests/os_interface/windows/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ set(IGDRCL_SRCS_tests_os_interface_windows
3535
${CMAKE_CURRENT_SOURCE_DIR}/mock_performance_counters_win.cpp
3636
${CMAKE_CURRENT_SOURCE_DIR}/mock_performance_counters_win.h
3737
${CMAKE_CURRENT_SOURCE_DIR}/mock_wddm_memory_manager.h
38-
${CMAKE_CURRENT_SOURCE_DIR}/os_context_win_tests.cpp
3938
${CMAKE_CURRENT_SOURCE_DIR}/os_interface_win_tests.cpp
4039
${CMAKE_CURRENT_SOURCE_DIR}/os_interface_win_tests.h
4140
${CMAKE_CURRENT_SOURCE_DIR}/os_library_win_tests.cpp

unit_tests/os_interface/windows/os_context_win_tests.cpp

Lines changed: 0 additions & 44 deletions
This file was deleted.

unit_tests/os_interface/windows/os_interface_win_tests.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
* OTHER DEALINGS IN THE SOFTWARE.
2121
*/
2222

23+
#include "runtime/os_interface/windows/os_context_win.h"
2324
#include "unit_tests/os_interface/windows/os_interface_win_tests.h"
25+
#include "unit_tests/os_interface/windows/wddm_fixture.h"
2426

2527
TEST_F(OsInterfaceTest, givenOsInterfaceWithoutWddmWhenGetHwContextIdIsCalledThenReturnsZero) {
2628
auto retVal = osInterface->getHwContextId();
@@ -37,3 +39,22 @@ TEST_F(OsInterfaceTest, GivenWindowsWhenCreateEentIsCalledThenValidEventHandleIs
3739
auto ret = osInterface->get()->closeHandle(ev);
3840
EXPECT_EQ(TRUE, ret);
3941
}
42+
43+
TEST(OsContextTest, givenWddmWhenCreateOsContextBeforeInitWddmThenOsContextIsNotInitialized) {
44+
auto wddm = new WddmMock;
45+
OSInterface osInterface;
46+
osInterface.get()->setWddm(wddm);
47+
auto osContext = std::make_unique<OsContext>(osInterface);
48+
EXPECT_NE(nullptr, osContext->get());
49+
EXPECT_FALSE(osContext->get()->isInitialized());
50+
}
51+
52+
TEST(OsContextTest, givenWddmWhenCreateOsContextAfterInitWddmThenOsContextIsInitialized) {
53+
auto wddm = new WddmMock;
54+
OSInterface osInterface;
55+
osInterface.get()->setWddm(wddm);
56+
wddm->init();
57+
auto osContext = std::make_unique<OsContext>(osInterface);
58+
EXPECT_NE(nullptr, osContext->get());
59+
EXPECT_TRUE(osContext->get()->isInitialized());
60+
}

0 commit comments

Comments
 (0)