Skip to content

Commit 95b9880

Browse files
Add initialize() to DebugSession
Signed-off-by: Mateusz Hoppe <[email protected]>
1 parent ce93372 commit 95b9880

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

level_zero/tools/source/debug/debug_session.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ struct DebugSession : _zet_debug_session_handle_t {
2424
inline zet_debug_session_handle_t toHandle() { return this; }
2525

2626
virtual bool closeConnection() = 0;
27+
virtual ze_result_t initialize() = 0;
2728

2829
Device *getConnectedDevice() { return connectedDevice; }
2930

level_zero/tools/test/unit_tests/sources/debug/mock_debug_session.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ class OsInterfaceWithDebugAttach : public NEO::OSInterface {
2525
struct DebugSessionMock : public L0::DebugSession {
2626
DebugSessionMock(const zet_debug_config_t &config, L0::Device *device) : DebugSession(config, device){};
2727
bool closeConnection() override { return true; }
28+
ze_result_t initialize() override {
29+
return ZE_RESULT_SUCCESS;
30+
}
2831
};
2932

3033
} // namespace ult

opencl/test/unit_test/os_interface/linux/sys_calls_linux_ult.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ namespace NEO {
2424
namespace SysCalls {
2525
uint32_t closeFuncCalled = 0u;
2626
int closeFuncArgPassed = 0;
27+
int closeFuncRetVal = 0;
2728
int dlOpenFlags = 0;
2829
bool dlOpenCalled = 0;
2930
constexpr int fakeFileDescriptor = 123;
@@ -33,11 +34,13 @@ bool allowFakeDevicePath = false;
3334
uint32_t ioctlVmCreateCalled = 0u;
3435
int ioctlVmCreateReturned = 0u;
3536
uint64_t ioctlVmCreateExtensionArg = 0ull;
37+
constexpr unsigned long int invalidIoctl = static_cast<unsigned long int>(-1);
38+
int setErrno = 0;
3639

3740
int close(int fileDescriptor) {
3841
closeFuncCalled++;
3942
closeFuncArgPassed = fileDescriptor;
40-
return 0;
43+
return closeFuncRetVal;
4144
}
4245

4346
int open(const char *file, int flags) {
@@ -75,6 +78,14 @@ int ioctl(int fileDescriptor, unsigned long int request, void *arg) {
7578
vmId--;
7679
return (control->vm_id > 0) ? 0 : -1;
7780
}
81+
if (request == invalidIoctl) {
82+
errno = 0;
83+
if (setErrno != 0) {
84+
errno = setErrno;
85+
setErrno = 0;
86+
}
87+
return -1;
88+
}
7889
return 0;
7990
}
8091

0 commit comments

Comments
 (0)