Skip to content

Commit d265105

Browse files
authored
Augment uncaught-exception.test fuzzer test to be msvc-compatible (#125924)
Today, the `uncaught-exception.test` fuzzer test checks for the string "libFuzzer: deadly signal" in the program output as the result of an uncaught exception. Although this is correct for `clang`, `msvc` reports a different error message: "libFuzzer: uncaught C++ exception". Since `msvc` reuses the `libFuzzer` infrastructure for ASan regression testing, it would help us greatly if the test handled the `msvc` divergence more gracefully. **This PR:** augments this test so check for a different string (namely "libFuzzer: uncaught C++ exception") if the compiler target matches the `msvc` naming scheme. I understand if this is outside the scope of support for LLVM as well, and I'm also open for different approaches here. Thanks!
1 parent 5f69d68 commit d265105

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

compiler-rt/test/fuzzer/uncaught-exception.test

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
REQUIRES: windows
55
RUN: %cpp_compiler %S/UncaughtException.cpp -o %t-UncaughtException
66

7-
RUN: not %run %t-UncaughtException 2>&1 | FileCheck %s
7+
# Clang will fail the test with 'deadly signal', but other compilers may fail with different error messages.
8+
# For example, msvc fails with 'uncaught C++ exception'. So the error we check depends on the compiler target.
9+
RUN: not %run %t-UncaughtException 2>&1 | FileCheck %s --check-prefixes=CHECK-CRASH,%if target={{.*-windows-msvc.*}} %{CHECK-MSVC%} %else %{CHECK-ERROR%}
810

9-
CHECK: ERROR: libFuzzer: deadly signal
10-
CHECK: Test unit written to ./crash
11+
CHECK-ERROR: ERROR: libFuzzer: deadly signal
12+
CHECK-MSVC: ERROR: libFuzzer: uncaught C++ exception
13+
CHECK-CRASH: Test unit written to ./crash

0 commit comments

Comments
 (0)