Package ghidra.test

Class ProjectTestUtils

  • public class ProjectTestUtils
    extends java.lang.Object
    Ghidra framework and program test utilities
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static DomainFile createProgramFile​(Project proj, java.lang.String progName, Language language, CompilerSpec compilerSpec, DomainFolder folder)
      Create an empty program file within the specified project folder.
      static boolean deleteProject​(java.lang.String directory, java.lang.String name)
      Remove entire project.
      static boolean deleteTool​(Project project, java.lang.String toolName)
      Remove the specified tool if it exists.
      static Project getProject​(java.lang.String directory, java.lang.String name)
      Open the project for the given directory and name.
      static Tool getTool​(Project project, java.lang.String toolName)
      Launch a tool.
      static ToolTemplate saveTool​(Project project, Tool tool)
      Save a tool to the project tool chest.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ProjectTestUtils

        public ProjectTestUtils()
    • Method Detail

      • getProject

        public static Project getProject​(java.lang.String directory,
                                         java.lang.String name)
        Open the project for the given directory and name. If the project does not exist, create one. Only once instance of a given project may be open at any given point in time. Be sure to close the project if you will be re-opening.
        directory - directory for the project
        name - name of the project
        the project
        Throws: - if there was a problem creating the project
        LockException - if the project is already open
        java.lang.IllegalArgumentException - if the name has illegal characters such that a URL could not be created
      • deleteProject

        public static boolean deleteProject​(java.lang.String directory,
                                            java.lang.String name)
        Remove entire project. Note: this will not remove the parent directory of the project.
        directory - directory of the project.
        name - The name of the project to delete
        True if the project was deleted.
      • getTool

        public static Tool getTool​(Project project,
                                   java.lang.String toolName)
        Launch a tool.
        project - the project to which the tool belongs
        toolName - name of the tool to get from the active workspace. If null, launch a new empty tool in the active workspace.
      • saveTool

        public static ToolTemplate saveTool​(Project project,
                                            Tool tool)
        Save a tool to the project tool chest.
        project - The project which with the tool is associated.
        tool - The tool to be saved
        The tool template for the given tool.
      • deleteTool

        public static boolean deleteTool​(Project project,
                                         java.lang.String toolName)
        Remove the specified tool if it exists.
        project -
        toolName -
        true if it existed and was removed from the local tool chest.