Skip to content

Commit 8baa923

Browse files
[SYCL][E2E] Hack AddressSanitizer/.../device_global.cpp to pass CI (#16865)
Closes #16850.
1 parent b0e975c commit 8baa923

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

sycl/test-e2e/AddressSanitizer/out-of-bounds/DeviceGlobal/device_global.cpp

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
11
// REQUIRES: linux, cpu || (gpu && level_zero)
2+
3+
// The following is an ugly hack to make CI pass. The issue here is that when
4+
// sycl-toolchain is built with assertions enabled, then we hit one at
5+
// `DeviceGlobalUSMMem::~DeviceGlobalUSMMem()` and exit with abort. If not, then
6+
// sanitizer does `exit(1)`.
7+
//
8+
// That doesn't matter as long as LIT does *not* use "external shell", but when
9+
// it does, the difference between `not` and `not --crash` becomes crucial and
10+
// we cannot have a single command that would match both behaviors. Ideally,
11+
// we'd need to make a choice based on how the toolchain was built.
12+
// Unfortunately, we don't have that information at the LIT level and
13+
// propagating it all the way down to it would be ugly. Instead, rely on the
14+
// fact that "no-assertion" mode doesn't use "run-only" lit invocations and make
15+
// a choice based on that. This is rather fragile but workarounds the issue for
16+
// the time being.
17+
18+
// DEFINE: %{not} = not %if test-mode-run-only %{ --crash %}
19+
220
// RUN: %{build} %device_asan_flags -O0 -g -o %t1.out
3-
// RUN: %{run} not --crash %t1.out 2>&1 | FileCheck %s
21+
// RUN: %{run} %{not} %t1.out 2>&1 | FileCheck %s
422
// RUN: %{build} %device_asan_flags -O1 -g -o %t2.out
5-
// RUN: %{run} not --crash %t2.out 2>&1 | FileCheck %s
23+
// RUN: %{run} %{not} %t2.out 2>&1 | FileCheck %s
624
// RUN: %{build} %device_asan_flags -O2 -g -o %t3.out
7-
// RUN: %{run} not --crash %t3.out 2>&1 | FileCheck %s
25+
// RUN: %{run} %{not} %t3.out 2>&1 | FileCheck %s
826

927
// Flakily timesout on PVC
1028
// UNSUPPORTED: arch-intel_gpu_pvc

sycl/test-e2e/lit.cfg.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@
6262
config.available_features.add("build-and-run-mode")
6363
elif config.test_mode == "run-only":
6464
lit_config.note("run-only test mode enabled, only executing tests")
65+
# run-only uses external shell, some tests might have hacks to workaround
66+
# failures caused by that.
67+
config.available_features.add("test-mode-run-only")
68+
6569
config.available_features.add("run-mode")
6670
if lit_config.params.get("fallback-to-build-if-requires-build-and-run", False):
6771
config.available_features.add("build-and-run-mode")

0 commit comments

Comments
 (0)