Exemplo n.º 1
0
    def submitJob(self, test, submissionRules, commandArgs, slaveEnv, withProxy=True, jobType=""):
        self.diag.info("Submitting job at " + plugins.localtime() + ":" + repr(commandArgs))
        self.diag.info("Creating job at " + plugins.localtime())
        self.fixDisplay(slaveEnv)
        self.fixProxyVar(slaveEnv, test, withProxy)
        cmdArgs = self.getSubmitCmdArgs(test, submissionRules, commandArgs, slaveEnv)
        if withProxy:
            cmdArgs = self.modifyCommandForProxy(test, cmdArgs, slaveEnv)
        
        jobName = submissionRules.getJobName()
        self.diag.info("Creating job " + jobName + " with command arguments : " + " ".join(cmdArgs))
        with self.lock:
            if self.exited:
                self.cancel(test)
                plugins.log.info("Q: Submission cancelled for " + repr(test) + " - exit underway")
                return False
        
            self.lockDiag.info("Got lock for submission")
            queueSystem = self.getQueueSystem(test)
            logDir = self.getSlaveLogDir(test)
            jobId, errorMessage = queueSystem.submitSlaveJob(cmdArgs, slaveEnv, logDir, submissionRules, jobType)
            if jobId is not None:
                self.diag.info("Job created with id " + jobId)

                self.jobs.setdefault(test, []).append((jobId, jobName))
                self.lockDiag.info("Releasing lock for submission...")
                return True
            else:
                self.diag.info("Job not created : " + errorMessage)
                test.changeState(plugins.Unrunnable(errorMessage, "NOT SUBMITTED"))
                self.handleErrorState(test)
                return False
Exemplo n.º 2
0
 def notifyAllRead(self, suites):
     if not self.dynamic:
         self.notify("Status", "Reading tests completed at " + plugins.localtime() + ".")
         self.notify("ActionStop")
     self.notify("AllRead", suites)
     if self.dynamic and len(suites) == 0:
         self.topWindowGUI.forceQuit()
Exemplo n.º 3
0
 def createView(self):
     hbox = gtk.HBox()
     self.label = gtk.Label()
     self.label.set_name("GUI status")
     self.label.set_ellipsize(pango.ELLIPSIZE_END)
     # It seems difficult to say 'ellipsize when you'd otherwise need
     # to enlarge the window', so we'll have to settle for a fixed number
     # of max char's ... The current setting (90) is just a good choice
     # based on my preferred window size, on the test case I used to
     # develop this code. (since different chars have different widths,
     # the optimal number depends on the string to display) \ Mattias++
     self.label.set_max_width_chars(90)
     self.label.set_use_markup(True)
     self.label.set_markup(plugins.convertForMarkup("TextTest started at " + plugins.localtime() + "."))
     hbox.pack_start(self.label, expand=False, fill=False)
     imageDir = plugins.installationDir("images")
     try:
         staticIcon = os.path.join(imageDir, "throbber_inactive.png")
         temp = gtk.gdk.pixbuf_new_from_file(staticIcon)
         self.throbber = gtk.Image()
         self.throbber.set_from_pixbuf(temp)
         animationIcon = os.path.join(imageDir, "throbber_active.gif")
         self.animation = gtk.gdk.PixbufAnimation(animationIcon)
         hbox.pack_end(self.throbber, expand=False, fill=False)
     except Exception, e:
         plugins.printWarning("Failed to create icons for the status throbber:\n" + str(e) + \
                              "\nAs a result, the throbber will be disabled.", stdout=True)
         self.throbber = None
Exemplo n.º 4
0
 def notifyAllRead(self, suites):
     if not self.dynamic:
         self.notify("Status", "Reading tests completed at " + plugins.localtime() + ".")
         self.notify("ActionStop")
     self.notify("AllRead", suites)
     if self.dynamic and len(suites) == 0:
         guilog.info("There weren't any tests to run, terminating...")
         self.topWindowGUI.forceQuit()
Exemplo n.º 5
0
 def notifyAllRead(self, suites):
     if not self.dynamic and self.initialApps:
         self.notify("Status", "Reading tests completed at " + plugins.localtime() + ".")
         self.notify("ActionStop", False)
     self.notify("AllRead", suites)
     for suite in suites:
         if suite.app not in self.initialApps:
             # We've added a new suite, we should also select it as it's likely the user wants to add stuff under it
             # Also include the knock-on effects, i.e. selecting the test tab etc
             self.notify("SetTestSelection", [ suite ], direct=True)
     if self.dynamic and len(suites) == 0:
         self.topWindowGUI.forceQuit()
