[Lldb-commits] [lldb] 8243918 - Testuite: Support Asan test with remote testing
Fred Riss via lldb-commits
lldb-commits at lists.llvm.org
Wed Nov 6 14:30:14 PST 2019
Author: Fred Riss
Date: 2019-11-06T14:28:48-08:00
New Revision: 8243918f43c6eedc2b018c1edc9c6b72fe9b3c1e
URL: https://github.com/llvm/llvm-project/commit/8243918f43c6eedc2b018c1edc9c6b72fe9b3c1e
DIFF: https://github.com/llvm/llvm-project/commit/8243918f43c6eedc2b018c1edc9c6b72fe9b3c1e.diff
LOG: Testuite: Support Asan test with remote testing
To do so, we need to register the sanitizer libraries with the target
so that they get uploaded before running. This patch adds a helper to
the test class to this effect.
Added:
Modified:
lldb/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py
lldb/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py
lldb/packages/Python/lldbsuite/test/lldbtest.py
Removed:
################################################################################
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py b/lldb/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py
index 6b299e6c3b8c..6b192b3fc304 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py
@@ -17,7 +17,6 @@ class AsanTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
- @skipIfRemote
@skipUnlessAddressSanitizer
def test(self):
self.build()
@@ -33,9 +32,10 @@ def setUp(self):
def asan_tests(self):
exe = self.getBuildArtifact("a.out")
- self.expect(
- "file " + exe,
- patterns=["Current executable set to .*a.out"])
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ self.registerSanitizerLibrariesWithTarget(target)
self.runCmd("breakpoint set -f main.c -l %d" % self.line_breakpoint)
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py b/lldb/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py
index d523b472b3e7..18d99638925d 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py
@@ -17,7 +17,6 @@ class AsanTestReportDataCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
- @skipIfRemote
@skipUnlessAddressSanitizer
@skipIf(archs=['i386'], bugnumber="llvm.org/PR36710")
def test(self):
@@ -36,9 +35,11 @@ def setUp(self):
def asan_tests(self):
exe = self.getBuildArtifact("a.out")
- self.expect(
- "file " + exe,
- patterns=["Current executable set to .*a.out"])
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ self.registerSanitizerLibrariesWithTarget(target)
+
self.runCmd("run")
stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason()
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index f3165ab32585..0b32fc4ef585 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1922,6 +1922,15 @@ def registerSharedLibrariesWithTarget(self, target, shlibs):
return environment
+ def registerSanitizerLibrariesWithTarget(self, target):
+ runtimes = []
+ for m in target.module_iter():
+ libspec = m.GetFileSpec()
+ if "clang_rt" in libspec.GetFilename():
+ runtimes.append(os.path.join(libspec.GetDirectory(),
+ libspec.GetFilename()))
+ return self.registerSharedLibrariesWithTarget(target, runtimes)
+
# utility methods that tests can use to access the current objects
def target(self):
if not self.dbg:
More information about the lldb-commits
mailing list