Skip to content

Commit 9832e6e

Browse files
author
Sergey Kanaev
committed
Fixes in the test along with some outputs for verbosity
Signed-off-by: Sergey Kanaev <sergey.kanaev@intel.com>
1 parent d81b4cb commit 9832e6e

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

sycl/unittests/windows/dllmain.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,18 @@
2323
#include <windows.h>
2424
#endif
2525

26+
27+
extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,
28+
DWORD fdwReason,
29+
LPVOID lpReserved);
30+
2631
static std::atomic<int> TearDownCalls{0};
2732

2833
pi_result redefinedTearDown(void *PluginParameter) {
34+
fprintf(stderr, "intercepted tear down\n");
2935
++TearDownCalls;
36+
37+
return PI_SUCCESS;
3038
}
3139

3240
TEST(Windows, DllMainCall) {
@@ -36,23 +44,23 @@ TEST(Windows, DllMainCall) {
3644
printf("Test is not supported on host, skipping\n");
3745
return;
3846
}
39-
4047
sycl::unittest::PiMock Mock{Plt};
4148
setupDefaultMockAPIs(Mock);
42-
43-
Mock.redefine<PiApiKind::piTearDown>(redefinedTearDown);
49+
Mock.redefine<sycl::detail::PiApiKind::piTearDown>(redefinedTearDown);
4450

4551
#ifdef _WIN32
4652
// Teardown calls are only expected on sycl.dll library unload, not when
4753
// process gets terminated.
4854
// The first call to DllMain is to simulate library unload. The second one
4955
// is to simulate process termination
56+
fprintf(stderr, "Call DllMain for the first time\n");
5057
DllMain((HINSTANCE)0, DLL_PROCESS_DETACH, (LPVOID)NULL);
5158

5259
int TearDownCallsDone = TearDownCalls.load();
5360

5461
EXPECT_NE(TearDownCallsDone, 0);
5562

63+
fprintf(stderr, "Call DllMain for the second time\n");
5664
DllMain((HINSTANCE)0, DLL_PROCESS_DETACH, (LPVOID)0x01);
5765

5866
EXPECT_EQ(TearDownCalls.load(), TearDownCallsDone);

0 commit comments

Comments
 (0)