Skip to content

Commit 8243918

Browse files
committed
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.
1 parent 83393d2 commit 8243918

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

lldb/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ class AsanTestCase(TestBase):
1717
mydir = TestBase.compute_mydir(__file__)
1818

1919
@skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
20-
@skipIfRemote
2120
@skipUnlessAddressSanitizer
2221
def test(self):
2322
self.build()
@@ -33,9 +32,10 @@ def setUp(self):
3332

3433
def asan_tests(self):
3534
exe = self.getBuildArtifact("a.out")
36-
self.expect(
37-
"file " + exe,
38-
patterns=["Current executable set to .*a.out"])
35+
target = self.dbg.CreateTarget(exe)
36+
self.assertTrue(target, VALID_TARGET)
37+
38+
self.registerSanitizerLibrariesWithTarget(target)
3939

4040
self.runCmd("breakpoint set -f main.c -l %d" % self.line_breakpoint)
4141

lldb/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ class AsanTestReportDataCase(TestBase):
1717
mydir = TestBase.compute_mydir(__file__)
1818

1919
@skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
20-
@skipIfRemote
2120
@skipUnlessAddressSanitizer
2221
@skipIf(archs=['i386'], bugnumber="llvm.org/PR36710")
2322
def test(self):
@@ -36,9 +35,11 @@ def setUp(self):
3635

3736
def asan_tests(self):
3837
exe = self.getBuildArtifact("a.out")
39-
self.expect(
40-
"file " + exe,
41-
patterns=["Current executable set to .*a.out"])
38+
target = self.dbg.CreateTarget(exe)
39+
self.assertTrue(target, VALID_TARGET)
40+
41+
self.registerSanitizerLibrariesWithTarget(target)
42+
4243
self.runCmd("run")
4344

4445
stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason()

lldb/packages/Python/lldbsuite/test/lldbtest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,6 +1922,15 @@ def registerSharedLibrariesWithTarget(self, target, shlibs):
19221922

19231923
return environment
19241924

1925+
def registerSanitizerLibrariesWithTarget(self, target):
1926+
runtimes = []
1927+
for m in target.module_iter():
1928+
libspec = m.GetFileSpec()
1929+
if "clang_rt" in libspec.GetFilename():
1930+
runtimes.append(os.path.join(libspec.GetDirectory(),
1931+
libspec.GetFilename()))
1932+
return self.registerSharedLibrariesWithTarget(target, runtimes)
1933+
19251934
# utility methods that tests can use to access the current objects
19261935
def target(self):
19271936
if not self.dbg:

0 commit comments

Comments
 (0)