Exemplo n.º 6
0
 def categorise(self):
     if self.failedPrediction:
         # Keep the category we had before
         self.freeText += self.getFreeTextInfo()
         return
     worstResult = self.getMostSevereFileComparison()
     if not worstResult:
         self.category = "success"
         if "save" in self.lifecycleChange:
             self.freeText = "(Saved at " + plugins.localtime("%H:%M") + ")"
     else:
         self.category = worstResult.getType()
         self.freeText = self.getFreeTextInfo()
Exemplo n.º 7
0
    def submitJob(self, test, submissionRules, command, slaveEnv):
        self.diag.info("Submitting job at " + plugins.localtime() + ":" + command)
        self.diag.info("Creating job at " + plugins.localtime())
        cmdArgs = self.getSubmitCmdArgs(test, submissionRules)
        cmdArgs.append(self.shellWrap(command))
        jobName = submissionRules.getJobName()
        self.fixDisplay(slaveEnv)
        self.diag.info("Creating job " + jobName + " with command arguments : " + repr(cmdArgs))
        self.lock.acquire()
        if self.exited:
            self.cancel(test)
            self.lock.release()
            plugins.log.info("Q: Submission cancelled for " + repr(test) + " - exit underway")
            return False
        
        self.lockDiag.info("Got lock for submission")
        queueSystem = self.getQueueSystem(test)
        try:
            process = self.createSubmitProcess(test, cmdArgs, slaveEnv)
            stdout, stderr = process.communicate()
            errorMessage = self.findErrorMessage(stderr, queueSystem)
        except OSError:
            errorMessage = "local machine is not a submit host: running '" + cmdArgs[0] + "' failed."
        if not errorMessage:
            jobId = queueSystem.findJobId(stdout)
            self.diag.info("Job created with id " + jobId)

            self.jobs.setdefault(test, []).append((jobId, jobName))
            self.lockDiag.info("Releasing lock for submission...")
            self.lock.release()
            return True
        else:
            self.lock.release()
            self.diag.info("Job not created : " + errorMessage)
            fullError = self.getFullSubmitError(test, errorMessage, cmdArgs)
            test.changeState(plugins.Unrunnable(fullError, "NOT SUBMITTED"))
            self.handleErrorState(test)
            return False
Exemplo n.º 8
0
 def startTextTestProcess(self, usecase, runModeOptions, testSelOverride=None, filterFileOverride=None):
     app = self.getCurrentApplication()
     writeDir = os.path.join(self.getLogRootDirectory(app), "dynamic_run" + str(self.runNumber))
     plugins.ensureDirectoryExists(writeDir)
     filterFile = self.createFilterFile(writeDir, filterFileOverride)
     ttOptions = runModeOptions + self.getTextTestOptions(filterFile, app, usecase)
     self.diag.info("Starting " + usecase + " run of TextTest with arguments " + repr(ttOptions))
     logFile = os.path.join(writeDir, "output.log")
     errFile = os.path.join(writeDir, "errors.log")
     BasicRunningAction.runNumber += 1
     description = "Dynamic GUI started at " + plugins.localtime()
     cmdArgs = self.getInterpreterArgs() + [ sys.argv[0] ] + ttOptions
     env = self.getNewUseCaseEnvironment(usecase)
     testsAffected = self.getTestsAffected(testSelOverride)
     guiplugins.processMonitor.startProcess(cmdArgs, description, env=env, killOnTermination=self.killOnTermination(),
                                            stdout=open(logFile, "w"), stderr=open(errFile, "w"),
                                            exitHandler=self.checkTestRun,
                                            exitHandlerArgs=(errFile,testsAffected,filterFile,usecase))
