diff options
Diffstat (limited to 'lldb/test/Shell/ScriptInterpreter/Lua')
6 files changed, 49 insertions, 0 deletions
diff --git a/lldb/test/Shell/ScriptInterpreter/Lua/Inputs/independent_state.in b/lldb/test/Shell/ScriptInterpreter/Lua/Inputs/independent_state.in new file mode 100644 index 00000000000..6e15a8ff663 --- /dev/null +++ b/lldb/test/Shell/ScriptInterpreter/Lua/Inputs/independent_state.in @@ -0,0 +1,6 @@ +script foobar = 40 + 7 +script print(foobar) +script d = lldb.SBDebugger.Create() +script d:HandleCommand("script foobar = 40 + 2") +script print(foobar) +script d:HandleCommand("script print(foobar)") diff --git a/lldb/test/Shell/ScriptInterpreter/Lua/Inputs/nested_sessions.in b/lldb/test/Shell/ScriptInterpreter/Lua/Inputs/nested_sessions.in new file mode 100644 index 00000000000..75c57e364ca --- /dev/null +++ b/lldb/test/Shell/ScriptInterpreter/Lua/Inputs/nested_sessions.in @@ -0,0 +1,6 @@ +script +print(lldb.target, lldb.debugger:GetSelectedTarget()) +lldb.debugger:SetSelectedTarget(lldb.debugger:GetTargetAtIndex(0)) +print(lldb.target, lldb.debugger:GetSelectedTarget()) +lldb.debugger:HandleCommand("script print(lldb.target, lldb.debugger:GetSelectedTarget())") +print(lldb.target, lldb.debugger:GetSelectedTarget()) diff --git a/lldb/test/Shell/ScriptInterpreter/Lua/Inputs/nested_sessions_2.in b/lldb/test/Shell/ScriptInterpreter/Lua/Inputs/nested_sessions_2.in new file mode 100644 index 00000000000..a8cc2a57a55 --- /dev/null +++ b/lldb/test/Shell/ScriptInterpreter/Lua/Inputs/nested_sessions_2.in @@ -0,0 +1,2 @@ +script +print(lldb.target, lldb.debugger:GetSelectedTarget()) diff --git a/lldb/test/Shell/ScriptInterpreter/Lua/convenience_variables.test b/lldb/test/Shell/ScriptInterpreter/Lua/convenience_variables.test new file mode 100644 index 00000000000..022f2e38db4 --- /dev/null +++ b/lldb/test/Shell/ScriptInterpreter/Lua/convenience_variables.test @@ -0,0 +1,17 @@ +# REQUIRES: lua +# +# This tests that the convenience variables are not nil. Given that there is no +# target we only expect the debugger to be valid. +# +# RUN: cat %s | %lldb --script-language lua 2>&1 | FileCheck %s +script +print(string.format("lldb.debugger is valid: %s", lldb.debugger:IsValid())) +print(string.format("lldb.target is valid: %s", lldb.target:IsValid())) +print(string.format("lldb.process is valid: %s", lldb.process:IsValid())) +print(string.format("lldb.thread is valid: %s", lldb.thread:IsValid())) +print(string.format("lldb.frame is valid: %s", lldb.frame:IsValid())) +# CHECK: debugger is valid: true +# CHECK: target is valid: false +# CHECK: process is valid: false +# CHECK: thread is valid: false +# CHECK: frame is valid: false diff --git a/lldb/test/Shell/ScriptInterpreter/Lua/independent_state.test b/lldb/test/Shell/ScriptInterpreter/Lua/independent_state.test new file mode 100644 index 00000000000..2ade1b91c1c --- /dev/null +++ b/lldb/test/Shell/ScriptInterpreter/Lua/independent_state.test @@ -0,0 +1,6 @@ +# REQUIRES: lua +# +# RUN: %lldb --script-language lua -s %S/Inputs/independent_state.in 2>&1 | FileCheck %s +# CHECK: 47 +# CHECK: 47 +# CHECK: 42 diff --git a/lldb/test/Shell/ScriptInterpreter/Lua/nested_sessions.test b/lldb/test/Shell/ScriptInterpreter/Lua/nested_sessions.test new file mode 100644 index 00000000000..a81418b6af6 --- /dev/null +++ b/lldb/test/Shell/ScriptInterpreter/Lua/nested_sessions.test @@ -0,0 +1,12 @@ +# REQUIRES: lua +# RUN: mkdir -p %t +# RUN: echo "int main() { return 0; }" | %clang_host -x c - -o %t/foo +# RUN: echo "int main() { return 0; }" | %clang_host -x c - -o %t/bar +# RUN: %lldb --script-language lua -o "file %t/bar" -o "file %t/foo" -s %S/Inputs/nested_sessions.in -s %S/Inputs/nested_sessions_2.in 2>&1 | FileCheck %s +# CHECK: script +# CHECK-NEXT: foo foo +# CHECK-NEXT: foo bar +# CHECK-NEXT: foo bar +# CHECK-NEXT: foo bar +# CHECK: script +# CHECK-NEXT: bar bar |

