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