CN105045707A - Python-based server stability test method - Google Patents

Python-based server stability test method Download PDF

Info

Publication number
CN105045707A
CN105045707A CN201510438472.XA CN201510438472A CN105045707A CN 105045707 A CN105045707 A CN 105045707A CN 201510438472 A CN201510438472 A CN 201510438472A CN 105045707 A CN105045707 A CN 105045707A
Authority
CN
China
Prior art keywords
std
conf
self
check
perf
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201510438472.XA
Other languages
Chinese (zh)
Inventor
张文珂
贾岛
罗强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur Electronic Information Industry Co Ltd
Original Assignee
Inspur Electronic Information Industry Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur Electronic Information Industry Co Ltd filed Critical Inspur Electronic Information Industry Co Ltd
Priority to CN201510438472.XA priority Critical patent/CN105045707A/en
Publication of CN105045707A publication Critical patent/CN105045707A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention provides a method for testing stability of a server based on Python. The test method mainly comprises three parts of configuration detection, performance test and log arrangement; after the command of operating the main program is input, the main program firstly calls a module for detecting configuration, the module loads a corresponding detection program and a configuration file, then performance test is carried out, and each step of execution generates a corresponding log. The server stability testing method is suitable for all single-power or dual-power servers, the testing process on the servers is stable, and the testing task can be well completed. The operation is simple, the result is clear, the testing time is greatly saved, and the testing efficiency is improved.

Description

