[Lldb-commits] [lldb] f8e2ec1 - Revert "Add asan tests for libsanitizers. (#88349)"

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 16 08:29:34 PDT 2024


Author: Adrian Prantl
Date: 2024-04-16T08:29:09-07:00
New Revision: f8e2ec13a8c6d33cb7b4f37869b4429ddcf43f01

URL: https://github.com/llvm/llvm-project/commit/f8e2ec13a8c6d33cb7b4f37869b4429ddcf43f01
DIFF: https://github.com/llvm/llvm-project/commit/f8e2ec13a8c6d33cb7b4f37869b4429ddcf43f01.diff

LOG: Revert "Add asan tests for libsanitizers. (#88349)"

This reverts commit 82f479ba315a417b6cd01a8c2efdc15c26689f2e due to bot breakage.

Added: 
    

Modified: 
    lldb/test/API/functionalities/asan/Makefile
    lldb/test/API/functionalities/asan/TestMemoryHistory.py
    lldb/test/API/functionalities/asan/TestReportData.py

Removed: 
    lldb/test/API/functionalities/libsanitizers/util.py


################################################################################
diff  --git a/lldb/test/API/functionalities/asan/Makefile b/lldb/test/API/functionalities/asan/Makefile
index d66696fed7078f..4913a18d8cc6f9 100644
--- a/lldb/test/API/functionalities/asan/Makefile
+++ b/lldb/test/API/functionalities/asan/Makefile
@@ -1,8 +1,4 @@
 C_SOURCES := main.c
-asan: CFLAGS_EXTRAS := -fsanitize=address -g -gcolumn-info
-asan: all
-
-libsanitizers: CFLAGS_EXTRAS := -fsanitize=address -fsanitize-stable-abi -g -gcolumn-info
-libsanitizers: all
+CFLAGS_EXTRAS := -fsanitize=address -g -gcolumn-info
 
 include Makefile.rules

diff  --git a/lldb/test/API/functionalities/asan/TestMemoryHistory.py b/lldb/test/API/functionalities/asan/TestMemoryHistory.py
index ee7939203ead18..00162ae8822c74 100644
--- a/lldb/test/API/functionalities/asan/TestMemoryHistory.py
+++ b/lldb/test/API/functionalities/asan/TestMemoryHistory.py
@@ -9,21 +9,15 @@
 from lldbsuite.test import lldbplatform
 from lldbsuite.test import lldbutil
 
-from functionalities.libsanitizers.util import no_libsanitizers
 
 class AsanTestCase(TestBase):
     @skipIfFreeBSD  # llvm.org/pr21136 runtimes not yet available by default
     @expectedFailureNetBSD
     @skipUnlessAddressSanitizer
     def test(self):
-        self.build(make_targets=["asan"])
+        self.build()
         self.asan_tests()
 
-    @skipIf(oslist=no_match(["macosx"]))
-    def test_libsanitizers_asan(self):
-        self.build(make_targets=["libsanitizers"])
-        self.libsanitizer_tests()
-
     def setUp(self):
         # Call super's setUp().
         TestBase.setUp(self)
@@ -32,71 +26,6 @@ def setUp(self):
         self.line_free = line_number("main.c", "// free line")
         self.line_breakpoint = line_number("main.c", "// break line")
 
