def runOneTestSuite(self, settingsText): nowTime = time.strftime("%Y-%m-%d--%H-%M-%S") configsToTest = Config.GetConfigs() randomSeeds = Global.RandomSeeds savePath = "../../tests/" + nowTime + "/" os.makedirs(savePath) if Global.SafeMode: for randomSeed in randomSeeds: for configName in configsToTest: try: self.runOneSimulation(savePath, configName, randomSeed) except: e = sys.exc_info()[1] if type(e) == TclError: raise SystemExit print e time.sleep(1) else: for randomSeed in randomSeeds: for configName in configsToTest: self.runOneSimulation(savePath, configName, randomSeed) copyfile("Enviroment/Global.py", savePath + "Global.py") copyfile("plotter.py", "../../tests/plotter.py") copyfile("../statter.exe", "../../tests/statter.exe") copyfile("../LumenWorks.Framework.IO.dll", "../../tests/LumenWorks.Framework.IO.dll") f = open(savePath + "Global.py", "a") f.write("\n#real settings of Global.py\n") f.write(settingsText) f.close()
def simulationTestAllThread(self): self.lock = Lock() import psyco psyco.full() settingsToRun = {} settings = dir(Global) settingsToRunLen = [] for setting in settings: if setting.endswith("TESTSET"): a = getattr(Global, setting) settingName = setting.split("TESTSET")[0] settingsToRun[settingName] = a settingsToRunLen.append(len(a)) #settingsToRun contains all set data to run if len(settingsToRunLen) < 1: settingsCount = 1 else: settingsCount = reduce(lambda x,y: x*y, settingsToRunLen) self.testToRunCount = settingsCount * len(Config.GetConfigs()) * len(Global.RandomSeeds) self.currentTestIndex = 0 self.testRunStarted = time.time() self.simulationTestAllRecursive(settingsToRun)
def createMenu(self): startMenu = Menu() startMenu.add_command(label="Test All", command=self.startAll) startMenu.add_separator() configs = Config.GetConfigs() for config in configs: startMenu.add_command(label=config, command= lambda config=config: self.startSimulation(config)) worldMenu = Menu() worldMenu.add_command(label="Show Affordances", command=self.showAffordances) worldMenu.add_command(label="Show Object Types", command=self.showObjectTypes) worldMenu.add_command(label="Show Objects", command=self.showObjects) worldMenu.add_checkbutton(label="Show visibility history", command=self.visibilityHistoryCheck) menubar = Menu(self) menubar.add_cascade(label="Start", menu=startMenu) menubar.add_command(label="Pause", command=self.pauseSimulation) menubar.add_command(label="Resume", command=self.resumeSimulation) menubar.add_command(label="Stop", command=self.stopSimulation) menubar.add_cascade(label="World", menu=worldMenu) menubar.add_command(label="Quit", command=self.quitSimulation) self.winfo_toplevel().config(menu=menubar)