A kind of method based on Python server stability test
Technical field
The present invention relates to a kind of method of server stability test, specifically a kind of method based on Python server stability test.
Background technology
Along with the fast development of server industries, increasing client starts to be partial to buy the core application of large batch of server as oneself.So it is also proposed higher requirement to the stability of server, and can server keep normal running, and can become Client application the prerequisite of stable operation.
Server stability is most important, if can not ensure the needs of service operation in stability, is also useless in high performance.Regular manufacturer server all can wake up with a start the operation stability test under different temperatures and humidity to product.Emphasis is wanted it is considered that redundancy feature, as: data redundancy, network interface card honor, power supply redundancy, fan redundancy etc.
Some method of testings are mainly divided following several:
Pressure test: known system peak period number of users, verifies that each affairs transaction response time under maximum number of concurrent (being converted by peak period number) can reach customer requirement.Whether each performance index of system are under such pressure also within regime values.Whether system can cause bad reaction (as: machine of delaying, application abort etc.) because of such pressure.
Stability test: known system peak period number of users, each transaction operation frequency etc.Design synthesis test scene, runs according to certain people's percentage together by each scene during test, and analog subscriber uses the situation of several years.And monitoring in testing, whether each performance index of system can keep regime values under such pressure.Whether the transaction response time there will be fluctuates or rises with the test duration and increase.Whether system can occur as abnormal conditions such as machine of delaying, application termination in test period.
Summary of the invention
Technical assignment of the present invention is for the deficiencies in the prior art, provides a kind of method based on Python server stability test.This method of testing passes through detection and the pressure test of test configurations, effectively tests server stability.
The technical solution adopted for the present invention to solve the technical problems is:
Based on a method for Python server stability test, it is characterized in that, this method of testing is mainly divided into configuration detection, performance test and arrangement daily record three part; After input runs the order of master routine, first master routine can call the module detecting configuration, and this module can load corresponding trace routine and configuration file, then carries out performance test, and each step performs and produces corresponding daily record.
Type is have recorded, the relevant options of the FW of bios and bmc, bios, the information such as the model quantity of internal memory, CPU, HDD, SSD and Raid card in configuration file.After input command, trace routine first can detect existing bios, bmc of tested server and the information of hardware configuration, and contrasts with configuration file, if inconsistent, then stops test process, display test crash.If information is consistent, then proceed performance test.
Performance test is realized by master routine invocation performance test module, and this program is by running fio, Geekbench21 and Stressapptest tri-instruments, and respectively to hard disk, CPU and internal memory carry out applied voltage test, record related data.The minimum standard of the related data realizing the hard disk, CPU, internal memory and the SSD that set is had in program, then contrast with the data set in advance testing the data obtained, if the data of setting can be reached, then show true, do not reach and just show false.
Arrange log portion and completely all can produce corresponding daily record in each step, final step arranges these daily records exactly, obtains the result that we need.
A kind of method based on Python server stability test of the present invention compared with prior art, the beneficial effect produced is, set configuration file and performance data in advance, as long as the order that input runs, just tested server is detected and tested, and the result obtained and the carrying out arranged in advance are contrasted, the Output rusults met the demands, represents by test, if do not meet the demands, then stop test, display reports an error.
Accompanying drawing explanation
Accompanying drawing 1 is file system assumption diagram of the present invention;
Accompanying drawing 2 is program flow chart of the present invention.
Embodiment
Below in conjunction with accompanying drawing 1, accompanying drawing 2, a kind of method based on Python server stability test of the present invention is described in detail below.
Based on a method for Python server stability test, it is characterized in that, this method of testing is mainly divided into configuration detection, performance test and arrangement daily record three part; After input runs the order of master routine, first master routine can call the module detecting configuration, and this module can load corresponding trace routine and configuration file, then carries out performance test, and each step performs and produces corresponding daily record.
Master routine is as follows:
#!/usr/bin/python
"""
"""
# imports the environment that program is run
importos
importjson
importshutil
importoptparse
importcPickleaspickle
# calls confcheck.py program
fromconfcheckimportConfCheck
# calls perfcheck.py program
fromperfcheckimportPerfCheck
The program module of needs is imported under the comm file of # from routine package under lib
fromlib.comm.gparasimportgparas
fromlib.comm.logtraceimportLogFile
fromlib.comm.logtraceimportLogInfo
fromlib.comm.commonapiimportSafeApi
# imports the program module of needs from routine package under lib file
fromlib.getmachineinfoimportCardInfo
fromlib.getmachineinfoimportHbaCard
fromlib.checkiofwimportCheckIoFw
ClassMachCheck (object): # defines a class function
Def__init__ (self, purTime, machModel, purPackage): # to the time, and the variablees such as the set meal of type and test define
Logfile=" ./mcheck.log " # defines relevant log file
ifos.path.exists(logfile):
Os.remove (logfile) if there is this log file in # system, then carries out the action of deleting
Relevant information in configuration file is imparted to dependent variable by #
self.purTime=purTime
self.machModel=machModel
self.purPackage=purPackage
logfile=LogFile(logfile)
self.log=LogInfo(logfile)
self.safeapi=SafeApi(self.log)
self.safe_run=self.safeapi.safe_run
self.safe_split=self.safeapi.s_split
Above standard information exports by self.std_output={}#
self._start_hmonitor()
def_get_tool(self):
Commands=" unzip-o-Phrmbaidutool/tool.zip-dtool " # carries out decompress(ion) to kit
self.safe_run(commands)
ifos.path.exists("tool/common-tool"):
self.log.msg("zipsucess")
else:
Self.log.msg (" zipfailed ") if # detects in system there is tool file, then records decompress(ion) success in log, otherwise then records decompress(ion) failure
defdel_tool(self):
try:
shutil.rmtree("tool/common-tool")
shutil.rmtree("tool/hdoctor")
shutil.rmtree("tool/hmonitor")
shutil.rmtree("tool/spec-tool")
except:
self.log.msg("rmtoolerror")
Pass# recurrence deletes all the things inside assigned catalogue and catalogue, if not there is deletion error, then and pass
defcheck_conf(self):
#command="./confcheck.py-j%s"%(json_list)
#(ret,output)=self.safe_run(command,200)
#forlineinoutput:
#line=line.strip()
#ifnotline:continue
#self.log.msg(line)
#printline
(ret,cur_path)=self.safe_run("pwd")
conf_check=ConfCheck()
conf_check.get_std_conf(self.purTime,self.machModel,self.purPackage)
conf_check.get_conf()
conf_check.check_conf("all")
conf_check.print_conf()
Information in the information grabbed and configuration file contrasts, and comparing result is exported by tmp_output=conf_check.std_output (" all ") #
Os.chdir (cur_path [0]) # changes working directory to cur_path [0]
check_flag=0
foriintmp_output:
self.std_output[i]=tmp_output[i]
if'OK'notinself.std_output[i]:
check_flag=-1
The value that returncheck_flag# arranges flag is 0, and define a variable i, and contrast with standard value, if variable is not inside standard value, then the value of flag becomes-1, and returns.
defcheck_perf(self):
#command="./perfcheck.py-j%s"%(json_list)
#(ret,output)=self.safe_run(command,3000)
#forlineinoutput:
#line=line.strip()
#ifnotline:continue
#self.log.msg(line)
#printline
(ret,cur_path)=self.safe_run("pwd")
perf_check=PerfCheck()
perf_check.get_std_perf(self.purTime,self.machModel,self.purPackage)
perf_check.run_perf()
perf_check.get_perf()
perf_check.check_perf()
perf_check.print_perf()
Information in the information grabbed and configuration file contrasts by tmp_output=perf_check.std_output () #, and comparing result is exported
foriintmp_output:
self.std_output[i]=tmp_output[i]
Os.chdir (cur_path [0]) # changes working directory to cur_path [0]
def_start_hmonitor(self):
(ret,cur_path)=self.safe_run("pwd")
conf_check=ConfCheck()
conf_check.get_std_conf(self.purTime,self.machModel,self.purPackage)
os.chdir(cur_path[0])
(ret,cur_path)=self.safe_run("pwd")
perf_check=PerfCheck()
perf_check.get_std_perf(self.purTime,self.machModel,self.purPackage)
os.chdir(cur_path[0])
in_dict=dict(conf_check.check_item["machInfo"].std_conf)
in_dict.update(perf_check.check_item["extraPerf"].std_perf)
self._start_monitor_plus(in_dict)
command="tool/hmonitor/hmonitor-bg/NOAH/controlstart"
self.safe_run(command)
def_start_monitor_plus(self,input_dict):
ifnot(input_dict.has_key('machModel')and\
input_dict.has_key('bmcInfoValid')and\
input_dict.has_key('fanSpeedMin')and\
input_dict.has_key('fanSpeedMax')and\
input_dict.has_key('cpuTempMax')and\
input_dict.has_key('cpuTempMin')and\
input_dict.has_key('machPowerMax')):
print'errorerror!!!!!!!!!!cannotstartmonitor_plus'
raise()
return
tmp_dict={}
importbase64
model=base64.encodestring(input_dict['machModel'])
tmp_dict["model"]="%s"%model
tmp_dict["bmc"]="%s"%input_dict['bmcInfoValid']
tmp_dict["fan"]=(input_dict['fanSpeedMin'],input_dict['fanSpeedMax'])
tmp_dict["cpu"]=(input_dict['cpuTempMin'],input_dict['cpuTempMax'])
tmp_dict["power_max"]="%s"%input_dict['machPowerMax']
str_dict=str(json.dumps(tmp_dict))
command="nohup%s-i'%s'>tmp_bmc.log2>&1&"%(gparas.monitor_plus,str_dict)
os.system(command)
def_stop_monitor_plus(self):
command="killall-9do_check.py"
(ret, output)=self.safe_run (command, 100) # runs one week after date to be terminated
def_check_hmonitor(self):
conf_list=["conf_raid","conf_noraid"]
conf_dir="tool/hmonitor/hmonitor-fg/"
com_file="tool/hmonitor/hmonitor-fg/main"
foriinconf_list:
conf_file=os.path.join(conf_dir,i)
command="%s%s"%(com_file,conf_file)
(ret,output)=self.safe_run(command)
forlineinoutput:
line=line.strip()
ifnotline:continue
self.log.msg(line)
if'Version'inline:continue
items=line.split(":")
iflen(items)==2:
self.std_output[items[0].strip()]=items[1].strip()
#printline# detects with or without information such as Raid, judges rear output
def_stop_hmonitor(self):
command="tool/hmonitor/hmonitor-bg/NOAH/controlstop"
self.safe_run(command)
Self._stop_monitor_plus () # terminates this program after detecting
def_check_hdd_fault(self):
hdoctor_file="tool/hdoctor/hdoctor"
hdd_list=self._get_hdd_list()
foriinhdd_list:
command="%s-t%s"%(hdoctor_file,i)
(ret,output)=self.safe_run(command,100)
ifret!=0:
self.log.msg("hdoctor%sFAIL%sNULLNULLtimeoutNULLNULL"%(i,i))
else:
forlineinoutput:
line=line.strip()
ifnotline:continue
self.log.msg("hdoctor"+line)
def_get_hdd_list(self):
dev_list=[]
base_card=CardInfo(self.log)
base_card.getmanu()
ifbase_card.manunotin["pmc","lsi"]:
card=HbaCard(self.log)
card.getpdinfo()
pd_info=card.pdinfo
foriinpd_info:
dev_point=pd_info[i]["name"]
dev_list.append(dev_point)
returndev_list
def_gen_result(self,line):
f=open("./check_result","w")
f.write(line)
F.close () # checks the relevant information of hard disk and outer plug-in card, is write check_result after judging
defgen_log(self):
importglob
ifnotos.path.exists("./machcheck.log.swf"):
f=open("./machcheck.log.swf","w")
f.close()
f=open("./machcheck.log.swf","a+")
#all_file=glob.glob("*check*.log")
all_file=glob.glob("*.log")
forlineinall_file:
tmp_file=open(line,"r")
allinfo=tmp_file.readlines()
f.write("-------%s-------\n"%(line))
forinfoinallinfo:
f.write(info)
tmp_file.close()
Os.remove (line) # arranges log daily record, and unnecessary file is deleted
f.close()
defcheck_fault(self):
self._check_hmonitor()
self._stop_hmonitor()
self._check_hdd_fault()
hd_status=["CpuStatus","MemoryStatus","FlashStatus",
"RaidCardStatus","RaidCardVdStatus",
"RaidCardPdStatus"]
f=open("./mcheck.log")
allinfo=f.readlines()
f.close()
repair_err_list=[]
forlineinallinfo:
line=line.strip()
ifnotline:continue
foriteminhd_status:
ifline.find("hdoctor")>=0:
hd_status=self.safe_split(line,"",4)
ifhd_status=="FAIL":
try:
hd_err_desc=self.safe_split(line,"",8)
hd_err_slot=self.safe_split(line,"",5)
except:
hd_err_desc="err"
hd_err_slot="-1"
tmp_key="%s#%s#%s"%(hd_err_slot,hd_status,hd_err_desc)
iftmp_keynotinrepair_err_list:
repair_err_list.append(tmp_key)
self._gen_result(line)
elifline.find(item)>=0:
ifline.find("Error#")>=0:
self.std_output[item]='FAIL;%s'%(line.split(':')[-1])
self._gen_result(line)
else:
continue
ifrepair_err_list:
self.std_output["RepairStatus"]='FAIL;%s'%(';'.join(repair_err_list))
extra_err_list=[]
ifos.path.exists('/tmp/__check.log'):
tmp_list=[]
tmp_dict=pickle.load(file('/tmp/__check.log','rb'))
forkeyintmp_dict:
info=tmp_dict[key]
#extra_err_list.append('%s%s'%(key,info))
extra_err_list.append('%s'%info)
#fp.write('FAIL:%s'%(';'.join(tmp_list)))
os.system("rm-rf/tmp/__check.log")
check_ops=CheckIoFw()
check_ops.do_check()
ifcheck_ops.hdd_fw_list:
forhdd_fwincheck_ops.hdd_fw_list:
if'be27'inhdd_fw.lower()or'be27'<=hdd_fw.lower():
extra_err_list.append('hddFwErr%s'%hdd_fw)
ifextra_err_list:
self.std_output["MachExtraError"]='FAIL;%s'%(';'.join(extra_err_list))
The CPU that returnTrue# will detect, the essential information of this test configurations a series of such as internal memory and hard disk, and contrast with the carrying out in configuration file, if different, then export error, just export true if the same
if__name__=="__main__":
The version number of VERSION='Version:# test procedure
opt_parse=optparse.OptionParser(version="1.0")
#opt_parse.add_option("--test","-t",default="all",help="Checksometing")
#opt_parse.add_option("--config_file","-c",default="./conf/main.conf",help="Configfile")
opt_parse.add_option("--json_list","-j",default="",help="jsonlistcontainsparas")
Opt_parse.add_option ("--time ", "-t ", default=10, help=" runningtime ") // this function is for adding command-line option
(options,argument)=opt_parse.parse_args()
chk_opt=options.json_list
try:
run_time=int(options.time)
except:
run_time=0
ifrun_time<4:
print"runtimemustbemore"
raise()
avg_time=run_time/4
f=open(".time.tmp","w")
f.write(str(avg_time))
The time that f.close () # established procedure runs, and write time.tmp
forlineinopen('VERSION'):
line=line.strip()
ifline:
VERSION+=line
break
PrintVERSION# program brings into operation, and exports version number
ifchk_opt!="":
json_obj=json.loads(chk_opt)
ifisinstance(json_obj,dict)and\
json_obj.has_key("purTime")and\
json_obj.has_key("machModel")and\
json_obj.has_key("purPackage"):
purTime=json_obj["purTime"]
machModel=json_obj["machModel"]
purPackage=json_obj["purPackage"]
mach_check=MachCheck(purTime,machModel,purPackage)
ret=mach_check.check_conf()
ifnotret:
mach_check.check_perf()
ret=mach_check.check_fault()
#printjson.dumps(mach_check.std_output)
forlineinmach_check.std_output:
printline,':',mach_check.std_output[line]
mach_check.gen_log()
#mach_check.del_tool()
else:
print"paraserror"
else:
Print " noparas " #isinstance is a built-in function in Python, if parameter json_obj is the example of dict, or json_obj is an example of the subclass of dict class, returns paraserror.If json_obj be not a given type object, then returning results is noparas.
Type is have recorded, the relevant options of the FW of bios and bmc, bios, the information such as the model quantity of internal memory, CPU, HDD, SSD and Raid card in configuration file.After input command, trace routine first can detect existing bios, bmc of tested server and the information of hardware configuration, and contrasts with configuration file, if inconsistent, then stops test process, display test crash.If information is consistent, then proceed performance test.
Configuration detection module:
#!/usr/bin/python
"""
"""
importos
importoptparse
# calls the program module in the comm file under lib
fromlib.comm.logtraceimportLogFile
fromlib.comm.logtraceimportLogInfo
fromlib.comm.logtraceimportgparas
fromlib.machconfimportMachConf
fromlib.cpuconfimportCpuConf
fromlib.memconfimportMemConf
fromlib.fwconfimportFwConf
fromlib.biosconfimportBiosConf
fromlib.hddconfimportHddConf
fromlib.ssdconfimportSsdConf
fromlib.flashconfimportFlashConf
fromlib.raidconfimportRaidConf
fromlib.netconfimportNetConf
fromlib.bmcconfimportBmcConf
fromlib.armconfcheckimportArmConfCheck
classConfCheck(object):
def__init__(self):
logfile="./ccheck.log"
logfile=LogFile(logfile)
self.log=LogInfo(logfile)
self.check_item={"machInfo":MachConf(),
"cpuInfo":CpuConf(),
"memInfo":MemConf(),
"fwInfo":FwConf(),
"biosInfo":BiosConf(),
"hddInfo":HddConf(),
"ssdInfo":SsdConf(),
"flashInfo":FlashConf(),
"raidInfo":RaidConf(),
"netInfo":NetConf(),
"bmcInfo":BmcConf()}
self.dev_item={"machine":"machInfo",
"cpu":"cpuInfo",
"memory":"memInfo",
"firmware":"fwInfo",
"bios":"biosInfo",
"harddisk":"hddInfo",
"ssd":"ssdInfo",
"flash":"flashInfo",
"raid":"raidInfo",
"net":"netInfo",
"bmc":"bmcInfo"}
defget_conf(self):
foriinself.check_item:
self.log.msg(i)
Self.check_item [i] .get_conf () # detects the essential information of test configurations, and is given certain variable
# is according to the time of input, and the configuration file that the acquisition of informations such as type are corresponding, extracts the content of the inside
defget_std_conf(self,pur_time,mach_model,pur_package):
std_conf={}
std_conf["machManu"]="lsy"
std_conf["machModel"]="lsy"
std_conf["machInfo"]="lsy"
self.check_item["machInfo"].get_std_conf(std_conf)
std_conf={}
std_conf["cpuNum"]=12
std_conf["cpuModel"]="lsy"
std_conf["cpuFreq"]="lsy"
self.check_item["cpuInfo"].get_std_conf(std_conf)
std_conf={}
std_conf["memNum"]=34
std_conf["memModel"]="lsy"
std_conf["memCap"]="lsy"
self.check_item["memInfo"].get_std_conf(std_conf)
std_conf={}
std_conf["Number"]=1
std_conf["turbo"]="lsy"
std_conf["pstate"]="lsy"
std_conf["cstate"]="lsy"
std_conf["c1e"]="lsy"
std_conf["ht"]="lsy"
std_conf["vt"]="lsy"
std_conf["numa"]="lsy"
std_conf["hwprefetch"]="lsy"
std_conf["adjprefetch"]="lsy"
std_conf["powermode"]="lsy"
std_conf["qpispped"]="lsy"
std_conf["ddrspeed"]="lsy"
std_conf["poweonboot"]="lsy"
std_conf["ncsimode"]="lsy"
std_conf["terminaltype"]="lsy"
std_conf["bitspersecond"]="lsy"
std_conf["databits"]="lsy"
std_conf["parity"]="lsy"
std_conf["stopbits"]="lsy"
self.check_item["biosInfo"].get_std_conf(std_conf)
std_conf={}
std_conf["raidNum"]=18
std_conf["raidModel"]="lsy"
std_conf["raidVdNum"]="lsy"
std_conf["raidType"]="lsy"
std_conf["raidBbu"]="lsy"
self.check_item["raidInfo"].get_std_conf(std_conf)
std_conf={}
std_conf["hddNum"]=121
std_conf["hddModel"]="lsy"
std_conf["hddCap"]="lsy"
self.check_item["hddInfo"].get_std_conf(std_conf)
std_conf={}
std_conf["ssdNum"]=121
std_conf["ssdModel"]="lsy"
std_conf["ssdCap"]="lsy"
self.check_item["ssdInfo"].get_std_conf(std_conf)
std_conf={}
std_conf["flashNum"]=19
std_conf["flashModel"]="lsy"
std_conf["flashCap"]="lsy"
self.check_item["flashInfo"].get_std_conf(std_conf)
std_conf={}
std_conf["Number"]=1
std_conf["mboardVer"]="lsy"
std_conf["biosVer"]="lsy"
std_conf["sasVer"]="lsy"
std_conf["bmcVer"]="lsy"
std_conf["netVer"]="lsy"
self.check_item["fwInfo"].get_std_conf(std_conf)
conf_dir="./conf"
conf_file="%s_%s_%s.conf"%(pur_time,mach_model,pur_package)
conf_file=os.path.join(conf_dir,conf_file)
ifos.path.exists(conf_file):
f=open(conf_file)
allinfo=f.readlines()
f.close()
component="machInfo"
forlineinallinfo:
line=line.strip()
ifnotline:continue
ifline.startswith("#"):continue
ifline.startswith("[")andline.endswith("]"):
component=line.lstrip("[").rstrip("]")
else:
items=line.split(":")
iflen(items)!=2:continue
self.check_item[component].get_std_item(items[0].strip(),items[1].strip())
else:
print"conffilenotexist"
raise()
defcheck_conf(self,dev="all"):
ifdev=="all":
foriinself.check_item:
self.check_item[i].check_conf()
else:
self.check_item[self.dev_item[dev]].check_conf()
defprint_conf(self,dev="all"):
ifdev=="all":
foriinself.check_item:
self.check_item[i].print_conf()
else:
self.check_item[self.dev_item[dev]].print_conf()
defstd_output(self,dev="all"):
std_list={}
ifdev=="all":
foriinself.check_item:
(key,value)=self.check_item[i].std_output()
std_list[key]=value
else:
self.check_item[self.dev_item[dev]].std_output()
#printstd_list
returnstd_list
defis_arm():
f=open("/etc/issue")
allinfo=f.readlines()
f.close()
forlineinallinfo:
line=line.strip()
ifnotline:continue
ifline.find("Ubuntu")>=0:
returnTrue
The content extracted in the information detected and configuration file compares by returnFalse#, identical, returns True, and difference then returns False
if__name__=="__main__":
ifis_arm():
arm_conf_check=ArmConfCheck()
arm_conf_check.get_conf()
arm_conf_check.check_env()
else:
opt_parse=optparse.OptionParser(version="1.0")
opt_parse.add_option("--json_list","-j",default="",help="jsonlistcontainsparas")
(options,argument)=opt_parse.parse_args()
chk_opt=options.json_list
ifchk_opt!="":
printchk_opt
json_obj=json.loads(chk_opt)
printjson_obj
ifisinstance(json_obj,dict)and\
json_obj.has_key("purTime")and\
json_obj.has_key("machModel")and\
json_obj.has_key("purPackage"):
purTime=json_obj["purTime"]
machModel=json_obj["machModel"]
purPackage=json_obj["purPackage"]
conf_check=ConfCheck()
conf_check.get_std_conf(purTime,machModel,purPackage)
conf_check.get_conf()
conf_check.check_conf("all")
#conf_check.print_conf()
conf_check.std_output("all")
else:
print"paraserror"
else:
Print " noparas " is if # parameter json_obj is the example of dict, or json_obj is an example of the subclass of dict class, returns paraserror.If json_obj be not a given type object, then returning results is noparas.
Performance test is realized by master routine invocation performance test module, and this program is by running fio, Geekbench21 and Stressapptest tri-instruments, and respectively to hard disk, CPU and internal memory carry out applied voltage test, record related data.The minimum standard of the related data realizing the hard disk, CPU, internal memory and the SSD that set is had in program, then contrast with the data set in advance testing the data obtained, if the data of setting can be reached, then show true, do not reach and just show false.
Performance test module:
#!/usr/bin/python
"""
"""
# imports program execution environments
importos
importoptparse
# calls the program module in the comm file under lib
fromlib.cpuperfimportCpuPerf
fromlib.memperfimportMemPerf
fromlib.raidperfimportRaidPerf
fromlib.hddperfimportHddPerf
fromlib.ssdperfimportSsdPerf
fromlib.flashperfimportFlashPerf
fromlib.extraperfimportExtraPerf
fromlib.comm.logtraceimportLogFile
fromlib.comm.logtraceimportLogInfo
# carries out correlated performance test, and record needs the data compared
classPerfCheck(object):
def__init__(self):
logfile="./pcheck.log"
logfile=LogFile(logfile)
self.log=LogInfo(logfile)
self.check_item={"extraPerf":ExtraPerf()}
self.check_items={"cpuPerf":CpuPerf(),
"memPerf":MemPerf(),
"raidPerf":RaidPerf(),
"hddPerf":HddPerf(),
"ssdPerf":SsdPerf(),
"flashPerf":FlashPerf()
}
self._init_env()
def_init_env(self):
command="tar-xvzftool/spec-tool/stressapptest/libaio.tar.gz-Ctool/spec-tool/stressapptest/>/dev/null2>&1"
os.system(command)
os.environ['LD_LIBRARY_PATH']="tool/spec-tool/stressapptest/"
defrun_perf(self):
foriinself.check_items:
#print"-"*10+"Run%sstart"%(i)+"-"*10
self.check_items[i].run_perf()
#print"-"*10+"Run%sdone"%(i)+"-"*10
defget_perf(self):
foriinself.check_items:
self.log.msg(i)
self.check_items[i].get_perf()
The performance data of # file reading Plays
defget_std_perf(self,pur_time,mach_model,pur_package):
std_perf={}
std_perf["cpuIntCalc"]=1000000000
self.check_items["cpuPerf"].get_std_perf(std_perf)
std_perf={}
std_perf["memBandwidth"]=1000000000
self.check_items["memPerf"].get_std_perf(std_perf)
std_perf={}
std_perf["raidRrBs4"]=1000000000
std_perf["raidRwBs4"]=1000000000
std_perf["raidrBs256"]=1000000000
std_perf["raidwBs256"]=1000000000
self.check_items["raidPerf"].get_std_perf(std_perf)
std_perf={}
std_perf["hddRrBs4"]=1000000000
std_perf["hddRwBs4"]=1000000000
std_perf["hddrBs256"]=1000000000
std_perf["hddwBs256"]=1000000000
self.check_items["hddPerf"].get_std_perf(std_perf)
std_perf={}
std_perf["ssdRrBs4"]=1000000000
std_perf["ssdRwBs4"]=1000000000
std_perf["ssdrBs256"]=1000000000
std_perf["ssdwBs256"]=1000000000
self.check_items["ssdPerf"].get_std_perf(std_perf)
std_perf={}
std_perf["flashRrBs4"]=1000000000
std_perf["flashRwBs4"]=1000000000
std_perf["flashrBs256"]=1000000000
std_perf["flashwBs256"]=1000000000
self.check_items["flashPerf"].get_std_perf(std_perf)
std_perf={}
std_perf["bmcInfoValid"]=1000000000
std_perf["fanSpeedMin"]=1000000000
std_perf["fanSpeedMax"]=1000000000
std_perf["cpuTempMax"]=1000000000
std_perf["cpuTempMin"]=1000000000
std_perf["machPowerMax"]=1000000000
self.check_item["extraPerf"].get_std_perf(std_perf)
The data of test record and the performance data of standard compare by #, satisfactoryly return True, undesirablely return False
conf_dir="./conf"
conf_file="%s_%s_%s.spec"%(pur_time,mach_model,pur_package)
conf_file=os.path.join(conf_dir,conf_file)
ifos.path.exists(conf_file):
f=open(conf_file)
allinfo=f.readlines()
f.close()
component="cpuPerf"
forlineinallinfo:
line=line.strip()
ifnotline:continue
ifline.startswith("#"):continue
ifline.startswith("[")andline.endswith("]"):
component=line.lstrip("[").rstrip("]")
else:
items=line.split(":")
iflen(items)!=2:continue
ifcomponentinself.check_items:
self.check_items[component].get_std_item(items[0].strip(),items[1].strip())
elifcomponentinself.check_item:
self.check_item[component].get_std_item(items[0].strip(),items[1].strip())
else:
pass
else:
print"conffilenotexist"
raise()
defcheck_perf(self):
foriinself.check_items:
self.check_items[i].check_perf()
defprint_perf(self):
foriinself.check_items:
self.check_items[i].print_perf()
defstd_output(self):
std_list={}
foriinself.check_items:
(key,value)=self.check_items[i].std_output()
std_list[key]=value
#printstd_list
returnstd_list
defis_arm():
f=open("/etc/issue")
allinfo=f.readlines()
f.close()
forlineinallinfo:
line=line.strip()
ifnotline:continue
ifline.find("Ubuntu")>=0:
returnTrue
returnFalse
if__name__=="__main__":
ifnotis_arm():
opt_parse=optparse.OptionParser(version="1.0")
opt_parse.add_option("--json_list","-j",default="",help="jsonlistcontainsparas")
(options,argument)=opt_parse.parse_args()
chk_opt=options.json_list
ifchk_opt!="":
printchk_opt
json_obj=json.loads(chk_opt)
printjson_obj
ifisinstance(json_obj,dict)and\
json_obj.has_key("purTime")and\
json_obj.has_key("machModel")and\
json_obj.has_key("purPackage"):
purTime=json_obj["purTime"]
machModel=json_obj["machModel"]
purPackage=json_obj["purPackage"]
perf_check=PerfCheck()
perf_check.get_std_perf(purTime,machModel,purPackage)
perf_check.run_perf()
perf_check.get_perf()
perf_check.check_perf()
#perf_check.print_perf()
perf_check.std_output()
else:
print"paraserror"
else:
Print " noparas " is if # parameter json_obj is the example of dict, or json_obj is an example of the subclass of dict class, returns paraserror.If json_obj be not a given type object, then returning results is noparas.
Arrange log portion and completely all can produce corresponding daily record in each step, final step arranges these daily records exactly, obtains the result that we need.
Book server stability test method is applicable to all single supplies or dual power supply server, and test process is on the server stablized, and can be good at test assignment.Simple to operate, result understands, greatly saves the test duration, improves testing efficiency.

