This is an archive of the discontinued LLVM Phabricator instance.

[libunwind][test] Add test to check for unw_resume()
ClosedPublic

Authored by Ami-zhang on Apr 1 2023, 1:18 AM.

Details

Summary

This is here for local unwinding, which unw_resume() restores
the machine state and then directly resumes execution in the
target stack frame.

Diff Detail

Event Timeline

Ami-zhang created this revision.Apr 1 2023, 1:18 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 1 2023, 1:18 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Ami-zhang requested review of this revision.Apr 1 2023, 1:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 1 2023, 1:18 AM

(1) Test pass on X86

$ ninja check-unwind
Testing Time: 0.29s
  Unsupported:  2
  Passed     : 12

(2) Test results on LoongArch

$ ninja check-unwind
Testing Time: 0.57s
  Unsupported      : 6
  Passed           : 7
  Expectedly Failed: 1

There are many CI failures including AIX, FreeBSD and MSAN.

Seems we should add REQUIRES and XFAIL like other tests:

$ grep -rn REQUIRE libunwind/test/
libunwind/test/unwind_leaffunction.pass.cpp:11:// REQUIRES: linux && (target={{aarch64-.+}} || target={{s390x-.+}} || target={{x86_64-.+}})
libunwind/test/floatregister.pass.cpp:10:// REQUIRES: linux && target={{aarch64-.+}}
libunwind/test/remember_state_leak.pass.sh.s:9:# REQUIRES: target={{x86_64-.+-linux-gnu}}
libunwind/test/bad_unwind_info.pass.cpp:13:// REQUIRES: linux && (target={{aarch64-.+}} || target={{s390x-.+}} || target={{x86_64-.+}})
libunwind/test/forceunwind.pass.cpp:10:// REQUIRES: linux
libunwind/test/signal_unwind.pass.cpp:11:// REQUIRES: linux && (target={{aarch64-.+}} || target={{s390x-.+}} || target={{x86_64-.+}})
libunwind/test/unwind_scalable_vectors.pass.cpp:10:// REQUIRES: linux && target={{riscv64-.+}}
$ grep -rn msan libunwind/test/
libunwind/test/unwind_leaffunction.pass.cpp:14:// XFAIL: msan
libunwind/test/signal_frame.pass.cpp:16:// XFAIL: msan
libunwind/test/libunwind_01.pass.cpp:14:// XFAIL: msan
libunwind/test/libunwind_02.pass.cpp:11:// XFAIL: msan
libunwind/test/remember_state_leak.pass.sh.s:12:# UNSUPPORTED: msan
libunwind/test/bad_unwind_info.pass.cpp:19:// UNSUPPORTED: msan
libunwind/test/forceunwind.pass.cpp:13:// XFAIL: msan
libunwind/test/signal_unwind.pass.cpp:14:// XFAIL: msan
Ami-zhang updated this revision to Diff 510411.Apr 3 2023, 12:00 AM

Fix some test issues

Ami-zhang updated this revision to Diff 510425.Apr 3 2023, 1:37 AM

Off clang-format

arichardson added inline comments.
libunwind/test/unw_resume.pass.cpp
13

This is overly restrictive, the test looks like it should work anywhere so there should instead be xfails for the cases that are failing.

I know this is what other tests are doing but those should also be changed IMO.

Ami-zhang updated this revision to Diff 510673.Apr 3 2023, 8:08 PM

Address @arichardson's comment

Ami-zhang added inline comments.Apr 3 2023, 8:09 PM
libunwind/test/unw_resume.pass.cpp
13

Updated it.
Thanks for your suggestion.

Ami-zhang marked an inline comment as done.Apr 3 2023, 8:10 PM
Ami-zhang updated this revision to Diff 510705.Apr 3 2023, 11:32 PM

Remove freebsd from XFAIL

This revision was not accepted when it landed; it landed in state Needs Review.Apr 6 2023, 10:44 PM
This revision was automatically updated to reflect the committed changes.