时间:2021-07-01 10:21:17 帮助过:59人阅读
#!/usr/bin/python # -*- coding:utf8 -*- import sys import commands TEST_CONF=""" hd=default,vdbench=/var/www/html/vdbench504,user=root,shell=ssh sd=sd1,lun=/dev/vdc,openflags=o_direct,threads=1 wd=wd1,sd=sd1,xfersize=16k,readpct={readpct},seekpct={seekpct} rd=rd1,wd=wd1,iorate=max,elapsed=10,maxdata=5500g,interval=1,warmup=3 """ def gen_test_file(file_name, rs_list): for num,rs in enumerate(rs_list): with open(file_name + "-" + str(num), ‘w‘) as fw: fw.write(TEST_CONF.format( readpct=rs[‘readpct‘], seekpct=rs[‘seekpct‘]) ) return def main(): fn = ‘test‘ rs_list = [ {‘readpct‘:100, ‘seekpct‘:100}, {‘readpct‘:0, ‘seekpct‘:100}, {‘readpct‘:100, ‘seekpct‘:0}, {‘readpct‘:0, ‘seekpct‘:0}, ] gen_test_file(‘./{}‘.format(fn), rs_list) for num0,rs in enumerate(rs_list): print commands.getoutput(‘./vdbench -f {}‘.format(fn) + "-" + str(num0)) if __name__ == ‘__main__‘: main() sys.exit(0)
vdbench-自动化测试脚本
标签:gen pre html for reads highlight exit sys command