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.
47 lines
1.7 KiB
Python
47 lines
1.7 KiB
Python
"""
|
|
Test that LLDB disables the debug heap on Windows.
|
|
"""
|
|
|
|
import lldb
|
|
from lldbsuite.test.decorators import *
|
|
from lldbsuite.test.lldbtest import *
|
|
from typing import List
|
|
|
|
|
|
@requireWindows
|
|
class DebugHeapTestCase(TestBase):
|
|
NO_DEBUG_INFO_TESTCASE = True
|
|
|
|
def tearDown(self):
|
|
self.runCmd("settings clear platform.plugin.windows.disable-debug-heap")
|
|
return super().tearDown()
|
|
|
|
def _run_to_exit(self, envp: List[str] = []):
|
|
self.build()
|
|
target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
|
|
self.assertTrue(target, VALID_TARGET)
|
|
self.dbg.SetAsync(False)
|
|
process = target.LaunchSimple([], envp, self.get_process_working_directory())
|
|
self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID)
|
|
self.assertState(process.GetState(), lldb.eStateExited)
|
|
return process.GetSTDOUT(256)
|
|
|
|
def test_default(self):
|
|
output = self._run_to_exit()
|
|
self.assertIn("_NO_DEBUG_HEAP=1", output)
|
|
output = self._run_to_exit(["_NO_DEBUG_HEAP=2"])
|
|
self.assertIn("_NO_DEBUG_HEAP=2", output)
|
|
|
|
def test_disabled(self):
|
|
self.runCmd("settings set platform.plugin.windows.disable-debug-heap false")
|
|
output = self._run_to_exit()
|
|
self.assertNotIn("_NO_DEBUG_HEAP", output)
|
|
output = self._run_to_exit(["_NO_DEBUG_HEAP=2"])
|
|
self.assertIn("_NO_DEBUG_HEAP=2", output)
|
|
|
|
def test_enabled(self):
|
|
self.runCmd("settings set platform.plugin.windows.disable-debug-heap true")
|
|
output = self._run_to_exit()
|
|
self.assertIn("_NO_DEBUG_HEAP=1", output)
|
|
output = self._run_to_exit(["_NO_DEBUG_HEAP=2"])
|
|
self.assertIn("_NO_DEBUG_HEAP=2", output)
|