Currently, it is unclear if a test that is skipped is either:
- Unsupported because it will never run (macosx tests should not run on
Windows).
- Skipped because it's supposed to work but does not yet.
`@expectedFailure` is not always an option because a test might be
timing out and waiting 600s for it to fail is not acceptable.
This patch introduces 2 new decorators to differentiate those tests:
- `@requireX` meaning the tests require X to run (e.g `@requireDarwin`).
- `@requireNotX` meaning the tests requires anything but `X` to run (e.g
`@requireNotDarwin`).
In the tests results summary, this introduces a new category: `skipped`
tests:
- `@requireX` -> `UNSUPPORTED`
- `@skipIfX` -> `SKIPPED`
Here is how they can and cannot be stacked:
This will never run:
```py3
@requireDarwin
@requireWindows
def test():
...
```
This will not run on Linux, because `@requireWindows` is not satisfied.
```py3
@requireNotDarwin
@requireWindows
def test():
...
```
For "require Darwin or Windows", you need:
```py3
@requirePlatform(["darwin", "windows"])
def test():
...
```
For "require Darwin on ARM64 or Windows on ARM64", you need:
```py3
@requireARM64
@requirePlatform(["darwin", "windows"])
def test():
...
```
This patch also converts the tests in
`lldb/tests/API/{macosx,linux,windows}` to use these decorators. Patches
to convert the rest of the tests will follow.
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
"""
|
|
Test that we get the type code and subcode for MachExceptions
|
|
"""
|
|
|
|
|
|
import lldb
|
|
import lldbsuite.test.lldbutil as lldbutil
|
|
from lldbsuite.test.lldbtest import *
|
|
from lldbsuite.test.decorators import *
|
|
|
|
|
|
class TestMachExceptionData(TestBase):
|
|
NO_DEBUG_INFO_TESTCASE = True
|
|
|
|
@requireDarwin
|
|
def test_exc_bad_access(self):
|
|
"""Test that we get type 1, code 1 and the right address for
|
|
a EXC_BAD_ACCESS mach exception."""
|
|
self.build()
|
|
self.main_source_file = lldb.SBFileSpec("main.c")
|
|
|
|
(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
|
|
self, "Set a breakpoint here", self.main_source_file
|
|
)
|
|
|
|
# Now continue and we should crash:
|
|
process.Continue()
|
|
self.assertEqual(
|
|
lldb.eStopReasonException,
|
|
thread.GetStopReason(),
|
|
"Got the right stop reason",
|
|
)
|
|
self.assertEqual(thread.GetStopReasonDataCount(), 3, "Got all the codes")
|
|
self.assertEqual(thread.stop_reason_data[0], 1, "1 is EXC_BAD_ACCESS")
|
|
self.assertEqual(thread.stop_reason_data[1], 1, "1 is 'access invalid memory'")
|
|
self.assertEqual(thread.stop_reason_data[2], 0x400, "That's the bad address")
|