[llvm] [Test] Disable Linux perf test under WSL (PR #137822)

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 29 07:48:21 PDT 2025


https://github.com/Meinersbur created https://github.com/llvm/llvm-project/pull/137822

Linux perf_events is not implemented in WSL1, skip the test that requires it.

There is just a single test that requires perf_events. It fails under WSL1 with:
```sh
env JITDUMPDIR=/home/meinersbur/build/llvm-project/release/test/ExecutionEngine/JITLink/x86-64/Output/ELF_perf.s.tmp /home/meinersbur/build/llvm-project/release/bin/llvm-jitlink -perf-support /home/meinersbur/build/llvm-project/release/test/ExecutionEngine/JITLink/x86-64/Output/ELF_perf.s.tmp/ELF_x86-64_perf.o
llvm-jitlink error: PerfState not initialized
```

WSL environment detection logic follows https://github.com/scivision/detect-windows-subsystem-for-linux/blob/main/is_wsl.py

Also see WSL issue: https://github.com/microsoft/WSL/issues/4595

>From 53e594f6b1460b51c27567308210aa38a225a97f Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Tue, 29 Apr 2025 16:42:03 +0200
Subject: [PATCH] ELF_perf fails under wsl1

---
 llvm/test/ExecutionEngine/JITLink/x86-64/ELF_perf.s | 4 ++++
 llvm/test/lit.cfg.py                                | 7 +++++++
 2 files changed, 11 insertions(+)

diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/ELF_perf.s b/llvm/test/ExecutionEngine/JITLink/x86-64/ELF_perf.s
index bec3cead3cd4f..a498188b2d237 100644
--- a/llvm/test/ExecutionEngine/JITLink/x86-64/ELF_perf.s
+++ b/llvm/test/ExecutionEngine/JITLink/x86-64/ELF_perf.s
@@ -1,5 +1,9 @@
 # REQUIRES: native && x86_64-linux
 
+# Linux perf not supported by Windows Kernel's Linux syscall emulation layer
+# https://github.com/microsoft/WSL/issues/4595
+# UNSUPPORTED: wsl1
+
 # FIXME: Investigate why broken with MSAN
 # UNSUPPORTED: msan
 
diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py
index aad7a088551b2..242a41ad344f0 100644
--- a/llvm/test/lit.cfg.py
+++ b/llvm/test/lit.cfg.py
@@ -383,6 +383,13 @@ def version_int(ver):
     # Others/can-execute.txt
     config.available_features.add("can-execute")
 
+# Detect Windows Subsystem for Linux (WSL)
+uname_r = platform.uname().release
+if uname_r.endswith("-Microsoft"):
+    config.available_features.add("wsl1")
+elif uname_r.endswith("microsoft-standard-WSL2"):
+    config.available_features.add("wsl2")
+
 # Loadable module
 if config.has_plugins:
     config.available_features.add("plugins")



More information about the llvm-commits mailing list