1""" 2Test lldb Python commands. 3""" 4 5 6 7import lldb 8from lldbsuite.test.lldbtest import * 9 10 11class CommandScriptAliasTestCase(TestBase): 12 NO_DEBUG_INFO_TESTCASE = True 13 14 def test_pycmd(self): 15 self.runCmd("command script import tcsacmd.py") 16 self.runCmd("command script add -f tcsacmd.some_command_here attach") 17 18 # This is the function to remove the custom commands in order to have a 19 # clean slate for the next test case. 20 def cleanup(): 21 self.runCmd('command script delete attach', check=False) 22 23 # Execute the cleanup function during test case tear down. 24 self.addTearDownHook(cleanup) 25 26 # We don't want to display the stdout if not in TraceOn() mode. 27 if not self.TraceOn(): 28 self.HideStdout() 29 30 self.expect('attach a', substrs=['Victory is mine']) 31 self.runCmd("command script delete attach") 32 # this can't crash but we don't care whether the actual attach works 33 self.runCmd('attach noprocessexistswiththisname', check=False) 34