aboutsummaryrefslogtreecommitdiff
path: root/lldb/test
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test')
-rw-r--r--lldb/test/API/lang/objc/synthesized-property-accessor/Makefile4
-rw-r--r--lldb/test/API/lang/objc/synthesized-property-accessor/TestSynthesizedPropertyAccessor.py30
-rw-r--r--lldb/test/API/lang/objc/synthesized-property-accessor/main.m14
-rw-r--r--lldb/test/API/lua_api/TestLuaAPI.py4
-rw-r--r--lldb/test/Shell/ExecControl/StopHook/stop-hook-list.test70
5 files changed, 121 insertions, 1 deletions
diff --git a/lldb/test/API/lang/objc/synthesized-property-accessor/Makefile b/lldb/test/API/lang/objc/synthesized-property-accessor/Makefile
new file mode 100644
index 0000000..89e6e79
--- /dev/null
+++ b/lldb/test/API/lang/objc/synthesized-property-accessor/Makefile
@@ -0,0 +1,4 @@
+OBJC_SOURCES := main.m
+LDFLAGS := -lobjc
+
+include Makefile.rules
diff --git a/lldb/test/API/lang/objc/synthesized-property-accessor/TestSynthesizedPropertyAccessor.py b/lldb/test/API/lang/objc/synthesized-property-accessor/TestSynthesizedPropertyAccessor.py
new file mode 100644
index 0000000..0a171e98
--- /dev/null
+++ b/lldb/test/API/lang/objc/synthesized-property-accessor/TestSynthesizedPropertyAccessor.py
@@ -0,0 +1,30 @@
+"""
+Test debug-info parsing of synthesized Objective-C properties.
+"""
+
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestSynthesizedPropertyAccessor(TestBase):
+ def test(self):
+ self.build()
+
+ (target, _, _, _) = lldbutil.run_to_source_breakpoint(
+ self, "return f.fooProp", lldb.SBFileSpec("main.m")
+ )
+
+ getters = target.FindFunctions("-[Foo fooProp]", lldb.eFunctionNameTypeSelector)
+ self.assertEqual(len(getters), 1)
+ getter = getters[0].function.GetType()
+ self.assertTrue(getter)
+ self.assertEqual(getter.GetDisplayTypeName(), "int ()")
+
+ setters = target.FindFunctions(
+ "-[Foo setFooProp:]", lldb.eFunctionNameTypeSelector
+ )
+ self.assertEqual(len(setters), 1)
+ setter = setters[0].function.GetType()
+ self.assertTrue(setter)
+ self.assertEqual(setter.GetDisplayTypeName(), "void (int)")
diff --git a/lldb/test/API/lang/objc/synthesized-property-accessor/main.m b/lldb/test/API/lang/objc/synthesized-property-accessor/main.m
new file mode 100644
index 0000000..4186162
--- /dev/null
+++ b/lldb/test/API/lang/objc/synthesized-property-accessor/main.m
@@ -0,0 +1,14 @@
+#import <Foundation/Foundation.h>
+
+@interface Foo : NSObject
+@property(readwrite) int fooProp;
+@end
+
+@implementation Foo
+@end
+
+int main() {
+ Foo *f = [Foo new];
+ [f setFooProp:10];
+ return f.fooProp;
+}
diff --git a/lldb/test/API/lua_api/TestLuaAPI.py b/lldb/test/API/lua_api/TestLuaAPI.py
index 4ac795d..e78ed9d 100644
--- a/lldb/test/API/lua_api/TestLuaAPI.py
+++ b/lldb/test/API/lua_api/TestLuaAPI.py
@@ -158,7 +158,9 @@ class TestLuaAPI(TestBase):
return tests
def test_lua_api(self):
- if "LUA_EXECUTABLE" not in os.environ or len(os.environ["LUA_EXECUTABLE"]) == 0:
+ if "LUA_EXECUTABLE" not in os.environ or not os.path.exists(
+ os.environ["LUA_EXECUTABLE"]
+ ):
self.skipTest("Lua API tests could not find Lua executable.")
return
lua_executable = os.environ["LUA_EXECUTABLE"]
diff --git a/lldb/test/Shell/ExecControl/StopHook/stop-hook-list.test b/lldb/test/Shell/ExecControl/StopHook/stop-hook-list.test
new file mode 100644
index 0000000..42d0a67
--- /dev/null
+++ b/lldb/test/Shell/ExecControl/StopHook/stop-hook-list.test
@@ -0,0 +1,70 @@
+# Test stop hook user ID assignment, ordering, and printing.
+#
+# RUN: %lldb -b -s %s | FileCheck %s
+
+# Create some stop hooks
+target stop-hook add -o 'print "Hello"'
+target stop-hook add -o 'print "world,"'
+target stop-hook add -o 'print "nice"'
+target stop-hook add -o 'print "weather"'
+target stop-hook add -o 'print "today!"'
+
+# Print hooks
+target stop-hook list
+
+# CHECK: (lldb) target stop-hook list
+# CHECK: Hook: 1
+# CHECK: "Hello"
+# CHECK: Hook: 2
+# CHECK: "world,"
+# CHECK: Hook: 3
+# CHECK: "nice"
+# CHECK: Hook: 4
+# CHECK: "weather"
+# CHECK: Hook: 5
+# CHECK: "today!"
+
+# Delete last hook, then add new one
+target stop-hook delete 5
+target stop-hook add -o 'print "Sunshine,"'
+
+# Stop hook gets new user ID (it is not reused)
+# CHECK: (lldb) target stop-hook add -o 'print "Sunshine,"'
+# CHECK: Stop hook #6 added.
+
+target stop-hook list
+# CHECK: (lldb) target stop-hook list
+# CHECK: Hook: 4
+# CHECK-NOT: Hook: 5
+# CHECK: Hook: 6
+
+# Add a few more hooks
+target stop-hook add -o 'print "rain,"'
+target stop-hook add -o 'print "and wind!"'
+target stop-hook add -o 'print "It is all okay!"'
+# CHECK: Stop hook #7 added.
+# CHECK: Stop hook #8 added.
+# CHECK: Stop hook #9 added.
+
+# Delete a few hooks
+target stop-hook delete 1
+target stop-hook delete 3
+target stop-hook delete 7
+target stop-hook delete 9
+
+# Check that the list is still well-ordered
+target stop-hook list
+# CHECK: (lldb) target stop-hook list
+# CHECK-NOT: Hook: 1
+# CHECK: Hook: 2
+# CHECK: "world,"
+# CHECK-NOT: Hook: 3
+# CHECK: Hook: 4
+# CHECK: "weather"
+# CHECK-NOT: Hook: 5
+# CHECK: Hook: 6
+# CHECK: "Sunshine,"
+# CHECK-NOT: Hook: 7
+# CHECK: Hook: 8
+# CHECK: "and wind!"
+# CHECK-NOT: Hook: 9