-    # Test line numbers: rdar://126237493
-    def libsanitizer_tests(self):
-        target = self.createTestTarget()
-
-        if no_libsanitizers(self):
-            self.skipTest("libsanitizers not found")
-
-        self.runCmd(
-            "env SanitizersAddress=1 MallocSanitizerZone=1 MallocSecureAllocator=0"
-        )
-
-        self.runCmd("run")
-
-        # In libsanitizers, memory history is not supported until a report has been generated
-        self.expect(
-            "thread list",
-            "Process should be stopped due to ASan report",
-            substrs=["stopped", "stop reason = Use of deallocated memory"],
-        )
-
-        # test the 'memory history' command
-        self.expect(
-            "memory history 'pointer'",
-            substrs=[
-                "Memory deallocated by Thread",
-                "a.out`f2",
-                "main.c",
-                "Memory allocated by Thread",
-                "a.out`f1",
-                "main.c",
-            ],
-        )
-
-        # do the same using SB API
-        process = self.dbg.GetSelectedTarget().process
-        val = (
-            process.GetSelectedThread().GetSelectedFrame().EvaluateExpression("pointer")
-        )
-        addr = val.GetValueAsUnsigned()
-        threads = process.GetHistoryThreads(addr)
-        self.assertEqual(threads.GetSize(), 2)
-
-        history_thread = threads.GetThreadAtIndex(0)
-        self.assertTrue(history_thread.num_frames >= 2)
-        self.assertEqual(
-            history_thread.frames[1].GetLineEntry().GetFileSpec().GetFilename(),
-            "main.c",
-        )
-
-        history_thread = threads.GetThreadAtIndex(1)
-        self.assertTrue(history_thread.num_frames >= 2)
-        self.assertEqual(
-            history_thread.frames[1].GetLineEntry().GetFileSpec().GetFilename(),
-            "main.c",
-        )
-
-        # let's free the container (SBThreadCollection) and see if the
-        # SBThreads still live
-        threads = None
-        self.assertTrue(history_thread.num_frames >= 2)
-        self.assertEqual(
-            history_thread.frames[1].GetLineEntry().GetFileSpec().GetFilename(),
-            "main.c",
-        )
-
     def asan_tests(self):
         target = self.createTestTarget()
 

diff  --git a/lldb/test/API/functionalities/asan/TestReportData.py b/lldb/test/API/functionalities/asan/TestReportData.py
index de0c1206a57ad6..543c5fe66a208d 100644
--- a/lldb/test/API/functionalities/asan/TestReportData.py
+++ b/lldb/test/API/functionalities/asan/TestReportData.py
@@ -9,7 +9,6 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
-from functionalities.libsanitizers.util import no_libsanitizers
 
 class AsanTestReportDataCase(TestBase):
     @skipIfFreeBSD  # llvm.org/pr21136 runtimes not yet available by default
@@ -17,14 +16,9 @@ class AsanTestReportDataCase(TestBase):
     @skipUnlessAddressSanitizer
     @skipIf(archs=["i386"], bugnumber="llvm.org/PR36710")
     def test(self):
-        self.build(make_targets=["asan"])
+        self.build()
         self.asan_tests()
 
-    @skipIf(oslist=no_match(["macosx"]))
-    def test_libsanitizers_asan(self):
-        self.build(make_targets=["libsanitizers"])
-        self.asan_tests(libsanitizers=True)
-
     def setUp(self):
         # Call super's setUp().
         TestBase.setUp(self)
@@ -35,18 +29,10 @@ def setUp(self):
         self.line_crash = line_number("main.c", "// BOOM line")
         self.col_crash = 16
 
-    def asan_tests(self, libsanitizers=False):
+    def asan_tests(self):
         target = self.createTestTarget()
 
-        if libsanitizers and no_libsanitizers(self):
-            self.skipTest("libsanitizers not found")
-
-        if libsanitizers:
-            self.runCmd(
-                "env SanitizersAddress=1 MallocSanitizerZone=1 MallocSecureAllocator=0"
-            )
-        else:
-            self.registerSanitizerLibrariesWithTarget(target)
+        self.registerSanitizerLibrariesWithTarget(target)
 
         self.runCmd("run")
 

diff  --git a/lldb/test/API/functionalities/libsanitizers/util.py b/lldb/test/API/functionalities/libsanitizers/util.py
deleted file mode 100644
index ad68541aba8d05..00000000000000
--- a/lldb/test/API/functionalities/libsanitizers/util.py
+++ /dev/null
@@ -1,3 +0,0 @@
-def no_libsanitizers(testbase):
-    testbase.runCmd("image list libsystem_sanitizers.dylib", check=False)
-    return not "libsystem_sanitizers.dylib" in testbase.res.GetOutput()


        


More information about the lldb-commits mailing list