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