def run(self):
     print 'ThumbPerfReady run'
     
     from QMSWebService import QMSWebService
     qmsWS = QMSWebService()
     self.logger.info('The machine is get ready for Thumb Performance Testing')
     
     if 'appBuild' in self.parameter.keys() and self.parameter['appBuild'].strip() != '':
         appBuild = self.parameter['appBuild']
     else:
         appBuild = globalProperty.getLatestBuildNum('Bridge',
                                                     '4.0',
                                                     globalProperty.getPlatform(),
                                                     'mul',
                                                     'Build Failed')
         
     qmsWS.kickOffTestwerkThumbPerfTest(
                                        self.parameter['kickOffMachineAddress'], 
                                        self.macAddress, 
                                        self.parameter['caseType'], 
                                        self.parameter['testType'], 
                                        self.parameter['appVersion'], 
                                        self.parameter['sendResult'], 
                                        appBuild)
     return
Exemple #2
0
    def __prepareLauncher(self):
        if "buildNum" in self.parameter and self.parameter["buildNum"] != None:
            self.buildNum = self.parameter["buildNum"]
        else:
            from AppInstall import childTask

            task = childTask("appInstall")
            task.addPara("appName", "Photoshop")
            task.addPara("appVer", self.parameter["ProductVersion"])
            task.addPara("appSubProduct", "Application")
            self.buildNum = task._getInstalledBuildNum()

        if self.buildNum != "" and self.buildNum != None:
            pass
        elif "molecule" in self.parameter:
            moleculeReStr = "\d{8}\." + self.parameter["molecule"] + "\.\d{1,}"
            from CodexTask import childTask

            task = childTask("codexTask")
            self.buildNum = "unknown"
            builds = task.getBuilds(
                "Photoshop",
                self.parameter["ProductVersion"],
                "Molecule",
                "Release",  # CompileTarget
                self.platform,
                globalProperty.getSysInfo().locale,
                "Build Failed",
            )
            if builds == None:
                return None

            latestBuildLocation = None
            for build in builds:
                if re.match(moleculeReStr, build._build):
                    latestBuildLocation = (
                        build._location["protocol"] + "://" + build._location["server"] + build._location["path"]
                    )

                    self.buildNum = build._build
                    break
        else:
            if globalProperty.isMachineOutOfChina():
                # Support the machine out of China, will download directly
                from CodexTask import childTask

                task = childTask("codexTask")
                latestBuild = task.getBuild(
                    "Photoshop",
                    self.parameter["ProductVersion"],
                    "Release",  # CompileTarget
                    self.platform,
                    globalProperty.getSysInfo().locale,
                    "Build Failed",
                )
                if latestBuild == None:
                    return None

                self.buildNum = latestBuild._build
            else:
                self.buildNum = globalProperty.getLatestBuildNum(
                    "Photoshop",
                    self.parameter["ProductVersion"],
                    self.platform,
                    globalProperty.getSysInfo().locale,
                    "Build Failed",
                    "Application",
                )
        if "sendReport" in self.parameter and self.parameter["sendReport"] != None:
            self.sendReport = self.parameter["sendReport"]
        else:
            self.sendReport = "No"

        user = globalProperty.getUser()
        if user == None:
            defaultTo = "*****@*****.**"
        else:
            defaultTo = "*****@*****.**" % user

        if "sendReportTo" in self.parameter and self.parameter["sendReportTo"] != None:
            self.sendReportTo = self.parameter["sendReportTo"]
        else:
            self.sendReportTo = defaultTo

        if "specifyLocation" in self.parameter and self.parameter["specifyLocation"] != None:
            self.specifyLocation = self.parameter["specifyLocation"]
        else:
            self.specifyLocation = ""

        import platform

        self.hostname_psf = platform.node()

        # Due to PSF bug, the version 12.0 must be set as 12.0.0, so add a workaround here
        productVersionTmp = self.parameter["ProductVersion"]
        if re.match("^\d{1,2}\.\d{1,3}$", productVersionTmp.lower()):
            productVersionTmp += ".0"

        if os.name == "posix":
            if not (os.path.exists(os.path.join(self.userHome, "Desktop"))):
                os.makedirs(os.path.join(self.userHome, "Desktop"))
            self.launcherFileName += ".sh"
            self.launcherFilePath = os.path.join(self.userHome, "Desktop", self.launcherFileName)
            inputStr = "#!/bin/sh\n"
            inputStr += "chmod +x %s/psf_launcher\n" % self.psfHome
            inputStr += "chmod +x %s/config/utils/TestFilesDownloader\n" % self.psfHome
            inputStr += (
                '%s/psf_launcher "%s" "%s" "%s" "%s" "%s" "%s" "%s" "1" "%s" "1" "" "%s" "" "" "" "" "%s" "%s" "%s" "%s" "%s" "%s"\n'
                % (
                    self.psfHome,
                    self.parameter["ProductTested"],
                    self.parameter["BuildConfig"],
                    self.buildNum,
                    globalProperty.getSysInfo().locale,
                    globalProperty.getSysInfo().locale,
                    self.parameter["SuiteSelected"],
                    self.parameter["SendResult"],
                    self.hostname_psf,
                    productVersionTmp,
                    self.parameter["PSFController"],
                    self.parameter["LDAPUser"],
                    self.downloadFileFlag,
                    self.specifyLocation,
                    self.sendReport,
                    self.sendReportTo,
                )
            )

            self.creatFile(self.launcherFilePath, inputStr)

            # Add execution

            self.runCommand("chmod +x %s" % self.launcherFilePath)

        elif os.name == "nt":
            if not (os.path.exists(os.path.join(self.userHome, "Desktop"))):
                os.makedirs(os.path.join(self.userHome, "Desktop"))
            self.launcherFileName += ".cmd"
            self.launcherFilePath = os.path.join(self.userHome, "Desktop", self.launcherFileName)
            inputStr = "cd /d %s\n" % self.psfHome
            buildConfig = self.parameter["BuildConfig"]
            if re.match(".*_32bt_.*", buildConfig):
                inputStr += "Call psf_launcher32.exe "
            else:
                inputStr += "Call psf_launcher.exe "
            inputStr += (
                '"%s" "%s" "%s" "%s" "%s" "%s" "%s" "1" "%s" "1" "" "%s" "" "" "" "" "%s" "%s" "%s" "%s" "%s" "%s"\n'
                % (
                    self.parameter["ProductTested"],
                    self.parameter["BuildConfig"],
                    self.buildNum,
                    globalProperty.getSysInfo().locale,
                    globalProperty.getSysInfo().locale,
                    self.parameter["SuiteSelected"],
                    self.parameter["SendResult"],
                    self.hostname_psf,
                    productVersionTmp,
                    self.parameter["PSFController"],
                    self.parameter["LDAPUser"],
                    self.downloadFileFlag,
                    self.specifyLocation,
                    self.sendReport,
                    self.sendReportTo,
                )
            )
            # Following statement should not be called
            # inputStr += "Call cmd"
            self.creatFile(self.launcherFilePath, inputStr)
 def __getLatestBuildNumber(self):
     if 'buildNum' in self.parameter and self.parameter['buildNum'] != None:
         self.buildNum = self.parameter['buildNum']
     else:
         import AppInstall
         task = AppInstall.childTask('appInstall')
         task.addPara('appName', 'Photoshop')
         task.addPara('appVer', self.parameter['ProductVersion'])
         task.addPara('appSubProduct', 'Application')
         self.buildNum = task._getInstalledBuildNum()
         
     if self.buildNum!="" and self.buildNum!=None:
         pass
     elif 'molecule' in self.parameter:
         moleculeReStr = "\d{8}\." + self.parameter['molecule'] + "\.\d{1,}"
         from CodexTask import childTask
         task = childTask('codexTask')
         self.buildNum = "unknown"
         builds = task.getBuilds(
                                 'Photoshop',
                                 self.parameter['ProductVersion'],
                                 "Molecule",
                                 "Release", #CompileTarget
                                 self.platform,
                                 globalProperty.getSysInfo().locale,
                                 'Build Failed')
         if builds==None:
             return None
             
         latestBuildLocation = None
         for build in builds:
             if re.match(moleculeReStr, build._build):
                 latestBuildLocation = build._location['protocol'] + "://" + \
                                       build._location['server'] + \
                                       build._location['path']
             
                 self.buildNum = build._build
                 break
     else:
         if globalProperty.isMachineOutOfChina():
             #Support the machine out of China, will download directly
             import CodexTask
             task = CodexTask.childTask('codexTask')
             latestBuild = task.getBuild(
                                   'Photoshop',
                                   self.parameter['ProductVersion'],
                                   "Release", #CompileTarget
                                   self.platform,
                                   globalProperty.getSysInfo().locale,
                                   'Build Failed')
             if latestBuild==None:
                 return None
             
             self.buildNum = latestBuild._build
         else:
             self.buildNum = globalProperty.getLatestBuildNum('Photoshop',
                                                              self.parameter['ProductVersion'],
                                                              self.platform,
                                                              globalProperty.getSysInfo().locale,
                                                              'Build Failed',
                                                              'Application')