Skip to content

Commit 1c5e22b

Browse files
committed
[UR] Adjust validation layer leak tests
Match files in leak checking tests also account for the ..Create(), ..Get() and ..Release() functions used in test setups.
1 parent 9d24b81 commit 1c5e22b

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

test/layers/validation/fixtures.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ struct valAllDevicesTest : valPlatformTest {
9191
FAIL() << "Failed to get devices";
9292
}
9393
}
94+
95+
void TearDown() override {
96+
for (auto device : devices) {
97+
ASSERT_EQ(urDeviceRelease(device), UR_RESULT_SUCCESS);
98+
}
99+
valPlatformTest::TearDown();
100+
}
101+
94102
std::vector<ur_device_handle_t> devices;
95103
};
96104

test/layers/validation/leaks.out.match

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,52 +16,66 @@
1616
[ RUN ] valDeviceTest.testUrContextCreateLeak
1717
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
1818
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
19+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
20+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
1921
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
2022
<VALIDATION>[ERROR]: Retained 1 reference(s) to handle {{[0-9xa-fA-F]+}}
2123
<VALIDATION>[ERROR]: Handle {{[0-9xa-fA-F]+}} was recorded for first time here:
2224
{{IGNORE}}
2325
[ RUN ] valDeviceTest.testUrContextRetainLeak
2426
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
2527
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
28+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
2629
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 2
2730
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
31+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
2832
<VALIDATION>[ERROR]: Retained 2 reference(s) to handle {{[0-9xa-fA-F]+}}
2933
<VALIDATION>[ERROR]: Handle {{[0-9xa-fA-F]+}} was recorded for first time here:
3034
{{IGNORE}}
3135
[ RUN ] valDeviceTest.testUrContextRetainNonexistent
3236
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
37+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
3338
<VALIDATION>[ERROR]: Attempting to retain nonexistent handle {{[0-9xa-fA-F]+}}
3439
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
40+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
3541
{{IGNORE}}
3642
[ RUN ] valDeviceTest.testUrContextCreateSuccess
3743
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
3844
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
45+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
46+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
3947
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
4048
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
4149
{{IGNORE}}
4250
[ RUN ] valDeviceTest.testUrContextRetainSuccess
4351
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
4452
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
53+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
4554
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 2
4655
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
4756
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
4857
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
58+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
4959
{{IGNORE}}
5060
[ RUN ] valDeviceTest.testUrContextReleaseLeak
5161
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
5262
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
63+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
5364
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
5465
<VALIDATION>[ERROR]: Attempting to release nonexistent handle {{[0-9xa-fA-F]+}}
5566
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to -1
5667
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
68+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
5769
<VALIDATION>[ERROR]: Retained -1 reference(s) to handle {{[0-9xa-fA-F]+}}
5870
<VALIDATION>[ERROR]: Handle {{[0-9xa-fA-F]+}} was recorded for first time here:
5971
{{IGNORE}}
6072
[ RUN ] valDeviceTest.testUrContextReleaseNonexistent
6173
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
74+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
6275
<VALIDATION>[ERROR]: Attempting to release nonexistent handle {{[0-9xa-fA-F]+}}
6376
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to -1
6477
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
78+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
6579
<VALIDATION>[ERROR]: Retained -1 reference(s) to handle {{[0-9xa-fA-F]+}}
6680
<VALIDATION>[ERROR]: Handle {{[0-9xa-fA-F]+}} was recorded for first time here:
6781
{{IGNORE}}

test/layers/validation/leaks_mt.out.match

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22
[ RUN ] threadCountForValDeviceTest/valDeviceTestMultithreaded.testUrContextRetainLeakMt/0
33
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
44
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
5+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
56
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 2
67
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 3
78
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
9+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
810
<VALIDATION>[ERROR]: Retained 3 reference(s) to handle {{[0-9xa-fA-F]+}}
911
<VALIDATION>[ERROR]: Handle {{[0-9xa-fA-F]+}} was recorded for first time here:
1012
{{IGNORE}}
1113
[ RUN ] threadCountForValDeviceTest/valDeviceTestMultithreaded.testUrContextRetainLeakMt/1
1214
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
1315
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
16+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
1417
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 2
1518
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 3
1619
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 4
@@ -20,22 +23,26 @@
2023
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 8
2124
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 9
2225
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
26+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
2327
<VALIDATION>[ERROR]: Retained 9 reference(s) to handle {{[0-9xa-fA-F]+}}
2428
<VALIDATION>[ERROR]: Handle {{[0-9xa-fA-F]+}} was recorded for first time here:
2529
{{IGNORE}}
2630
[ RUN ] threadCountForValDeviceTest/valDeviceTestMultithreaded.testUrContextReleaseLeakMt/0
2731
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
2832
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
33+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
2934
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
3035
<VALIDATION>[ERROR]: Attempting to release nonexistent handle {{[0-9xa-fA-F]+}}
3136
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to -1
3237
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
38+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
3339
<VALIDATION>[ERROR]: Retained -1 reference(s) to handle {{[0-9xa-fA-F]+}}
3440
<VALIDATION>[ERROR]: Handle {{[0-9xa-fA-F]+}} was recorded for first time here:
3541
{{IGNORE}}
3642
[ RUN ] threadCountForValDeviceTest/valDeviceTestMultithreaded.testUrContextReleaseLeakMt/1
3743
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
3844
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
45+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
3946
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
4047
<VALIDATION>[ERROR]: Attempting to release nonexistent handle {{[0-9xa-fA-F]+}}
4148
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to -1
@@ -52,23 +59,27 @@
5259
<VALIDATION>[ERROR]: Attempting to release nonexistent handle {{[0-9xa-fA-F]+}}
5360
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to -7
5461
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
62+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
5563
<VALIDATION>[ERROR]: Retained -7 reference(s) to handle {{[0-9xa-fA-F]+}}
5664
<VALIDATION>[ERROR]: Handle {{[0-9xa-fA-F]+}} was recorded for first time here:
5765
{{IGNORE}}
5866
[ RUN ] threadCountForValDeviceTest/valDeviceTestMultithreaded.testUrContextRetainReleaseLeakMt/0
5967
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
6068
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
69+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
6170
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to {{[1-9]+}}
6271
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to {{[1-9]+}}
6372
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to {{[1-9]+}}
6473
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
6574
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
75+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
6676
<VALIDATION>[ERROR]: Retained 1 reference(s) to handle {{[0-9xa-fA-F]+}}
6777
<VALIDATION>[ERROR]: Handle {{[0-9xa-fA-F]+}} was recorded for first time here:
6878
{{IGNORE}}
6979
[ RUN ] threadCountForValDeviceTest/valDeviceTestMultithreaded.testUrContextRetainReleaseLeakMt/1
7080
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
7181
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
82+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
7283
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to {{[1-9]+}}
7384
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to {{[1-9]+}}
7485
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to {{[1-9]+}}
@@ -86,6 +97,7 @@
8697
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to {{[1-9]+}}
8798
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1
8899
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
100+
<VALIDATION>[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0
89101
<VALIDATION>[ERROR]: Retained 1 reference(s) to handle {{[0-9xa-fA-F]+}}
90102
<VALIDATION>[ERROR]: Handle {{[0-9xa-fA-F]+}} was recorded for first time here:
91103
{{IGNORE}}

0 commit comments

Comments
 (0)