[Lldb-commits] [PATCH] D97684: [lldb][AArch64] Simplify MTE memory region test
David Spickett via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Mar 1 06:36:19 PST 2021
DavidSpickett created this revision.
Herald added subscribers: danielkiss, kristof.beyls.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
By checking for cpu and toolchain features ahead
of time we don't need the custom return codes.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97684
Files:
lldb/test/API/linux/aarch64/mte_memory_region/TestAArch64LinuxMTEMemoryRegion.py
lldb/test/API/linux/aarch64/mte_memory_region/main.c
Index: lldb/test/API/linux/aarch64/mte_memory_region/main.c
===================================================================
--- lldb/test/API/linux/aarch64/mte_memory_region/main.c
+++ lldb/test/API/linux/aarch64/mte_memory_region/main.c
@@ -5,22 +5,9 @@
#include <sys/prctl.h>
#include <unistd.h>
-#define INCOMPATIBLE_TOOLCHAIN 47
-#define INCOMPATIBLE_TARGET 48
-
-// This is in a seperate non static function
-// so that we can always breakpoint the return 0 here.
-// Even if main never reaches it because HWCAP2_MTE
-// is not defined.
-// If it were in main then you would effectively have:
-// return TEST_INCOMPATIBLE;
-// return 0;
-// So the two returns would have the same breakpoint location
-// and we couldn't tell them apart.
-int setup_mte_page(void) {
-#ifdef HWCAP2_MTE
+int main(int argc, char const *argv[]) {
if (!(getauxval(AT_HWCAP2) & HWCAP2_MTE))
- return INCOMPATIBLE_TARGET;
+ return 1;
int got = prctl(PR_SET_TAGGED_ADDR_CTRL, PR_TAGGED_ADDR_ENABLE, 0, 0, 0);
if (got)
@@ -30,15 +17,6 @@
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (the_page == MAP_FAILED)
return 1;
-#endif
return 0; // Set break point at this line.
}
-
-int main(int argc, char const *argv[]) {
-#ifdef HWCAP2_MTE
- return setup_mte_page();
-#else
- return INCOMPATIBLE_TOOLCHAIN;
-#endif
-}
Index: lldb/test/API/linux/aarch64/mte_memory_region/TestAArch64LinuxMTEMemoryRegion.py
===================================================================
--- lldb/test/API/linux/aarch64/mte_memory_region/TestAArch64LinuxMTEMemoryRegion.py
+++ lldb/test/API/linux/aarch64/mte_memory_region/TestAArch64LinuxMTEMemoryRegion.py
@@ -17,9 +17,12 @@
NO_DEBUG_INFO_TESTCASE = True
- @skipIf(archs=no_match(["aarch64"]))
+ @skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
+ @skipUnlessAArch64MTELinuxCompiler
def test_mte_regions(self):
+ if not self.isAArch64MTE():
+ self.skipTest('Target must support MTE.')
if not self.hasLinuxVmFlags():
self.skipTest('/proc/{pid}/smaps VmFlags must be present')
@@ -33,15 +36,6 @@
self.runCmd("run", RUN_SUCCEEDED)
if self.process().GetState() == lldb.eStateExited:
- # 47 = non MTE toolchain
- # 48 = non MTE target
- exit_status = self.process().GetExitStatus()
- if exit_status == 47:
- self.skipTest("MTE must be available in toolchain")
- elif exit_status == 48:
- self.skipTest("target must have MTE enabled")
-
- # Otherwise we have MTE but another problem occured
self.fail("Test program failed to run.")
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97684.327102.patch
Type: text/x-patch
Size: 2770 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210301/10cf2d6c/attachment-0001.bin>
More information about the lldb-commits
mailing list