-
Notifications
You must be signed in to change notification settings - Fork 15.3k
libunwind: Remove OS requirements from tests to make them run on more OSes #167642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@llvm/pr-subscribers-libunwind Author: Gleb Popov (arrowd) ChangesThere might be a cleaner way to enable these tests running on FreeBSD, I'm open to suggestions. Full diff: https://github.com/llvm/llvm-project/pull/167642.diff 6 Files Affected:
diff --git a/libunwind/test/bad_unwind_info.pass.cpp b/libunwind/test/bad_unwind_info.pass.cpp
index 272a83f64a611..2fadcfefdecc3 100644
--- a/libunwind/test/bad_unwind_info.pass.cpp
+++ b/libunwind/test/bad_unwind_info.pass.cpp
@@ -10,7 +10,7 @@
// 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)-.+(linux|freebsd).*}}
// 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..e86f80839a655 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-.+-(linux-gnu|freebsd.*)}}
// 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/forceunwind.pass.cpp b/libunwind/test/forceunwind.pass.cpp
index 9e032fc680806..f3ad08c2cf693 100644
--- a/libunwind/test/forceunwind.pass.cpp
+++ b/libunwind/test/forceunwind.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// REQUIRES: linux
+// REQUIRES: linux || freebsd
// 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..0e0723f66d3c8 100644
--- a/libunwind/test/remember_state_leak.pass.sh.s
+++ b/libunwind/test/remember_state_leak.pass.sh.s
@@ -6,7 +6,7 @@
#
#===------------------------------------------------------------------------===#
-# REQUIRES: target={{x86_64-.+-linux-gnu}}
+# REQUIRES: target={{x86_64-.+-(linux-gnu|freebsd.*)}}
# 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..dd2bd9f2f1d5a 100644
--- a/libunwind/test/signal_unwind.pass.cpp
+++ b/libunwind/test/signal_unwind.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
// 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)-.+(linux|freebsd).*}}
// 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..1c796b3433973 100644
--- a/libunwind/test/unwind_leaffunction.pass.cpp
+++ b/libunwind/test/unwind_leaffunction.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
// Ensure that leaf function can be unwund.
-// REQUIRES: target={{(aarch64|loongarch64|riscv64|s390x|x86_64)-.+linux.*}}
+// REQUIRES: target={{(aarch64|loongarch64|riscv64|s390x|x86_64)-.+(linux|freebsd).*}}
// TODO: Figure out why this fails with Memory Sanitizer.
// XFAIL: msan
|
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
arichardson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like a lot of these should not have a requires Linux clause but instead list the unsupported targets.
It seems like a lot of the time they are actually checking for non-macos/non-windows. I wonder what happens when we drop the OS part of the triple from the test. Hopefully pre-commit CI will complain if this breaks something.
| // clang-format off | ||
|
|
||
| // REQUIRES: target={{x86_64-.+-linux-gnu}} | ||
| // REQUIRES: target={{x86_64-.+-(linux-gnu|freebsd.*)}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this was restricted to Linux in the first place. Maybe because of the echo issue you fixed here?
|
|
||
| // 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised this is still failing, echo should be a python built-in by default now. But fixing this to be more portable is good anyway (@boomanaiden154)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is still failing on x86_64 mingw:
# .---command stdout------------
# | 123
# | fde_pc = 00007FF64AE46030
# | fde_fpc = 0000000000000000
# | fde_fpc1 = 00007FF64AE46024
# `-----------------------------
# .---command stderr------------
# | libunwind: pc not in table, pc=0x7FF64AE413E0
# | Assertion failed: fde_fpc != NULL, file D:\a\llvm-project\llvm-project\libunwind\test\eh_frame_fde_pc_range.pass.cpp, line 51
# `-----------------------------
# error: command failed with exit status: 0xffffffff
So this probably still needs an exclusion for that. (And it's probably relevant to make it generic for all of windows again - libunwind isn't normally built and tested in msvc environments, so whatever issue there is is probably specific to all of windows, not windows-gnu in particular.)
ac87d2d to
087dad9
Compare
|
I have removed all OS requirements from tests to see the CI fallout. I'll add |
087dad9 to
936acb2
Compare
arichardson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This new approach looks good to me assuming CI is happy.
|
I haven't even tried building |
arichardson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relaxing the windows regexes sounds good and it looks like there is just one macos test failure so this should almost be ready to land.
12e9693 to
369be95
Compare
| // REQUIRES: target={{(aarch64|s390x|x86_64)-.+linux.*}} | ||
| // REQUIRES: target={{(aarch64|s390x|x86_64)-.+}} | ||
| // UNSUPPORTED: system-windows | ||
| // UNSUPPORTED: target={{.*-windows-gnu}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems redundant, system-windows should cover windows-gnu as well, if system-windows is set at all? If not, just relax the regex to {{.*-windows.*}} as suggested before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the system-* features are not set anywhere. Here is the output from one of the windows builders. I think we should just use the target regex.
All available features: 32-bit-pointer, buildhost=win32, buildhost=windows, c++26, can-create-symlinks, clang, clang-20, clang-20.1, clang-20.1.8, diagnose-if-support, enable-benchmarks=run, executor-has-no-bash, gcc-style-warnings, glibc-old-ru_RU-decimal-point, has-fblocks, has-fconstexpr-steps, has-no-zdump, host-has-gdb-with-python, large_tests, libcpp-has-no-experimental-hardening-observe-semantic, libcpp-has-no-experimental-syncstream, libcpp-has-no-experimental-tzdb, libcpp-has-no-incomplete-pstl, locale.en_US.UTF-8, locale.fr_CA.ISO8859-1, locale.fr_FR.UTF-8, locale.ja_JP.UTF-8, locale.ru_RU.UTF-8, locale.zh_CN.UTF-8, long_tests, objcopy-available, objective-c++, optimization=none, std-at-least-c++03, std-at-least-c++11, std-at-least-c++14, std-at-least-c++17, std-at-least-c++20, std-at-least-c++23, std-at-least-c++26, stdlib=libc++, stdlib=llvm-libc++, target=i686-w64-windows-gnu, verify-support, win32-broken-printf-a-precision, win32-broken-utf8-wchar-ctype, windows
arichardson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be good to land once my suggestions have been applied. Thanks for working on this.
|
It looks like there are also shorter feature names that can be used for the
|
1f0d8ac to
7cbe4c0
Compare
… OSes While at it, replace "echo -ne" with "printf" for more compatibility. Co-authored-by: Alexander Richardson <[email protected]>
7cbe4c0 to
f992d45
Compare
arichardson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, will merge once CI passes.
|
I have just re-reviewed my changes once more to be sure. Can we merge this? |
mstorsjo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM too
Feel free to. Or do you need someone else to merge it for you? |
|
Yes please, I don't have rights on this repo. |
There might be a cleaner way to enable these tests running on FreeBSD, I'm open to suggestions.