def execute(self): s = State() configlocation = self.configPath cf = ConfigParser.ConfigParser() cf.read(configlocation) parameters=cf.items("Config") for item in parameters: s.put(item[0], item[1]) #init the email tolist emailToListStr = s.get(Tasks.StaticVariables.EMAILTOLIST) emailToList = emailToListStr.split(";") s.put(Tasks.StaticVariables.EMAILTOLIST.lower(), emailToList) #init the logger logger = Logger(s.get(Tasks.StaticVariables.SERVERNAME)+"_"+s.get(Tasks.StaticVariables.BUILDNO),1) s.put(Tasks.StaticVariables.LINUXTESTLOGGER,logger) Ibuildno = raw_input("please input the build number:") if Ibuildno != "": s.put(Tasks.StaticVariables.BUILDNO,Ibuildno) Ibuildversion = raw_input("please input the build versiton(DEBUG/RELEASE):") if Ibuildno != "": s.put(Tasks.StaticVariables.BUILDVERSION,Ibuildversion.upper()) #install build on Linux inb = InstallLinuxBuildTask() Tasks.Command.displayTaskState(inb.getStat()) state = inb.execute(s) Tasks.Command.displayTaskState(inb.getStat()) if state != TaskStatus.PASS: exit() #configure dsn on Linux cld = CreateLinuxDSNTask() Tasks.Command.displayTaskState(cld.getStat()) state = cld.execute(s) Tasks.Command.displayTaskState(cld.getStat()) if state != TaskStatus.PASS: exit() #configure the performance counter and log size cnld = ConfigLinuxDiagTask() Tasks.Command.displayTaskState(cnld.getStat()) state = cnld.execute(s) Tasks.Command.displayTaskState(cnld.getStat()) if state != TaskStatus.PASS: exit() #configure iserver cus = ConfigUnixIServerTask() Tasks.Command.displayTaskState(cus.getStat()) state = cus.execute(s) Tasks.Command.displayTaskState(cus.getStat()) if state != TaskStatus.PASS: exit() #start iserver on Linux st = StartServerTask(); Tasks.Command.displayTaskState(st.getStat()) state = st.execute(s) Tasks.Command.displayTaskState(st.getStat()) # #start the test script on client. if state == TaskStatus.PASS: sct = StartClientTask() Tasks.Command.displayTaskState(sct.getStat()) sct.execute(s) Tasks.Command.displayTaskState(sct.getStat()) # monitor iserver mls = MonitorLinuxServerTask() Tasks.Command.displayTaskState(mls.getStat()) mls.execute(s) Tasks.Command.displayTaskState(mls.getStat()) #stop client stct = StopClientTask() Tasks.Command.displayTaskState(stct.getStat()) stct.execute(s) Tasks.Command.displayTaskState(stct.getStat()) # monitor iserver dlf = DownloadLogFileTask() Tasks.Command.displayTaskState(dlf.getStat()) state = dlf.execute(s) Tasks.Command.displayTaskState(dlf.getStat())
configlocation = "Config\DI\config.ini" cf = ConfigParser.ConfigParser() cf.read(configlocation) parameters=cf.items("Config") #Prepare the enviroment. #Add tasks state = State() for item in parameters: state.put(item[0], item[1]) #modify the odbc.ini and MSIReg.reg print "modifying MSIReg.reg and odbc.ini" publicMethods.ReplaceString("Config\DI\MSIReg.reg","Tmp\MSIReg.reg", "{BuildNum}",state.get(StaticVariables.BUILDNO)) publicMethods.ReplaceString("Config\DI\odbc.ini","Tmp\odbc.ini", "{BuildNum}", state.get(StaticVariables.BUILDNO)) strSourceFiles= str(os.path.join(os.getcwd(),"Tmp\odbc.ini"))+";"+str(os.path.join(os.getcwd(), "Tmp\MSIReg.reg")) strUploadedFolder=os.path.join(state.get(StaticVariables.BUILDINSTALLPATH),state.get(StaticVariables.BUILDNO),state.get(StaticVariables.BUILDVERSION),"BIN",state.get(StaticVariables.OS)).replace("\\","/") state.put(StaticVariables.SOURCEFILES, strSourceFiles) state.put(StaticVariables.UPLOADFOLDER, strUploadedFolder)
3. check JMeter script and try 4. run JMeter jobs 5. collect test result ''' if __name__ == "__main__": print "Start Benchmark test ......" configlocation = sys.argv[1] cf = ConfigParser.ConfigParser() cf.read(configlocation) parameters=cf.items("Config") s = State() for item in parameters: s.put(item[0], item[1]) tasks=[]; tasks.append(InstallLinuxBuildTask()) tasks.append(CreateLinuxDSNTask()) tasks.append(ConfigLinuxDiagTask()) tasks.append(ConfigUnixIServerTask()) tasks.append(StartServerTask()) tasks.append(StopServerTask()) tasks.append(CopyCacheTask()) tasks.append(TuneSmartHeapTask()) tasks.append(ClearSysCacheTask()) tasks.append(StartServerTask())
def execute(self): #get all config files self.getAllConfigFiles(self.configPath) #start each node in cluster stateList = [] for cfl in self.configList: s = State() configlocation = cfl cf = ConfigParser.ConfigParser() cf.read(configlocation) parameters=cf.items("Config") for item in parameters: s.put(item[0], item[1]) #init the email tolist emailToListStr = s.get(Tasks.StaticVariables.EMAILTOLIST) emailToList = emailToListStr.split(";") s.put(Tasks.StaticVariables.EMAILTOLIST.lower(), emailToList) #init the logger logger = Logger(s.get(Tasks.StaticVariables.SERVERNAME)+"_"+s.get(Tasks.StaticVariables.BUILDNO),1) s.put(Tasks.StaticVariables.LINUXTESTLOGGER,logger) stateList.append(copy.deepcopy(s)) #install build on Linux inb = InstallLinuxBuildTask() Tasks.Command.displayTaskState(inb.getStat()) state = inb.execute(s) Tasks.Command.displayTaskState(inb.getStat()) if state != TaskStatus.PASS: exit() #configure dsn on Linux cld = CreateLinuxDSNTask() Tasks.Command.displayTaskState(cld.getStat()) state = cld.execute(s) Tasks.Command.displayTaskState(cld.getStat()) if state != TaskStatus.PASS: exit() #configure the performance counter and log size cnld = ConfigLinuxDiagTask() Tasks.Command.displayTaskState(cnld.getStat()) state = cnld.execute(s) Tasks.Command.displayTaskState(cnld.getStat()) if state != TaskStatus.PASS: exit() #configure iserver cus = ConfigUnixIServerTask() Tasks.Command.displayTaskState(cus.getStat()) state = cus.execute(s) Tasks.Command.displayTaskState(cus.getStat()) if state != TaskStatus.PASS: exit() #start iserver on Linux st = StartServerTask(); Tasks.Command.displayTaskState(st.getStat()) state = st.execute(s) Tasks.Command.displayTaskState(st.getStat()) if state != TaskStatus.PASS: exit() #cluster nodes try: self.client = Tasks.Command.getConnect(stateList[0].get(Tasks.StaticVariables.SERVERNAME), stateList[0].get(Tasks.StaticVariables.SERVERLOGIN), stateList[0].get(Tasks.StaticVariables.SERVERPASSWORD)) except Exception, e: #print "connect fialed" self.info = "cannot connect to remote Linux machine." + str(e) self.info = self.info+"machine:"+stateList[0].get(Tasks.StaticVariables.SERVERNAME)+ "\nlogin:"******"\npwd:"+stateList[0].get(Tasks.StaticVariables.SERVERPASSWORD) print self.info stateList[0].get(Tasks.StaticVariables.LINUXTESTLOGGER).log(self.info) exit()
from Tasks.StopClientTask import StopClientTask from Tasks.Task import State from Tasks.Task import TaskStatus from Utils.Logger import Logger import Tasks.Command import time import rpyc import Tasks.StaticVariables import json import sys import xml.dom.minidom import ConfigParser if __name__ == '__main__': s = State() configlocation = "Config\config.ini" cf = ConfigParser.ConfigParser() cf.read(configlocation) parameters=cf.items("Config") for item in parameters: s.put(item[0], item[1]) #init the email tolist # emailToListStr = s.get(Tasks.StaticVariables.EMAILTOLIST) # emailToList = emailToListStr.split(";") # s.put(Tasks.StaticVariables.EMAILTOLIST.lower(), emailToList) # #init the logger # logger = Logger(s.get(Tasks.StaticVariables.SERVERNAME)+"_"+s.get(Tasks.StaticVariables.BUILDNO),1) # s.put(Tasks.StaticVariables.LINUXTESTLOGGER,logger)
from Tasks.StopClientTask import StopClientTask from Tasks.Task import State from Tasks.Task import TaskStatus from Utils.Logger import Logger import Tasks.Command import time import rpyc import Tasks.StaticVariables import json import sys import xml.dom.minidom import ConfigParser if __name__ == '__main__': s = State() configlocation = "Config\config.ini" cf = ConfigParser.ConfigParser() cf.read(configlocation) parameters=cf.items("Config") for item in parameters: s.put(item[0], item[1]) #init the email tolist emailToListStr = s.get(Tasks.StaticVariables.EMAILTOLIST) emailToList = emailToListStr.split(";") s.put(Tasks.StaticVariables.EMAILTOLIST.lower(), emailToList) #init the logger logger = Logger(s.get(Tasks.StaticVariables.SERVERNAME)+"_"+s.get(Tasks.StaticVariables.BUILDNO),1) s.put(Tasks.StaticVariables.LINUXTESTLOGGER,logger)