def main(args): # Parse the command line options options, args = Options.parseCommandLine(args) if options.help_commands: printCommands() return 0 if not args: fail("Command missing. Use one of %s" % ", ".join(getCommands().keys())) command = args[0] commands = getCommands() if options.verbose: Log.quiet = False else: Log.debug = lambda msg: None if options.quiet: Log.quiet = True if not command in commands: fail("Bad command. Use one of %s" % ", ".join(getCommands().keys())) # Install a task monitor taskMon = Task.RateLimitedTaskMonitor(TracyTaskMonitor()) Task.setMonitor(taskMon) # Read the project file project = Project.Project(options=options, fileName=options.project) getCommands()[command][0](project, options, args[1:]) return 0
def generateTargets(self): # Load the created project and generate each target options, args = Options.parseCommandLine( ["-c", "tracytest.tcy", "-o", "tracytest"]) proj = Project.Project(options, "tracytest.tcy") for target in Target.targets: assert target in proj.targets try: TracyGenerator.generate(proj, options, [target]) assert os.path.exists("tracytest") except RuntimeError: if target not in ["code"]: raise
def createAnalyzer(self, args=[]): # Parse the command line options options, args = Options.parseCommandLine(args) # Read the project file project = Project.Project(options=options, fileName=options.project) # Create the interactive analyzer analyzer = Analyzer.InteractiveAnalyzer(project, options) # Divert the output analyzer.reportInfo = self.logInfo Task.setMonitor(None) return analyzer
def main(args): # Parse the command line options options, args = Options.parseCommandLine(args) if options.verbose: Log.quiet = False if options.quiet: Log.quiet = True # If a project file was not given, present the possibilities if not options.project: projectFiles = getAvailableProjectFiles() try: projectFile = projectFiles[Console.chooseIndex( "Choose a project file", [f[1] for f in projectFiles])][0] except TypeError: return else: projectFile = options.project # Read the project file project = Project.Project(options=options, fileName=projectFile) # Create the interactive analyzer analyzer = Analyzer.InteractiveAnalyzer(project, options) if options.execute: for command in options.execute: try: analyzer.execute(command) except Analyzer.ExecutionError: return 1 analyzer.run() return 0
def setUp(self): self.options, args = Options.parseCommandLine(["-o", "tracytest.tcy"]) self.project = Project.Project(self.options, self.options.project) Log.quiet = True