Skip to content

Commit 340e133

Browse files
authored
[DeviceSanitizer] refine option parsing (#15293)
Add a test for option parsing. UR PR: oneapi-src/unified-runtime#2054
1 parent 8654f44 commit 340e133

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// REQUIRES: linux
2+
// RUN: %{build} %device_asan_flags -O0 -g -o %t
3+
// RUN: %{run} %t
4+
5+
// Invalid ur option format
6+
// RUN: env UR_LAYER_ASAN_OPTIONS=a:1,b:1 %{run} not %t 2>&1 | FileCheck %s --check-prefixes INVALID-FORMAT
7+
// INVALID-FORMAT: <SANITIZER>[ERROR]: Wrong format of the UR_LAYER_ASAN_OPTIONS environment variable value
8+
9+
// Invalid bool option
10+
// RUN: env UR_LAYER_ASAN_OPTIONS=debug:yes %{run} not %t 2>&1 | FileCheck %s --check-prefixes INVALID-BOOL
11+
// INVALID-BOOL: <SANITIZER>[ERROR]: "debug" is set to "yes", which is not an valid setting. Acceptable input are: for enable, use: "1" "true"; for disable, use: "0" "false".
12+
13+
// Invalid quarantine_size_mb
14+
// RUN: env UR_LAYER_ASAN_OPTIONS=quarantine_size_mb:-1 %{run} not %t 2>&1 | FileCheck %s --check-prefixes INVALID-QUARANTINE
15+
// RUN: env UR_LAYER_ASAN_OPTIONS=quarantine_size_mb:4294967296 %{run} not %t 2>&1 | FileCheck %s --check-prefixes INVALID-QUARANTINE
16+
// INVALID-QUARANTINE: <SANITIZER>[ERROR]: "quarantine_size_mb" should be an integer in range[0, 4294967295].
17+
18+
// Invalid redzone and max_redzone
19+
// RUN: env UR_LAYER_ASAN_OPTIONS=redzone:abc %{run} not %t 2>&1 | FileCheck %s --check-prefixes INVALID-REDZONE
20+
// INVALID-REDZONE: <SANITIZER>[ERROR]: "redzone" should be an integer in range[0, 16].
21+
// RUN: env UR_LAYER_ASAN_OPTIONS=max_redzone:abc %{run} not %t 2>&1 | FileCheck %s --check-prefixes INVALID-MAXREDZONE
22+
// INVALID-MAXREDZONE: <SANITIZER>[ERROR]: "max_redzone" should be an integer in range[0, 2048].
23+
24+
25+
26+
#include <sycl/usm.hpp>
27+
28+
int main() {
29+
sycl::queue q;
30+
constexpr std::size_t N = 8;
31+
auto *array = sycl::malloc_device<char>(N, q);
32+
33+
q.submit([&](sycl::handler &h) {
34+
h.single_task<class Test>([=]() { ++array[0]; });
35+
}).wait();
36+
37+
sycl::free(array, q);
38+
return 0;
39+
}

0 commit comments

Comments
 (0)