summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Maste <emaste@freebsd.org>2015-05-28 14:22:57 +0000
committerEd Maste <emaste@freebsd.org>2015-05-28 14:22:57 +0000
commit7daee53732c7e922109ae6d5fb8107cfc0e4eab6 (patch)
tree7350c52d24353110c81a064e9e6b53e20756c950
parent9720283e994c6c3187cff8724bf0c2ed59d04f8c (diff)
downloadbcm5719-llvm-7daee53732c7e922109ae6d5fb8107cfc0e4eab6.tar.gz
bcm5719-llvm-7daee53732c7e922109ae6d5fb8107cfc0e4eab6.zip
Fix TestCommandScript: return an error if target executable is not set
The test invokes the 'targetname' test command before setting a target executable, which caused Python to raise TypeError: cannot concatenate 'str' and 'NoneType' objects. llvm.org/pr23686 llvm-svn: 238425
-rw-r--r--lldb/test/functionalities/command_script/welcome.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/lldb/test/functionalities/command_script/welcome.py b/lldb/test/functionalities/command_script/welcome.py
index c6d4ddcfd40..f7e6a7ebc74 100644
--- a/lldb/test/functionalities/command_script/welcome.py
+++ b/lldb/test/functionalities/command_script/welcome.py
@@ -16,11 +16,15 @@ class TargetnameCommand(object):
pass
def __call__(self, debugger, args, exe_ctx, result):
- target = debugger.GetSelectedTarget()
- file = target.GetExecutable()
- print >>result, ('Current target ' + file.GetFilename())
if args == 'fail':
result.SetError('a test for error in command')
+ return
+ target = debugger.GetSelectedTarget()
+ file = target.GetExecutable()
+ if file:
+ print >>result, ('Current target ' + file.GetFilename())
+ else:
+ result.SetError('target.GetExecutable() failed')
def get_flags(self):
return lldb.eCommandRequiresTarget
OpenPOWER on IntegriCloud