Claims (4)

1. based on a method for Python server stability test, it is characterized in that, this method of testing is mainly divided into configuration detection, performance test and arrangement daily record three part; After input runs the order of master routine, first master routine can call the module detecting configuration, and this module can load corresponding trace routine and configuration file, then carries out performance test, and each step performs and produces corresponding daily record.
2. a kind of method based on Python server stability test according to claim 1, it is characterized in that, in described configuration file, have recorded type, the FW of bios and bmc, the relevant options of bios, the information such as the model quantity of internal memory, CPU, HDD, SSD and Raid card.
3. a kind of method based on Python server stability test according to claim 1, it is characterized in that, described performance test is realized by master routine invocation performance test module, this program is by running fio, Geekbench21 and Stressapptest tri-instruments, respectively to hard disk, CPU and internal memory carry out applied voltage test, record related data.
4. a kind of method based on Python server stability test according to claim 1, is characterized in that, described arrangement log portion completely all can produce corresponding daily record in each step, finally these daily records is arranged, obtains result.
CN201510438472.XA 2015-07-24 2015-07-24 Python-based server stability test method Pending CN105045707A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510438472.XA CN105045707A (en) 2015-07-24 2015-07-24 Python-based server stability test method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510438472.XA CN105045707A (en) 2015-07-24 2015-07-24 Python-based server stability test method

