summaryrefslogtreecommitdiffstats
path: root/lldb/test
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test')
-rw-r--r--lldb/test/functionalities/alias/TestAliases.py24
-rw-r--r--lldb/test/functionalities/alias/py_import5
-rw-r--r--lldb/test/functionalities/alias/welcome.py14
3 files changed, 43 insertions, 0 deletions
diff --git a/lldb/test/functionalities/alias/TestAliases.py b/lldb/test/functionalities/alias/TestAliases.py
index b3913f0bd3f..4e700077e20 100644
--- a/lldb/test/functionalities/alias/TestAliases.py
+++ b/lldb/test/functionalities/alias/TestAliases.py
@@ -130,6 +130,30 @@ class AliasTestCase(TestBase):
substrs = [ "use of undeclared identifier 'f'",
"1 errors parsing expression" ])
+ self.runCmd("command source py_import")
+
+ self.expect('welcome Enrico',
+ substrs = ['Hello Enrico, welcome to LLDB']);
+
+ self.runCmd("command unalias welcome");
+
+ self.expect('welcome Enrico', matching=False, error=True,
+ substrs = ['Hello Enrico, welcome to LLDB']);
+
+ self.expect('targetname',
+ substrs = ['a.out'])
+
+ self.expect('targetname fail', error=True,
+ substrs = ['a test for error in command'])
+
+ self.expect('help',
+ substrs = ['targetname',
+ 'Run Python function target_name_impl'])
+
+ self.expect("help targetname",
+ substrs = ['Run Python function target_name_imp',
+ 'This command takes \'raw\' input',
+ 'quote stuff'])
if __name__ == '__main__':
diff --git a/lldb/test/functionalities/alias/py_import b/lldb/test/functionalities/alias/py_import
new file mode 100644
index 00000000000..5a562a2d997
--- /dev/null
+++ b/lldb/test/functionalities/alias/py_import
@@ -0,0 +1,5 @@
+script import sys, os
+script sys.path.append(os.path.join(os.getcwd(), os.pardir))
+script from welcome import *
+command alias --python welcome welcome_impl
+command alias --python targetname target_name_impl \ No newline at end of file
diff --git a/lldb/test/functionalities/alias/welcome.py b/lldb/test/functionalities/alias/welcome.py
new file mode 100644
index 00000000000..6754851c833
--- /dev/null
+++ b/lldb/test/functionalities/alias/welcome.py
@@ -0,0 +1,14 @@
+import sys
+
+def welcome_impl(debugger, args, stream, dict):
+ stream.Printf('Hello ' + args + ', welcome to LLDB');
+ return None;
+
+def target_name_impl(debugger, args, stream, dict):
+ target = debugger.GetSelectedTarget()
+ file = target.GetExecutable()
+ stream.Printf('Current target ' + file.GetFilename())
+ if args == 'fail':
+ return 'a test for error in command'
+ else:
+ return None \ No newline at end of file
OpenPOWER on IntegriCloud