[compiler-rt] d265105 - Augment `uncaught-exception.test` fuzzer test to be msvc-compatible (#125924)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 18 17:13:29 PDT 2025
Author: David Justo
Date: 2025-06-18T17:13:25-07:00
New Revision: d265105b8f50718a684d792d3ca957231d668533
URL: https://github.com/llvm/llvm-project/commit/d265105b8f50718a684d792d3ca957231d668533
DIFF: https://github.com/llvm/llvm-project/commit/d265105b8f50718a684d792d3ca957231d668533.diff
LOG: 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!
Added:
Modified:
compiler-rt/test/fuzzer/uncaught-exception.test
Removed:
################################################################################
diff --git a/compiler-rt/test/fuzzer/uncaught-exception.test b/compiler-rt/test/fuzzer/uncaught-exception.test
index b055c88f6d903..d1b98cfb7c74b 100644
--- a/compiler-rt/test/fuzzer/uncaught-exception.test
+++ b/compiler-rt/test/fuzzer/uncaught-exception.test
@@ -4,7 +4,10 @@
REQUIRES: windows
RUN: %cpp_compiler %S/UncaughtException.cpp -o %t-UncaughtException
-RUN: not %run %t-UncaughtException 2>&1 | FileCheck %s
+# Clang will fail the test with 'deadly signal', but other compilers may fail with
diff erent error messages.
+# For example, msvc fails with 'uncaught C++ exception'. So the error we check depends on the compiler target.
+RUN: not %run %t-UncaughtException 2>&1 | FileCheck %s --check-prefixes=CHECK-CRASH,%if target={{.*-windows-msvc.*}} %{CHECK-MSVC%} %else %{CHECK-ERROR%}
-CHECK: ERROR: libFuzzer: deadly signal
-CHECK: Test unit written to ./crash
+CHECK-ERROR: ERROR: libFuzzer: deadly signal
+CHECK-MSVC: ERROR: libFuzzer: uncaught C++ exception
+CHECK-CRASH: Test unit written to ./crash
More information about the llvm-commits
mailing list