Skip to content

Commit e121961

Browse files
Add tests for Loader Driver interaction conformance for Sysman VF Management API's (#360)
* Add tests for Loader Driver interaction conformance for Sysman VF Management API's Related-To: NEO-15334 Signed-off-by: Vishnu Khanth <[email protected]>
1 parent 9402907 commit e121961

File tree

9 files changed

+1379
-8
lines changed

9 files changed

+1379
-8
lines changed

scripts/templates/nullddi.cpp.mako

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

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

96101
return result;
97102
}

source/drivers/null/ze_null.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,27 @@ namespace driver
629629
pSysman.isValidFlag = 1;
630630
pSysman.version = ZE_API_VERSION_CURRENT;
631631
}
632+
633+
char *context_t::setenv_var_with_driver_id(const std::string &key, uint32_t driverId)
634+
{
635+
std::string env = key + "=" + std::to_string(driverId);
636+
char *env_str = strdup_safe(env.c_str());
637+
putenv_safe(env_str);
638+
return env_str;
639+
}
640+
641+
context_t::~context_t()
642+
{
643+
for (auto handle : globalBaseNullHandle)
644+
{
645+
delete handle;
646+
}
647+
648+
for (const auto &env_var : env_vars)
649+
{
650+
free(env_var);
651+
}
652+
}
632653
} // namespace driver
633654

634655
namespace instrumented

source/drivers/null/ze_null.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,23 @@ 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());
5956
} else {
6057
return reinterpret_cast<void*>( ++count );
6158
}
6259
}
60+
61+
char *setenv_var_with_driver_id(const std::string &key, uint32_t driverId);
6362
};
6463

6564
extern context_t context;

0 commit comments

Comments
 (0)