[Lldb-commits] [lldb] [lldb][test] Switch LLDB API tests from vendored unittest2 to unittest (PR #79945)

Jordan Rupprecht via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 30 08:21:41 PST 2024


rupprecht wrote:

> I ran this on Arm and AArch64 Linux. One test `lldb/test/API/functionalities/breakpoint/hardware_breakpoints/require_hw_breakpoints/TestRequireHWBreakpoints.py` was xfailed on AArch64 is now not. Before:
> 
> ```
> PASS: LLDB (/home/david.spickett/build-llvm-aarch64/bin/clang-aarch64) :: test_breakpoint (TestRequireHWBreakpoints.BreakpointLocationsTestCase)
> XFAIL: LLDB (/home/david.spickett/build-llvm-aarch64/bin/clang-aarch64) :: test_step_out (TestRequireHWBreakpoints.BreakpointLocationsTestCase)
> XFAIL: LLDB (/home/david.spickett/build-llvm-aarch64/bin/clang-aarch64) :: test_step_over (TestRequireHWBreakpoints.BreakpointLocationsTestCase)
> XFAIL: LLDB (/home/david.spickett/build-llvm-aarch64/bin/clang-aarch64) :: test_step_range (TestRequireHWBreakpoints.BreakpointLocationsTestCase)
> XFAIL: LLDB (/home/david.spickett/build-llvm-aarch64/bin/clang-aarch64) :: test_step_until (TestRequireHWBreakpoints.BreakpointLocationsTestCase)
> ```
> 
> After:
> 
> ```
> PASS: LLDB (/home/david.spickett/build-llvm-aarch64/bin/clang-aarch64) :: test_breakpoint (TestRequireHWBreakpoints.BreakpointLocationsTestCase)
> FAIL: LLDB (/home/david.spickett/build-llvm-aarch64/bin/clang-aarch64) :: test_step_out (TestRequireHWBreakpoints.BreakpointLocationsTestCase)
> FAIL: LLDB (/home/david.spickett/build-llvm-aarch64/bin/clang-aarch64) :: test_step_over (TestRequireHWBreakpoints.BreakpointLocationsTestCase)
> FAIL: LLDB (/home/david.spickett/build-llvm-aarch64/bin/clang-aarch64) :: test_step_range (TestRequireHWBreakpoints.BreakpointLocationsTestCase)
> FAIL: LLDB (/home/david.spickett/build-llvm-aarch64/bin/clang-aarch64) :: test_step_until (TestRequireHWBreakpoints.BreakpointLocationsTestCase)
> ```
> 
> To be honest, the way the XFAIL is written is very strange. We wrap a `skipIf` around `supports_hw_breakpoints` then we `expectedFailureIfFn` on that. Which sounds like we expect failure if we support hardware breakpoints, but that can't be how that works.
> 
> Also, I think the XFAIL was added for Arm (32 bit) ([30308d1](https://github.com/llvm/llvm-project/commit/30308d1eb966afa35ee2fd5c5b47b17eb0382896)) and did not intend to include AArch64. Whatever the intent was, this now fails on AArch64 so it should be both.
> 
> I will see if I can just rewrite the xfail here, because we're definitely doing something weird at the moment.

Argh, thanks very much for running those tests -- I had noticed that issue before, but forgot about it when mailing this. The issue is that `expectedFailureIfFn` inherently doesn't work anymore. I need to remove that usage first. Thankfully it's only used in three test case files.

Versions of both `unittest` and `unittest2` from trunk expect that any xfail annotations are applied at test class instantiation (or something; a Python compiler expert can correct me). But our local copy of `unittest2` is forked from an older version which allows the xfail annotation to apply at test runtime. So anything that relies on lazily deciding if a test case should be xfail will not work when unittest tries to eagerly check if something is xfail. `expectedFailureIfFn` is a decorator that wraps the test case and only calls the fn when the test has just finished setup and is about to start the actual test case.

More details w/ commit & bug links in https://github.com/llvm/llvm-project/pull/73067#issuecomment-1828761806.

Anyway, I'll see about landing that first, and hopefully it doesn't interfere w/ this PR much.

https://github.com/llvm/llvm-project/pull/79945


More information about the lldb-commits mailing list