Skip to content

Commit f20421e

Browse files
committed
Add tests for Loader Driver interaction conformance for Sysman VF Management API's
Related-To: NEO-15334 Signed-off-by: Vishnu Khanth <vishnu.khanth.b@intel.com>
1 parent 9402907 commit f20421e

9 files changed

Lines changed: 1785 additions & 8 deletions

File tree

scripts/templates/nullddi.cpp.mako

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ namespace driver
9292

9393
%endfor
9494
}
95+
%if not fname.endswith("DriverGet") and not re.match("Init", obj['name']):
96+
97+
char *env_str = strdup_safe((std::string("${fname}=") + std::to_string(ZEL_NULL_DRIVER_ID)).c_str());
98+
putenv_safe(env_str);
99+
context.env_vars.push_back(env_str);
100+
%endif
95101

96102
return result;
97103
}

source/drivers/null/ze_null.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,19 @@ namespace driver
629629
pSysman.isValidFlag = 1;
630630
pSysman.version = ZE_API_VERSION_CURRENT;
631631
}
632+
633+
context_t::~context_t()
634+
{
635+
for (auto handle : globalBaseNullHandle)
636+
{
637+
delete handle;
638+
}
639+
640+
for (const auto &env_var : env_vars)
641+
{
642+
delete env_var;
643+
}
644+
}
632645
} // namespace driver
633646

634647
namespace instrumented

source/drivers/null/ze_null.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,14 @@ namespace driver
4242
zet_dditable_t zetDdiTable = {};
4343
zes_dditable_t zesDdiTable = {};
4444
std::vector<BaseNullHandle*> globalBaseNullHandle;
45-
bool ddiExtensionRequested = false;
45+
bool ddiExtensionRequested = false;
46+
std::vector<char *> env_vars{};
4647
context_t();
47-
~context_t() {
48-
for (auto handle : globalBaseNullHandle) {
49-
delete handle;
50-
}
51-
}
48+
~context_t();
5249

5350
void* get( void )
5451
{
55-
static uint64_t count = 0x80800000;
52+
static uint64_t count = 0x80800000 >> ZEL_NULL_DRIVER_ID;
5653
if (ddiExtensionRequested) {
5754
globalBaseNullHandle.push_back(new BaseNullHandle());
5855
return reinterpret_cast<void*>(globalBaseNullHandle.back());

0 commit comments

Comments
 (0)