#!/usr/bin/python#-*-Coding:utf8-*-import sysimport commandstest_conf= "" "hd=default,vdbench=/var/www/html/ vdbench504,user=root,shell=sshsd=sd1,lun=/dev/vdc,openflags=o_direct,threads=1wd=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 ': +, ' seekpct ': +}, {' readpct ': 0, ' seekpct ': 100}, {' readpct ': +, ' seekpct ': 0}, {' readpct ': 0, ' seekpct ': 0}, ' Gen_test_file ('./{} '. Format (FN), rs_list) F or Num0,rs in Enumerate (rs_list): Print Commands.getoutput ('./vdbench-f {} '. Format (FN) + "-" + str (NUM0)) If __name__ = = ' __main__ ': Main () sys.exit (0)
vdbench-Automated test scripts