Skip to content

Commit ab306e0

Browse files
refactor : Sysman init CTS (#64)
* refactor sysman init tests into separate executable for isolated testing. Related-To: VLCLJ-2253 Signed-off-by: Vishnu Khanth <[email protected]>
1 parent e27fdce commit ab306e0

File tree

5 files changed

+79
-37
lines changed

5 files changed

+79
-37
lines changed
Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
11
#
2-
#Copyright(C) 2023 Intel Corporation
2+
#Copyright(C) 2023-2024 Intel Corporation
33
#
44
#SPDX - License - Identifier : MIT
55
#
66

77
add_lzt_test(
8-
NAME test_sysman_init
8+
NAME test_init_sysman
99
GROUP "/conformance_tests/tools/sysman"
1010
SOURCES
11-
src/test_init.cpp
11+
src/test_init_sysman.cpp
1212
src/main.cpp
1313
LINK_LIBRARIES level_zero_tests::logging level_zero_tests::utils)
1414

15+
add_lzt_test(
16+
NAME test_init_sysman_after_core
17+
GROUP "/conformance_tests/tools/sysman"
18+
SOURCES
19+
src/test_init_sysman_after_core.cpp
20+
src/main.cpp
21+
LINK_LIBRARIES level_zero_tests::logging level_zero_tests::utils)
22+
23+
add_lzt_test(
24+
NAME test_init_sysman_before_core
25+
GROUP "/conformance_tests/tools/sysman"
26+
SOURCES
27+
src/test_init_sysman_before_core.cpp
28+
src/main.cpp
29+
LINK_LIBRARIES level_zero_tests::logging level_zero_tests::utils)
30+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
*
3+
* Copyright (C) 2024 Intel Corporation
4+
*
5+
* SPDX-License-Identifier: MIT
6+
*
7+
*/
8+
9+
#include "gtest/gtest.h"
10+
11+
#include "logging/logging.hpp"
12+
#include "utils/utils.hpp"
13+
#include "test_harness/test_harness.hpp"
14+
15+
#include <level_zero/zes_api.h>
16+
17+
namespace {
18+
19+
TEST(SysmanInitTests,
20+
GivenCoreNotInitializedWhenSysmanInitializedThenzesDriverGetWorks) {
21+
ASSERT_EQ(ZE_RESULT_SUCCESS, zesInit(0));
22+
uint32_t pCount = 0;
23+
ASSERT_EQ(ZE_RESULT_SUCCESS, zesDriverGet(&pCount, nullptr));
24+
ASSERT_GT(pCount, 0);
25+
}
26+
27+
} // namespace
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (C) 2023 Intel Corporation
3+
* Copyright (C) 2024 Intel Corporation
44
*
55
* SPDX-License-Identifier: MIT
66
*
@@ -12,8 +12,6 @@
1212
#include "utils/utils.hpp"
1313
#include "test_harness/test_harness.hpp"
1414

15-
namespace lzt = level_zero_tests;
16-
1715
#include <level_zero/zes_api.h>
1816

1917
namespace {
@@ -41,33 +39,4 @@ TEST(
4139
}
4240
}
4341

44-
TEST(SysmanInitTests, GivenSysmanInitializedThenCallingCoreInitSucceeds) {
45-
ASSERT_EQ(ZE_RESULT_SUCCESS, zesInit(0));
46-
uint32_t zesInitCount = 0;
47-
ASSERT_EQ(ZE_RESULT_SUCCESS, zesDriverGet(&zesInitCount, nullptr));
48-
ASSERT_GT(zesInitCount, 0);
49-
ASSERT_EQ(ZE_RESULT_SUCCESS, zeInit(0));
50-
uint32_t zeInitCount = 0;
51-
ASSERT_EQ(ZE_RESULT_SUCCESS, zeDriverGet(&zeInitCount, nullptr));
52-
ASSERT_GT(zeInitCount, 0);
53-
}
54-
55-
TEST(SysmanInitTests,
56-
GivenCoreNotInitializedWhenSysmanInitializedThenzesDriverGetWorks) {
57-
ASSERT_EQ(ZE_RESULT_SUCCESS, zesInit(0));
58-
uint32_t pCount = 0;
59-
ASSERT_EQ(ZE_RESULT_SUCCESS, zesDriverGet(&pCount, nullptr));
60-
ASSERT_GT(pCount, 0);
61-
}
62-
63-
TEST(SysmanInitTests,
64-
GivenEnableSysmanEnvSetWhenCoreInitializedThenzesDriverGetWorks) {
65-
static char sys_env[] = "ZES_ENABLE_SYSMAN=1";
66-
putenv(sys_env);
67-
ASSERT_EQ(ZE_RESULT_SUCCESS, zeInit(0));
68-
uint32_t pCount = 0;
69-
ASSERT_EQ(ZE_RESULT_SUCCESS, zesDriverGet(&pCount, nullptr));
70-
ASSERT_GT(pCount, 0);
71-
}
72-
7342
} // namespace
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
*
3+
* Copyright (C) 2024 Intel Corporation
4+
*
5+
* SPDX-License-Identifier: MIT
6+
*
7+
*/
8+
9+
#include "gtest/gtest.h"
10+
11+
#include "logging/logging.hpp"
12+
#include "utils/utils.hpp"
13+
#include "test_harness/test_harness.hpp"
14+
15+
#include <level_zero/zes_api.h>
16+
17+
namespace {
18+
19+
TEST(SysmanInitTests, GivenSysmanInitializedThenCallingCoreInitSucceeds) {
20+
ASSERT_EQ(ZE_RESULT_SUCCESS, zesInit(0));
21+
uint32_t zesInitCount = 0;
22+
ASSERT_EQ(ZE_RESULT_SUCCESS, zesDriverGet(&zesInitCount, nullptr));
23+
ASSERT_GT(zesInitCount, 0);
24+
ASSERT_EQ(ZE_RESULT_SUCCESS, zeInit(0));
25+
uint32_t zeInitCount = 0;
26+
ASSERT_EQ(ZE_RESULT_SUCCESS, zeDriverGet(&zeInitCount, nullptr));
27+
ASSERT_GT(zeInitCount, 0);
28+
}
29+
30+
} // namespace

scripts/level_zero_report_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ def assign_tool_test_feature(test_binary: str, test_name: str):
210210
test_feature = "SysMan Frequency"
211211
elif test_binary == "test_sysman_frequency_zesinit":
212212
test_feature = "SysMan Frequency"
213-
elif test_binary == "test_sysman_init":
214-
test_feature = "SysMan Device Properties"
213+
elif (re.search('test_init_sysman', test_binary, re.IGNORECASE)):
214+
test_feature = "SysMan Init"
215215
elif test_binary == "test_sysman_pci":
216216
test_feature = "SysMan PCIe"
217217
elif test_binary == "test_sysman_pci_zesinit":

0 commit comments

Comments
 (0)