Publications (1)

Publication Number Publication Date
CN105045707A true CN105045707A (en) 2015-11-11

Family

ID=54452270

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510438472.XA Pending CN105045707A (en) 2015-07-24 2015-07-24 Python-based server stability test method

Country Status (1)

Country Link
CN (1) CN105045707A (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105653451A (en) * 2015-12-29 2016-06-08 北京金山安全软件有限公司 Software performance testing method and device
CN105930240A (en) * 2016-05-19 2016-09-07 浪潮电子信息产业股份有限公司 Method for carrying out automatic differential aging test on server
CN107741848A (en) * 2017-10-13 2018-02-27 郑州云海信息技术有限公司 A kind of pxe method for managing system based on python
CN108170454A (en) * 2018-01-22 2018-06-15 郑州云海信息技术有限公司 A kind of data interactive method for being applied to BIOS and baseboard management controller
CN109032874A (en) * 2018-08-15 2018-12-18 郑州云海信息技术有限公司 A kind of memory pressure test method, device, terminal and storage medium
CN109471645A (en) * 2018-10-30 2019-03-15 郑州云海信息技术有限公司 A kind of BMC interacts implementation method, device, terminal and storage medium with the Setup of BIOS
CN109471802A (en) * 2018-11-01 2019-03-15 郑州云海信息技术有限公司 A kind of method and device of abnormality processing in Python webpage
CN112667487A (en) * 2020-12-25 2021-04-16 深圳创新科技术有限公司 Method and device for executing FIO performance test by using Python script under Linux

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104407951A (en) * 2014-11-05 2015-03-11 浪潮电子信息产业股份有限公司 Method for automatically testing complete server

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104407951A (en) * 2014-11-05 2015-03-11 浪潮电子信息产业股份有限公司 Method for automatically testing complete server

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105653451A (en) * 2015-12-29 2016-06-08 北京金山安全软件有限公司 Software performance testing method and device
CN105930240A (en) * 2016-05-19 2016-09-07 浪潮电子信息产业股份有限公司 Method for carrying out automatic differential aging test on server
CN107741848A (en) * 2017-10-13 2018-02-27 郑州云海信息技术有限公司 A kind of pxe method for managing system based on python
CN107741848B (en) * 2017-10-13 2020-09-22 苏州浪潮智能科技有限公司 Pxe system management method based on python
CN108170454A (en) * 2018-01-22 2018-06-15 郑州云海信息技术有限公司 A kind of data interactive method for being applied to BIOS and baseboard management controller
CN109032874A (en) * 2018-08-15 2018-12-18 郑州云海信息技术有限公司 A kind of memory pressure test method, device, terminal and storage medium
CN109471645A (en) * 2018-10-30 2019-03-15 郑州云海信息技术有限公司 A kind of BMC interacts implementation method, device, terminal and storage medium with the Setup of BIOS
CN109471802A (en) * 2018-11-01 2019-03-15 郑州云海信息技术有限公司 A kind of method and device of abnormality processing in Python webpage
CN112667487A (en) * 2020-12-25 2021-04-16 深圳创新科技术有限公司 Method and device for executing FIO performance test by using Python script under Linux

Similar Documents

Publication Publication Date Title
CN105045707A (en) Python-based server stability test method
CN110750396B (en) Server operating system compatibility testing method and device and storage medium
Shi et al. Evaluating scalability bottlenecks by workload extrapolation
CN110992992A (en) Hard disk test method, device and storage medium
US7930597B2 (en) Method and apparatus for validating system properties exhibited in execution traces
CN104407951A (en) Method for automatically testing complete server
Dong et al. Practical and accurate pinpointing of configuration errors using static analysis
CN109240865A (en) A kind of AC test method, device, terminal and the storage medium of AEP memory
CN108572895B (en) Stability test method for automatically checking software and hardware configuration under Linux
CN103645963B (en) A kind of storage system and data consistency verification method thereof
US9842044B2 (en) Commit sensitive tests
CN114880177A (en) Method and device for testing complete machine abnormal power failure of solid state disk and computer equipment
TW201516665A (en) System and method for detecting system error of server
US8997048B1 (en) Method and apparatus for profiling a virtual machine
CN103514086A (en) Extraction method and device for software error report
CN115480970A (en) Performance test method, device, equipment and storage medium
US20220188221A1 (en) Regression testing method and regression testing apparatus
CN114116330A (en) Server performance test method, system, terminal and storage medium
CN211603369U (en) Server DC power-down fault positioning system
US9448903B2 (en) Multiple test type analysis for a test case using test case metadata
CN109920466B (en) Hard disk test data analysis method, device, terminal and storage medium
CN112486717A (en) Method, system, terminal and storage medium for verifying consistency of disk data
CN105242880A (en) Method for automatically creating Raid and executing pressure test
Vieira et al. From performance to dependability benchmarking: A mandatory path
CN102207527B (en) Electronic product failure analysis method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20151111

RJ01 Rejection of invention patent application after publication