[libunwind] libunwind: Remove OS requirements from tests to make them run on more OSes (PR #167642)
Gleb Popov via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 21 23:49:59 PST 2025
https://github.com/arrowd updated https://github.com/llvm/llvm-project/pull/167642
>From 369be95a2ab89fd2ed8679fd68f26218a624d2a0 Mon Sep 17 00:00:00 2001
From: Gleb Popov <6yearold at gmail.com>
Date: Tue, 30 Sep 2025 13:59:25 +0300
Subject: [PATCH 1/2] libunwind: Remove OS requirements from tests to make them
run on more OSes
While at it, replace "echo -ne" with "printf" for more compatibility.
---
libunwind/test/aarch64_vg_unwind.pass.cpp | 3 ++-
libunwind/test/aarch64_za_unwind.pass.cpp | 3 ++-
libunwind/test/bad_unwind_info.pass.cpp | 4 +++-
libunwind/test/eh_frame_fde_pc_range.pass.cpp | 4 ++--
libunwind/test/floatregister.pass.cpp | 3 ++-
libunwind/test/forceunwind.pass.cpp | 5 ++++-
libunwind/test/remember_state_leak.pass.sh.s | 3 ++-
libunwind/test/signal_unwind.pass.cpp | 4 +++-
libunwind/test/unwind_leaffunction.pass.cpp | 4 +++-
libunwind/test/unwind_scalable_vectors.pass.cpp | 2 +-
10 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/libunwind/test/aarch64_vg_unwind.pass.cpp b/libunwind/test/aarch64_vg_unwind.pass.cpp
index 1c139a7ae9e41..5abc9fd4ef0dc 100644
--- a/libunwind/test/aarch64_vg_unwind.pass.cpp
+++ b/libunwind/test/aarch64_vg_unwind.pass.cpp
@@ -6,7 +6,8 @@
//
//===----------------------------------------------------------------------===//
-// REQUIRES: linux && target={{aarch64-.+}}
+// REQUIRES: target-aarch64
+// UNSUPPORTED: system-windows
#include <libunwind.h>
#include <stdlib.h>
diff --git a/libunwind/test/aarch64_za_unwind.pass.cpp b/libunwind/test/aarch64_za_unwind.pass.cpp
index 2985bb8d298de..1329e750d80e8 100644
--- a/libunwind/test/aarch64_za_unwind.pass.cpp
+++ b/libunwind/test/aarch64_za_unwind.pass.cpp
@@ -6,7 +6,8 @@
//
//===----------------------------------------------------------------------===//
-// REQUIRES: linux && target={{aarch64-.+}}
+// REQUIRES: target-aarch64
+// UNSUPPORTED: system-windows
#include <libunwind.h>
#include <stdint.h>
diff --git a/libunwind/test/bad_unwind_info.pass.cpp b/libunwind/test/bad_unwind_info.pass.cpp
index 272a83f64a611..6a4fd7640ade9 100644
--- a/libunwind/test/bad_unwind_info.pass.cpp
+++ b/libunwind/test/bad_unwind_info.pass.cpp
@@ -10,7 +10,9 @@
// Ensure that libunwind doesn't crash on invalid info; the Linux aarch64
// sigreturn frame check would previously attempt to access invalid memory in
// this scenario.
-// REQUIRES: target={{(aarch64|s390x|x86_64)-.+linux.*}}
+// REQUIRES: target={{(aarch64|s390x|x86_64)-.+}}
+// UNSUPPORTED: system-windows
+// UNSUPPORTED: target={{.*-windows-gnu}}
// GCC doesn't support __attribute__((naked)) on AArch64.
// UNSUPPORTED: gcc
diff --git a/libunwind/test/eh_frame_fde_pc_range.pass.cpp b/libunwind/test/eh_frame_fde_pc_range.pass.cpp
index 795ce66806f28..41bed928872c2 100644
--- a/libunwind/test/eh_frame_fde_pc_range.pass.cpp
+++ b/libunwind/test/eh_frame_fde_pc_range.pass.cpp
@@ -13,7 +13,7 @@
// clang-format off
-// REQUIRES: target={{x86_64-.+-linux-gnu}}
+// REQUIRES: target-x86_64
// REQUIRES: objcopy-available
// TODO: Figure out why this fails with Memory Sanitizer.
@@ -21,7 +21,7 @@
// RUN: %{build}
// RUN: %{objcopy} --dump-section .eh_frame_hdr=%t_ehf_hdr.bin %t.exe
-// RUN: echo -ne '\xFF' | dd of=%t_ehf_hdr.bin bs=1 seek=2 count=2 conv=notrunc status=none
+// RUN: printf '\377' | dd of=%t_ehf_hdr.bin bs=1 seek=2 count=2 conv=notrunc status=none
// RUN: %{objcopy} --update-section .eh_frame_hdr=%t_ehf_hdr.bin %t.exe
// RUN: %{exec} %t.exe
diff --git a/libunwind/test/floatregister.pass.cpp b/libunwind/test/floatregister.pass.cpp
index 018b792bd5f1e..c119d1859808f 100644
--- a/libunwind/test/floatregister.pass.cpp
+++ b/libunwind/test/floatregister.pass.cpp
@@ -7,7 +7,8 @@
//
//===----------------------------------------------------------------------===//
-// REQUIRES: linux && target={{aarch64-.+}}
+// REQUIRES: target-aarch64
+// UNSUPPORTED: system-windows
// Basic test for float registers number are accepted.
diff --git a/libunwind/test/forceunwind.pass.cpp b/libunwind/test/forceunwind.pass.cpp
index 9e032fc680806..a15b02b3e2e48 100644
--- a/libunwind/test/forceunwind.pass.cpp
+++ b/libunwind/test/forceunwind.pass.cpp
@@ -7,7 +7,10 @@
//
//===----------------------------------------------------------------------===//
-// REQUIRES: linux
+// UNSUPPORTED: system-windows
+// UNSUPPORTED: target={{.*}}-darwin{{.*}}
+// UNSUPPORTED: target={{.*}}-aix{{.*}}
+// UNSUPPORTED: target={{.*-windows-gnu}}
// TODO: Figure out why this fails with Memory Sanitizer.
// XFAIL: msan
diff --git a/libunwind/test/remember_state_leak.pass.sh.s b/libunwind/test/remember_state_leak.pass.sh.s
index d3335cf82290b..af928f70076ab 100644
--- a/libunwind/test/remember_state_leak.pass.sh.s
+++ b/libunwind/test/remember_state_leak.pass.sh.s
@@ -6,7 +6,8 @@
#
#===------------------------------------------------------------------------===#
-# REQUIRES: target={{x86_64-.+-linux-gnu}}
+# REQUIRES: target-x86_64
+# UNSUPPORTED: system-windows
# Inline assembly isn't supported by Memory Sanitizer
# UNSUPPORTED: msan
diff --git a/libunwind/test/signal_unwind.pass.cpp b/libunwind/test/signal_unwind.pass.cpp
index 4de271ecb886b..4fb7b6a74ffc7 100644
--- a/libunwind/test/signal_unwind.pass.cpp
+++ b/libunwind/test/signal_unwind.pass.cpp
@@ -8,7 +8,9 @@
//===----------------------------------------------------------------------===//
// Ensure that the unwinder can cope with the signal handler.
-// REQUIRES: target={{(aarch64|loongarch64|riscv64|s390x|x86_64)-.+linux.*}}
+// REQUIRES: target={{(aarch64|loongarch64|riscv64|s390x|x86_64)-.+}}
+// UNSUPPORTED: system-windows
+// UNSUPPORTED: target={{.*-windows-gnu}}
// TODO: Figure out why this fails with Memory Sanitizer.
// XFAIL: msan
diff --git a/libunwind/test/unwind_leaffunction.pass.cpp b/libunwind/test/unwind_leaffunction.pass.cpp
index d336c159c131b..f7235c193eef7 100644
--- a/libunwind/test/unwind_leaffunction.pass.cpp
+++ b/libunwind/test/unwind_leaffunction.pass.cpp
@@ -8,7 +8,9 @@
//===----------------------------------------------------------------------===//
// Ensure that leaf function can be unwund.
-// REQUIRES: target={{(aarch64|loongarch64|riscv64|s390x|x86_64)-.+linux.*}}
+// REQUIRES: target={{(aarch64|loongarch64|riscv64|s390x|x86_64)-.+}}
+// UNSUPPORTED: system-windows
+// UNSUPPORTED: target={{.*-windows-gnu}}
// TODO: Figure out why this fails with Memory Sanitizer.
// XFAIL: msan
diff --git a/libunwind/test/unwind_scalable_vectors.pass.cpp b/libunwind/test/unwind_scalable_vectors.pass.cpp
index 57ef4d78244c5..458b50f12f698 100644
--- a/libunwind/test/unwind_scalable_vectors.pass.cpp
+++ b/libunwind/test/unwind_scalable_vectors.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// REQUIRES: linux && target={{riscv64-.+}}
+// REQUIRES: target-riscv64
#undef NDEBUG
#include <assert.h>
>From 1f0d8ac878434ffe7fd2d99ee95d48f909355acd Mon Sep 17 00:00:00 2001
From: Gleb Popov <arrowd at freebsd.org>
Date: Sat, 22 Nov 2025 10:49:51 +0300
Subject: [PATCH 2/2] Apply suggestions from code review
Co-authored-by: Alexander Richardson <mail at alexrichardson.me>
---
libunwind/test/aarch64_vg_unwind.pass.cpp | 4 ++--
libunwind/test/aarch64_za_unwind.pass.cpp | 4 ++--
libunwind/test/bad_unwind_info.pass.cpp | 3 +--
libunwind/test/eh_frame_fde_pc_range.pass.cpp | 2 +-
libunwind/test/floatregister.pass.cpp | 4 ++--
libunwind/test/forceunwind.pass.cpp | 7 +++----
libunwind/test/remember_state_leak.pass.sh.s | 4 ++--
libunwind/test/signal_unwind.pass.cpp | 3 +--
libunwind/test/unwind_leaffunction.pass.cpp | 3 +--
libunwind/test/unwind_scalable_vectors.pass.cpp | 2 +-
10 files changed, 16 insertions(+), 20 deletions(-)
diff --git a/libunwind/test/aarch64_vg_unwind.pass.cpp b/libunwind/test/aarch64_vg_unwind.pass.cpp
index 5abc9fd4ef0dc..d0c623b155092 100644
--- a/libunwind/test/aarch64_vg_unwind.pass.cpp
+++ b/libunwind/test/aarch64_vg_unwind.pass.cpp
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-// REQUIRES: target-aarch64
-// UNSUPPORTED: system-windows
+// REQUIRES: target={{aarch64-.+}}
+// UNSUPPORTED: target={{.*-windows.*}}
#include <libunwind.h>
#include <stdlib.h>
diff --git a/libunwind/test/aarch64_za_unwind.pass.cpp b/libunwind/test/aarch64_za_unwind.pass.cpp
index 1329e750d80e8..9f6b106a21fec 100644
--- a/libunwind/test/aarch64_za_unwind.pass.cpp
+++ b/libunwind/test/aarch64_za_unwind.pass.cpp
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-// REQUIRES: target-aarch64
-// UNSUPPORTED: system-windows
+// REQUIRES: target={{aarch64-.+}}
+// UNSUPPORTED: target={{.*-windows.*}}
#include <libunwind.h>
#include <stdint.h>
diff --git a/libunwind/test/bad_unwind_info.pass.cpp b/libunwind/test/bad_unwind_info.pass.cpp
index 6a4fd7640ade9..ded0584952acd 100644
--- a/libunwind/test/bad_unwind_info.pass.cpp
+++ b/libunwind/test/bad_unwind_info.pass.cpp
@@ -11,8 +11,7 @@
// sigreturn frame check would previously attempt to access invalid memory in
// this scenario.
// REQUIRES: target={{(aarch64|s390x|x86_64)-.+}}
-// UNSUPPORTED: system-windows
-// UNSUPPORTED: target={{.*-windows-gnu}}
+// UNSUPPORTED: target={{.*-windows.*}}
// GCC doesn't support __attribute__((naked)) on AArch64.
// UNSUPPORTED: gcc
diff --git a/libunwind/test/eh_frame_fde_pc_range.pass.cpp b/libunwind/test/eh_frame_fde_pc_range.pass.cpp
index 41bed928872c2..bb5d8670bc8b4 100644
--- a/libunwind/test/eh_frame_fde_pc_range.pass.cpp
+++ b/libunwind/test/eh_frame_fde_pc_range.pass.cpp
@@ -13,7 +13,7 @@
// clang-format off
-// REQUIRES: target-x86_64
+// REQUIRES: target={{x86_64-.+}}
// REQUIRES: objcopy-available
// TODO: Figure out why this fails with Memory Sanitizer.
diff --git a/libunwind/test/floatregister.pass.cpp b/libunwind/test/floatregister.pass.cpp
index c119d1859808f..6be3e1f3f7385 100644
--- a/libunwind/test/floatregister.pass.cpp
+++ b/libunwind/test/floatregister.pass.cpp
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-// REQUIRES: target-aarch64
-// UNSUPPORTED: system-windows
+// REQUIRES: target={{aarch64-.+}}
+// UNSUPPORTED: target={{.*-windows.*}}
// Basic test for float registers number are accepted.
diff --git a/libunwind/test/forceunwind.pass.cpp b/libunwind/test/forceunwind.pass.cpp
index a15b02b3e2e48..e5437c31a0f65 100644
--- a/libunwind/test/forceunwind.pass.cpp
+++ b/libunwind/test/forceunwind.pass.cpp
@@ -7,10 +7,9 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: system-windows
-// UNSUPPORTED: target={{.*}}-darwin{{.*}}
-// UNSUPPORTED: target={{.*}}-aix{{.*}}
-// UNSUPPORTED: target={{.*-windows-gnu}}
+// UNSUPPORTED: target={{.*-apple.*}}
+// UNSUPPORTED: target={{.*-aix.*}}
+// UNSUPPORTED: target={{.*-windows.*}}
// TODO: Figure out why this fails with Memory Sanitizer.
// XFAIL: msan
diff --git a/libunwind/test/remember_state_leak.pass.sh.s b/libunwind/test/remember_state_leak.pass.sh.s
index af928f70076ab..338a8f93c0c99 100644
--- a/libunwind/test/remember_state_leak.pass.sh.s
+++ b/libunwind/test/remember_state_leak.pass.sh.s
@@ -6,8 +6,8 @@
#
#===------------------------------------------------------------------------===#
-# REQUIRES: target-x86_64
-# UNSUPPORTED: system-windows
+# REQUIRES: target={{x86_64-.+}}
+# UNSUPPORTED: target={{.*-windows.*}}
# Inline assembly isn't supported by Memory Sanitizer
# UNSUPPORTED: msan
diff --git a/libunwind/test/signal_unwind.pass.cpp b/libunwind/test/signal_unwind.pass.cpp
index 4fb7b6a74ffc7..dbabe49f7aefe 100644
--- a/libunwind/test/signal_unwind.pass.cpp
+++ b/libunwind/test/signal_unwind.pass.cpp
@@ -9,8 +9,7 @@
// Ensure that the unwinder can cope with the signal handler.
// REQUIRES: target={{(aarch64|loongarch64|riscv64|s390x|x86_64)-.+}}
-// UNSUPPORTED: system-windows
-// UNSUPPORTED: target={{.*-windows-gnu}}
+// UNSUPPORTED: target={{.*-windows.*}}
// TODO: Figure out why this fails with Memory Sanitizer.
// XFAIL: msan
diff --git a/libunwind/test/unwind_leaffunction.pass.cpp b/libunwind/test/unwind_leaffunction.pass.cpp
index f7235c193eef7..f781d7baa2121 100644
--- a/libunwind/test/unwind_leaffunction.pass.cpp
+++ b/libunwind/test/unwind_leaffunction.pass.cpp
@@ -9,8 +9,7 @@
// Ensure that leaf function can be unwund.
// REQUIRES: target={{(aarch64|loongarch64|riscv64|s390x|x86_64)-.+}}
-// UNSUPPORTED: system-windows
-// UNSUPPORTED: target={{.*-windows-gnu}}
+// UNSUPPORTED: target={{.*-windows.*}}
// TODO: Figure out why this fails with Memory Sanitizer.
// XFAIL: msan
diff --git a/libunwind/test/unwind_scalable_vectors.pass.cpp b/libunwind/test/unwind_scalable_vectors.pass.cpp
index 458b50f12f698..38d8bd5e002d1 100644
--- a/libunwind/test/unwind_scalable_vectors.pass.cpp
+++ b/libunwind/test/unwind_scalable_vectors.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// REQUIRES: target-riscv64
+// REQUIRES: target={{riscv64-.+}}
#undef NDEBUG
#include <assert.h>
More information about the cfe-commits
mailing list