Exemplo n.º 9
0
    def __init__(self, optionMap, allApps):
        includeSite, includePersonal = optionMap.configPathOptions()
        self.readGtkRCFiles(includeSite, includePersonal)
        self.dynamic = not optionMap.has_key("gx")
        self.initialApps = self.storeInitial(allApps)
        self.interactiveActionHandler = InteractiveActionHandler(self.dynamic, allApps, optionMap)
        self.setUpGlobals(allApps, includePersonal)
        self.shortcutBarGUI = ShortcutBarGUI(includeSite, includePersonal)
        plugins.Responder.__init__(self)
        plugins.Observable.__init__(self)
        testCount = int(optionMap.get("count", 0))
        initialStatus = "TextTest started at " + plugins.localtime() + "."
        # This is perhaps not an ideal design, throwing up the application creation dialog from the middle of a constructor.
        # Would possibly be better to move this, and all the code below, to a later call
        # At the moment that would be setObservers, not fantastic as a side-effect there either
        # Perhaps an entirely new call would be needed? [GB 20130524]
        if len(allApps) == 0:
            newApp, initialStatus = self.createNewApplication(optionMap)
            allApps.append(newApp)

        self.statusMonitor = statusviews.StatusMonitorGUI(initialStatus)
        self.textInfoGUI = textinfo.TextInfoGUI(self.dynamic)
        runName = optionMap.get("name", "").replace("<time>", plugins.startTimeString())
        reconnect = optionMap.has_key("reconnect")
        self.runInfoGUI = textinfo.RunInfoGUI(self.dynamic, runName, reconnect)
        self.testRunInfoGUI = textinfo.TestRunInfoGUI(self.dynamic, reconnect)
        self.progressMonitor = statusviews.TestProgressMonitor(self.dynamic, testCount)
        self.progressBarGUI = statusviews.ProgressBarGUI(self.dynamic, testCount)
        self.idleManager = IdleHandlerManager()
        uiManager = gtk.UIManager()
        self.defaultActionGUIs, self.actionTabGUIs = self.interactiveActionHandler.getPluginGUIs(uiManager)
        self.menuBarGUI, self.toolBarGUI, testPopupGUI, testFilePopupGUI, appFilePopupGUI = self.createMenuAndToolBarGUIs(uiManager, includeSite, includePersonal)
        self.testColumnGUI = testtree.TestColumnGUI(self.dynamic, testCount)
        self.testTreeGUI = testtree.TestTreeGUI(self.dynamic, allApps, testPopupGUI, self.testColumnGUI)
        self.testFileGUI = filetrees.TestFileGUI(self.dynamic, testFilePopupGUI)
        self.appFileGUI = filetrees.ApplicationFileGUI(self.dynamic, allApps, appFilePopupGUI)
        self.rightWindowGUI = self.createRightWindowGUI()
        
        self.topWindowGUI = self.createTopWindowGUI(allApps, runName)
Exemplo n.º 10
0
 def messageAfterPerform(self):
     return self.performedDescription() + " " + self.describeTestsWithCount() + " at " + plugins.localtime() + "."
Exemplo n.º 11
0
 def getExplicitKillInfo(self):
     timeStr = plugins.localtime("%H:%M")
     return "KILLED", "killed explicitly at " + timeStr
Exemplo n.º 12
0
 def __init__(self, *args):
     guiplugins.ActionDialogGUI.__init__(self, *args)
     self.addOption("brief", "Brief text", "Checked")
     self.addOption("free", "Free text", "Checked at " + plugins.localtime())
Exemplo n.º 13
0
 def notifyAllComplete(self):
     self.text += "End time         : " + plugins.localtime() + "\n"
     self.updateView()
Exemplo n.º 14
0
 def progressText(self):
     perc = self.calculatePercentage()
     if perc is not None:
         return "\nReckoned to be " + str(perc) + "% complete by comparing total file sizes at " + plugins.localtime() + "."
     else:
         return ""
Exemplo n.º 15
0
 def getEditInfo(self, fullPath):
     # Check modified times for files and directories, targets for links
     if os.path.islink(fullPath):
         return os.path.realpath(fullPath)
     else:
         return plugins.localtime(seconds=plugins.modifiedTime(fullPath))
Exemplo n.º 16
0
 def setKilledPending(self, test, jobId):
     timeStr =  plugins.localtime("%H:%M")
     briefText = "cancelled pending job at " + timeStr
     freeText = "Test job " + jobId + " was cancelled (while still pending in " + queueSystemName(test.app) +\
                ") at " + timeStr
     self.cancel(test, briefText, freeText)
Exemplo n.º 17
0
 def getFractionMessage(self):
     if self.nofCompletedTests >= self.totalNofTests:
         completionTime = plugins.localtime()
         return "All " + str(self.totalNofTests) + " tests completed at " + completionTime
     else:
         return str(self.nofCompletedTests) + " of " + str(self.totalNofTests) + " tests completed"
Exemplo n.º 18
0
 def __str__(self):
     return self.title + plugins.localtime(format="%d%b%H:%M") + ")"