Skip to content

Commit 2de7aa4

Browse files
committed
Change test exit conditions for better diagnosis.
Signed-off-by: James Brodman <[email protected]>
1 parent 278306b commit 2de7aa4

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

sycl/test/usm/badmalloc.cpp

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,41 @@ int main(int argc, char *argv[]) {
2323

2424
// Good size, bad type
2525
auto p = malloc(8, q, usm::alloc::unknown);
26-
assert(p == nullptr);
26+
if (p != nullptr)
27+
return 1;
2728

2829
// Bad size, host
2930
p = malloc(-1, q, usm::alloc::host);
30-
assert(p == nullptr);
31+
if (p != nullptr)
32+
return 2;
3133
p = malloc(-1, q, usm::alloc::device);
32-
assert(p == nullptr);
34+
if (p != nullptr)
35+
return 3;
3336
p = malloc(-1, q, usm::alloc::shared);
34-
assert(p == nullptr);
37+
if (p != nullptr)
38+
return 4;
3539
p = malloc(-1, q, usm::alloc::unknown);
36-
assert(p == nullptr);
40+
if (p != nullptr)
41+
return 5;
3742

3843
// Bad size, auto aligned
3944
p = aligned_alloc(0, -1, q, usm::alloc::host);
40-
assert(p == nullptr);
45+
if (p != nullptr)
46+
return 6;
4147
p = aligned_alloc(0, -1, q, usm::alloc::device);
42-
assert(p == nullptr);
48+
if (p != nullptr)
49+
return 7;
4350
p = aligned_alloc(0, -1, q, usm::alloc::shared);
44-
assert(p == nullptr);
51+
if (p != nullptr)
52+
return 8;
4553
p = aligned_alloc(0, -1, q, usm::alloc::unknown);
46-
assert(p == nullptr);
54+
if (p != nullptr)
55+
return 9;
4756

4857
// Allocs of 0 undefined, but bad type
4958
p = aligned_alloc(4, 0, q, usm::alloc::unknown);
50-
assert(p == nullptr);
59+
if (p != nullptr)
60+
return 10;
5161

5262
return 0;
5363
}

0 commit comments

Comments
 (0)