Exemple #1
0
 def run(self):
     tool_node = self.check_tool_result_node()
         
     lptlog.info("----------开始获取测试参数")
     
     self.parallels =  self.get_config_array(tool_node, "parallel", [1])
     lptlog.info("测试并行组: %s" % utils.list_to_str(self.parallels))
     self.times = self.get_config_value(tool_node, "times", 10, valueType=int)
     if self.times < 3:
         self.times = 10
         lptlog.warning("测试次数必须大于3, 将采用默认值10")
     lptlog.info("测试次数: %d" % self.times)
            
     cmd = "./Run"
     
         #运行unixbench程序,进入unixbench 根目录, 清理环境
     os.chdir(self.tar_src_dir)
     utils.system("rm -rf results/*")
     
     #执行测试程序
     #执行测试脚本
     lptlog.info("---------运行测试脚本")
     #添加测试次数
     args_list=["-i", "%d" %self.times]
   
  #添加并行数
     for parallel in self.parallels:
         args_list.append("-c")
         args_list.append("%d" % parallel)
     
     self.mainParameters["parameters"] = " ".join([cmd]+args_list)
     utils.run_shell2(cmd, args_list=args_list, file=os.devnull)
     #utils.system_output(cmd, args=args_list)
      #返回根目录
     os.chdir(self.lpt_root)
Exemple #2
0
 def run(self):
     tool_node = self.check_tool_result_node()
         
     lptlog.info("----------开始获取测试参数")
     
     self.parallels =  self.get_config_array(tool_node, "parallel", [1])
     lptlog.info("测试并行组: %s" % utils.list_to_str(self.parallels))
     self.times = self.get_config_value(tool_node, "times", 10, valueType=int)
     if self.times < 3:
         self.times = 10
         lptlog.warning("测试次数必须大于3, 将采用默认值10")
     lptlog.info("测试次数: %d" % self.times)
            
     cmd = "./Run"
     
         #运行unixbench程序,进入unixbench 根目录, 清理环境
     os.chdir(self.tar_src_dir)
     utils.system("rm -rf results/*")
     
     #执行测试程序
     #执行测试脚本
     lptlog.info("---------运行测试脚本")
     #添加测试次数
     args_list=["-i", "%d" %self.times]
   
  #添加并行数
     for parallel in self.parallels:
         args_list.append("-c")
         args_list.append("%d" % parallel)
     
     self.mainParameters["parameters"] = " ".join([cmd]+args_list)
     utils.run_shell2(cmd, args_list=args_list, file=os.devnull)
     #utils.system_output(cmd, args=args_list)
      #返回根目录
     os.chdir(self.lpt_root)
Exemple #3
0
 def run(self):
     
     tool_node = self.check_tool_result_node()
         
     lptlog.info("-----------开始获取测试参数")
     testmode = self.get_config_value(tool_node, "testmode", "default", valueType=str)
     lptlog.info("测试模式: %s" % testmode)
     
     self.parallels = self.get_config_array(tool_node, "parallel", [1])
     lptlog.info("测试并行数组: %s" % ",".join(map(str, self.parallels)))
     
     self.times = self.get_config_value(tool_node, "times", 5, valueType=int)
     lptlog.info("测试次数: %d" % self.times )
     #if testmode == 'custom':
     #    cmd = self.processBin2
                             
    # else:
     #    cmd = self.processBin
      #   self.parallels = [1]
         
     self.mainParameters["parameters"] = "stream_mu"
     lptlog.info("----------运行测试脚本")      
     #执行测试程序
     for parallel in self.parallels:
         if parallel == 1:
             cmd = self.processBin
         else:
             cmd = self.processBin2
             os.environ['OMP_NUM_THREADS'] = str(parallel)
         for iter in range(self.times):
             lptlog.info('并行数 %d, 第 %d 测试:PASS' % (parallel, iter+1))
             tmp_result_file = os.path.join(self.tmp_dir, "stream_%d_%d.out" %(parallel, iter+1))
             utils.run_shell2(cmd, args_list=[], file=tmp_result_file)
Exemple #4
0
    def run(self):

        tool_node = self.check_tool_result_node()
        lptlog.info("----------开始获取测试参数")

        self.games = self.get_config_array(tool_node, "games", [64, 128, 256])
        lptlog.info("测试games组: %s" % utils.list_to_str(self.games))
        self.times = self.get_config_value(tool_node,
                                           "times",
                                           18,
                                           valueType=int)
        lptlog.info("测试次数: %s" % self.times)

        cmd = self.processBin2

        #执行测试程序
        lptlog.info("----------运行测试脚本")
        self.mainParameters["parameters"] = " ".join(
            ["pprun", '-c', "%d" % self.times, '-t', "games"])
        for game in self.games:
            lptlog.info("执行 %s games" % game)
            args = [
                '-b', self.bin_dir, '-c',
                "%d" % self.times, '-t',
                "%d" % game, '-d', self.tmp_dir
            ]
            result_tmp_file = os.path.join(self.tmp_dir, "%d.pingpong" % game)
            utils.run_shell2(cmd, args_list=args, file=result_tmp_file)
            lptlog.info("%d games测试数据保存到: %s" % (game, result_tmp_file))
Exemple #5
0
    def run_once(self):
        tool_node = self.check_tool_result_node()
        self.mainParameters["parameters"] = "stream_mu"
        lptlog.info("-----------开始获取测试参数")
        testmode = self.get_config_value(tool_node,
                                         "testmode",
                                         "default",
                                         valueType=str)
        lptlog.info("测试模式: %s" % testmode)

        self.parallels = self.get_config_array(tool_node, "parallel", [1])
        lptlog.info("测试并行数组: %s" % ",".join(map(str, self.parallels)))

        self.times = self.get_config_value(tool_node,
                                           "times",
                                           5,
                                           valueType=int)
        lptlog.info("测试次数: %d" % self.times)
        if testmode == 'custom':
            cmd = "./stream_mu"

        else:
            cmd = "./stream"
            self.parallels = [1]

        lptlog.info("----------运行测试脚本")
        os.chdir(self.srcdir)
        #执行测试程序
        for parallel in self.parallels:
            if parallel == 1:
                pass
            else:
                os.environ['OMP_NUM_THREADS'] = str(parallel)
            for iter in range(self.times):
                #tmp_result_file = os.path.join(self.lpttmpdir, "stream_%d_%d.out" %(parallel, iter+1))
                #utils.run_shell2(cmd, args_list=[], file=tmp_result_file)
                #self.report_data = utils.system_output(cmd)
                self.results_path = os.path.join(
                    self.resultsdir, "stream_%d_%d.out" % (parallel, iter + 1))
                lutils.run_shell2(cmd, args_list=[], file=self.results_path)
                lptlog.info('并行数 %d, 第 %d 测试:PASS' % (parallel, iter + 1))
                #utils.open_write_close(self.results_path, self.report_data)

#create result list
        self.create_result()
        #save to result.xml
        self.save_results_to_xml()
        #create txt report
        self.txt_report()
Exemple #6
0
    def run_once(self):
        tool_node = self.check_tool_result_node()
        self.mainParameters["parameters"] = "stream_mu"
        lptlog.info("-----------开始获取测试参数")
        testmode = self.get_config_value(tool_node, "testmode", "default", valueType=str)
        lptlog.info("测试模式: %s" % testmode)

        self.parallels = self.get_config_array(tool_node, "parallel", [1])
        lptlog.info("测试并行数组: %s" % ",".join(map(str, self.parallels)))

        self.times = self.get_config_value(tool_node, "times", 5, valueType=int)
        lptlog.info("测试次数: %d" % self.times )
        if testmode == 'custom':
            cmd = "./stream_mu"

        else:
            cmd = "./stream" 
            self.parallels = [1]

        lptlog.info("----------运行测试脚本")
        os.chdir(self.srcdir)
        #执行测试程序
        for parallel in self.parallels:
            if parallel == 1:
                pass
            else:
                os.environ['OMP_NUM_THREADS'] = str(parallel)
            for iter in range(self.times):
                #tmp_result_file = os.path.join(self.lpttmpdir, "stream_%d_%d.out" %(parallel, iter+1))
                #utils.run_shell2(cmd, args_list=[], file=tmp_result_file)
                #self.report_data = utils.system_output(cmd)
                self.results_path = os.path.join(self.resultsdir, "stream_%d_%d.out" %(parallel, iter+1))
                lutils.run_shell2(cmd, args_list=[], file=self.results_path)
                lptlog.info('并行数 %d, 第 %d 测试:PASS' % (parallel, iter+1))
                #utils.open_write_close(self.results_path, self.report_data)	

	#create result list
        self.create_result()
	#save to result.xml
        self.save_results_to_xml()
	#create txt report
        self.txt_report()
Exemple #7
0
 def run(self):
     '''
     '''
     tool_node = self.check_tool_result_node()
     lptlog.info("----------开始获取测试参数")
     self.parallels = [1]
     self.times = self.get_config_value(tool_node, "times", 10, valueType=int)
     lptlog.info("测试次数: %d" % self.times)
     cmd = "./Run"
     args_list = ["graphics", "-i", "%d" % self.times]
     #运行unixbench程序,进入unixbench 根目录, 清理环境
     os.chdir(self.tar_src_dir)
     os.system("rm -rf results/*")
     
     #执行测试程序
     lptlog.info("---------运行测试脚本")
     self.mainParameters["parameters"] = " ".join([cmd]+args_list)
     utils.run_shell2(cmd, args_list=args_list, file=os.devnull)
  
     #返回根目录
     os.chdir(self.lpt_root)
Exemple #8
0
 def run(self):
      
     tool_node = self.check_tool_result_node()
     lptlog.info("----------开始获取测试参数")
           
     self.games = self.get_config_array(tool_node, "games", [64,128,256])
     lptlog.info("测试games组: %s" % utils.list_to_str(self.games))
     self.times = self.get_config_value(tool_node, "times", 18, valueType=int)
     lptlog.info("测试次数: %s" % self.times)        
                                 
     cmd = self.processBin2
              
        #执行测试程序
     lptlog.info("----------运行测试脚本")
     self.mainParameters["parameters"] = " ".join(["pprun", '-c', "%d" % self.times, '-t', "games" ])
     for game in self.games:
         lptlog.info("执行 %s games" % game)
         args = ['-b', self.bin_dir, '-c', "%d" % self.times, '-t', "%d" % game, '-d', self.tmp_dir]
         result_tmp_file = os.path.join(self.tmp_dir, "%d.pingpong" % game)
         utils.run_shell2(cmd, args_list=args, file=result_tmp_file)
         lptlog.info("%d games测试数据保存到: %s" % (game, result_tmp_file))
Exemple #9
0
 def run(self):
     
     tool_node = self.check_tool_result_node()
         
     lptlog.info("----------开始获取测试参数")
     
     self.times = self.get_config_value(tool_node, "times", 10, valueType=int)
     lptlog.info("测试次数: %d" % self.times)     
  
     self.parallels = [1]
         
     cmd = "./Run"
     args_list = ["ubgears", "-i", "%d" % self.times]
     self.mainParameters["parameters"] = " ".join([cmd]+args_list) 
     #运行unixbench程序,进入unixbench 根目录
     os.chdir(self.tar_src_dir)
     utils.system("rm -rf results/*")
     lptlog.info("---------运行测试脚本")
     utils.run_shell2(cmd, args_list=args_list, file=os.devnull)
 
     os.chdir(self.lpt_root)
Exemple #10
0
 def run(self):
 
     tool_node = self.check_tool_result_node()
         
     lptlog.info("----------开始获取测试参数")
     
     cmd = self.processBin
     args = ['-u', os.getuid(),  '-m', 'lpt', '-q']
     
         #获取测试目录
     testdir = self.get_config_value(tool_node, "testdir", os.path.join(self.tmp_dir, "testdir"), valueType=str)
     if os.path.exists(testdir):
         if not os.path.isdir(testdir):
             lptlog.warning("%s 不是有效目录,将采用 /home/%u/testdir 目录" % testdir)
             testdir = "/home/%s/testdir" % getpass.getuser()
             os.makedirs(testdir, stat.S_IRWXU)
     else:
         os.makedirs(testdir, stat.S_IRWXU)
         testdir = os.path.abspath(testdir)
     args.append("-d")
     args.append(testdir)
     lptlog.info("测试目录: %s" % testdir)
         
         #获取设备
         
     devices = self.get_config_value(tool_node, "devices", "Nodevice", valueType=str)
     lptlog.info("测试分区: %s " % devices)
     if not os.path.exists(devices):
         lptlog.debug("%s 不存在" % devices)
     else:
         try:
             if not os.path.ismount(testdir):
                 util.system("mount %s %s" % (devices, testdir))
             else:
                 lptlog.debug("%s 已经挂载到 %s 目录" % (devices, testdir))
         except Exception:
             lptlog.warning("mount %s %s 失败,请确认分区是否已经格式化!!" % (devices, testdir))
     
         #获取测试内存大小
     memory = self.get_config_value(tool_node, "memory", sysinfo.get_memory_size(), valueType=str)
     if not utils.check_size_format(memory, match="\d+[kKmMgGtT]?"):
         lptlog.warning("测试内存配置error, 将采用系统内存")
         memory = sysinfo.get_memory_size()
         lptlog.debug("系统内存大小:%s" % memory)
     
               
        #获取测试文件大小
     filesize = self.get_config_value(tool_node, "filesize", "10g", valueType=str)
     if not utils.check_size_format(filesize, match="\d+[kKmMgGtT]?"):
         lptlog.warning("%s 格式 error,将采用默认大小10g" % filesize)
         filesize = "10g"
         
     if float(utils.custom_format(memory)) * 2 > float(utils.custom_format(filesize)):
         lptlog.warning("测试需求:测试内存*2 小于 文件大小,但实际相反,  将降低测试内存大小为测试文件的1/2" )
         memory = float(utils.custom_format(filesize))/2
         memory = utils.custom_format(memory, auto=True)
     
     lptlog.info("测试内存大小:%s" % memory)
     lptlog.info("测试文件大小: %s" % filesize)           
     args.append("-r")
     args.append(memory)
     
     #获取block大小
     blocksize = self.get_config_value(tool_node, "blocksize", "4k", valueType=str)
     if not utils.check_size_format(blocksize, match="\d+k?"):
         lptlog.warning("blocksize=%s 格式 error,将采用默认大小8k" % blocksize)
         blocksize = "8k"
                  
     args.append("-s")
     args.append("%s:%s" %(filesize, blocksize))
     lptlog.info("测试块大小: %s" % blocksize)
     
     small_files_num = self.get_config_value(tool_node, "small_files_num", 0, valueType=int)                
     small_file_size = self.get_config_value(tool_node, "small_file_size", "1k", valueType=str) 
     if not small_file_size in ("1k", "2k", "4k", "8k", "16k", "32k", "64k", "128k", "256k"):
         lptlog.warning("small_file_size=%s 格式error,请输入整型数字, 将采用默认值1k" % small_file_size)
     else:
         small_file_size = "1k"
     
     small_files_dirs = self.get_config_value(tool_node, "small_files_dirs", 0, valueType=int)
                     
     if small_files_num == "0":
         args.append("-n")
         args.append("0")
     else:
         args.append("-n")
         args.append("%s:%s:%s:%d" %(small_files_num, small_file_size, small_file_size, small_files_dirs))
     
     lptlog.info("小文件数: %s k, 小文件大小: %s, 测试目录: %s" % (small_files_num, small_file_size,  small_files_dirs))
         
     self.times = self.get_config_value(tool_node, "times", 5, valueType=int)
     lptlog.info("测试次数: %d " % self.times)
     args.append("-x")
     args.append("%d" % self.times)            
         
     no_buffer = self.get_config_value(tool_node, "no_buffer", "False", valueType=str)
    
     if no_buffer == "True":
         lptlog.info("no_buffer=True")
         args.append("-b")
    
     direct_io = self.get_config_value(tool_node, "direct_io", "False")
     if direct_io == "True":
         args.append("-D")
         lptlog.info("direct_io=True")
     
            
     #运行测试程序,要求保存结果到tmp目录,result_file命令为iozone_$parallel_type_$iter.out
     self.mainParameters["parameters"] = utils.list_to_str(["bonnie++"]+args, ops=" ")
         #清除缓冲
     method.clean_buffer()
     lptlog.info("----------运行测试脚本")
     utils.run_shell2(self.processBin, args_list=args, file=os.path.join(self.tmp_dir, "bonnie.out"))
     lptlog.info("%s 测试数据保存在 %s 中"  %  (self.tool, os.path.join(self.tmp_dir, "bonnie.out")))
Exemple #11
0
 def run(self):
 
     tool_node = self.check_tool_result_node()
         
     lptlog.info("----------获取测试参数")
     
     cmd = self.processBin
     args = ['-B', 'fileio',  '-c', os.path.join(self.tmp_dir, 'loadfiles/client.txt'), '-R', '999999.99']
     
         #获取测试目录
     testdir = self.get_config_testdir(tool_node)
     args.append("-D")
     args.append(testdir)
         
         #获取设备,并尝试挂载到testdir
     devices_status = self.get_config_devices(tool_node, testdir)
         
     self.times = self.get_config_value(tool_node, "times", 5, valueType=int)
     lptlog.info("测试次数: %d " % self.times)
     
     
     self.parallel_type = self.get_config_value(tool_node, "parallel_type", "process", valueType=str)
     lptlog.info("测试并行方式: %s" % self.parallel_type)
     
     self.parallels = self.get_config_array(tool_node, "parallel", [4])
     lptlog.info("测试并行: %s" % utils.list_to_str(self.parallels))
     if self.parallel_type  not in ("threads", "process"):
         self.parallel_type = "process"
     runtime = self.get_config_value(tool_node, 'runtime', 300, valueType=int)
     lptlog.info("测试时长: %s s" % runtime)
     args.append("-t")
     args.append("%d" % runtime)
     
         
     warnuptime = self.get_config_value(tool_node, 'warnuptime', 120, valueType=int)
     if warnuptime > runtime:
         lptlog.warning("warnuptime 大于 runtime, warnuptime = runtime/5")
         warnuptime = runtime/5
     lptlog.info("预热时长: %s s" % warnuptime)
     args.append("--warmup=%d" % warnuptime)
     
     self.mainParameters["parameters"] = " ".join(["dbench"]+args)
     lptlog.info("----------运行测试脚本")
     for parallel in self.parallels:
         lptlog.info("运行 %s 并行" % parallel)
         parallel_args = []
             
         if self.parallel_type == "threads":
             parallel_args.append("--clients-per-process=%d" % parallel)
             parallel_args.append("1")
         else:
             parallel_args.append(str(parallel))
             
         for iter in range(self.times):
             lptlog.info("第 %s 次测试" % (iter+1))
             tmp_file = os.path.join(self.tmp_dir, "%s_%s_%s.out" % (self.tool, parallel, iter+1))
                
                 #清除buffer
             method.clean_buffer()
             utils.run_shell2(self.processBin, args_list=args+parallel_args, file=tmp_file)
             lptlog.info("%d 并行  第 %d 次测试,测试数据保存在: %s " % (parallel, iter+1, tmp_file))
Exemple #12
0
 def run(self):
 
     tool_node = self.check_tool_result_node()
         
     lptlog.info("----------获取测试参数")
     
     cmd = self.processBin
     #args = ['-B', 'fileio',  '-c', os.path.join(self.tmp_dir, 'loadfiles/client.txt'), '-R', '999999.99']
     args = ['-c', os.path.join(self.tmp_dir, 'client.txt'), '-R', '999999.99']
     
         #获取测试目录
     testdir = self.get_config_testdir(tool_node)
     args.append("-D")
     args.append(testdir)
         
         #获取设备,并尝试挂载到testdir
     devices_status = self.get_config_devices(tool_node, testdir)
         
     self.times = self.get_config_value(tool_node, "times", 5, valueType=int)
     lptlog.info("测试次数: %d " % self.times)
     
     
     self.parallel_type = self.get_config_value(tool_node, "parallel_type", "process", valueType=str)
     lptlog.info("测试并行方式: %s" % self.parallel_type)
     
     self.parallels = self.get_config_array(tool_node, "parallel", [4])
     lptlog.info("测试并行: %s" % utils.list_to_str(self.parallels))
     if self.parallel_type  not in ("threads", "process"):
         self.parallel_type = "process"
     runtime = self.get_config_value(tool_node, 'runtime', 300, valueType=int)
     lptlog.info("测试时长: %s s" % runtime)
     args.append("-t")
     args.append("%d" % runtime)
     
         
     #warnuptime = self.get_config_value(tool_node, 'warnuptime', 120, valueType=int)
     #if warnuptime > runtime:
     #    lptlog.warning("warnuptime 大于 runtime, warnuptime = runtime/5")
     #    warnuptime = runtime/5
     #lptlog.info("预热时长: %s s" % warnuptime)
     #args.append("--warmup=%d" % warnuptime)
     
     self.mainParameters["parameters"] = " ".join(["dbench"]+args)
     lptlog.info("----------运行测试脚本")
     for parallel in self.parallels:
         lptlog.info("运行 %s 并行" % parallel)
         parallel_args = []
             
         if self.parallel_type == "threads":
             parallel_args.append("--clients-per-process=%d" % parallel)
             parallel_args.append("1")
         else:
             parallel_args.append(str(parallel))
             
         for iter in range(self.times):
             lptlog.info("第 %s 次测试" % (iter+1))
             tmp_file = os.path.join(self.tmp_dir, "%s_%s_%s.out" % (self.tool, parallel, iter+1))
                
                 #清除buffer
             method.clean_buffer()
             utils.run_shell2(self.processBin, args_list=args+parallel_args, file=tmp_file)
             lptlog.info("%d 并行  第 %d 次测试,测试数据保存在: %s " % (parallel, iter+1, tmp_file))
Exemple #13
0
    def run(self):

        tool_node = self.check_tool_result_node()

        lptlog.info("----------开始获取测试参数")

        speed_mount_status = False
        args = ["-i", "0", "-i", "1", "-i", "2"]

        self.testmode = self.get_config_value(tool_node,
                                              "testmode",
                                              os.path.join(
                                                  self.tmp_dir, "speed"),
                                              valueType=str)
        if self.testmode not in ("speed", "throughput"):
            self.testmode = "speed"
        lptlog.info("测试模式: %s" % self.testmode)

        testdir = self.get_config_testdir(tool_node)
        #获取设备,并尝试挂载到testdir,返回True或者False
        devices_status = self.get_config_devices(tool_node, testdir)

        filesize = self.get_config_value(tool_node, "filesize", "10g")
        if not utils.check_size_format(filesize):
            lptlog.warning("%s 格式 error,将采用默认大小10g" % filesize)
            filesize = "10g"
        lptlog.info("测试文件大小: %s" % filesize)
        args.append("-s")
        args.append(filesize)

        blocksize = self.get_config_value(tool_node, "blocksize", "4k")
        if not utils.check_size_format(blocksize, match="[\d]+k?"):
            lptlog.warning("blocksize=%s 格式 error,将采用默认大小4k" % blocksize)

        lptlog.info("测试块大小: %s" % blocksize)
        args.append("-r")
        args.append(blocksize)

        self.times = self.get_config_value(tool_node,
                                           "times",
                                           5,
                                           valueType=int)
        direct_status = self.get_config_value(tool_node,
                                              "directio",
                                              "False",
                                              valueType=str)
        if direct_status == "True":
            args.append("-I")
            lptlog.info("DirectIO: True")

        self.parallel_type = self.get_config_value(tool_node,
                                                   "parallel_type",
                                                   "process",
                                                   valueType=str)
        if self.parallel_type not in ("threads", "process"):
            self.parallel_type = "process"
        lptlog.info("测试并行方式: %s" % self.parallel_type)

        self.parallels = self.get_config_array(tool_node, "parallel", [4])
        lptlog.info("测试并行: %s" % utils.list_to_str(self.parallels))

        if self.testmode == "speed":
            self.parallels = [1]
        #运行测试程序,要求保存结果到tmp目录,result_file命令为iozone_$parallel_type_$iter.out
        self.mainParameters["parameters"] = " ".join(["iozone"] + args)
        lptlog.info("----------运行测试脚本")
        for parallel in self.parallels:
            parallel_args = []
            lptlog.info("%s 并行测试" % parallel)
            if self.testmode == 'throughput':
                parallel_args.append("-t")
                parallel_args.append(str(parallel))
                parallel_args.append("-F")
                for num in range(parallel):
                    parallel_args.append(
                        os.path.join(testdir, "iozone_%s_%s_%s") %
                        (self.testmode, parallel, num + 1))

                if self.parallel_type == "threads":
                    parallel_args.append("-T")

            else:
                # if devices_status:
                #  parallel_args.append("-U")
                #   parallel_args.append(testdir)

                parallel_args.append("-f")
                parallel_args.append("%s/iozone_test_file" % testdir)

            for iter in range(self.times):
                lptlog.info("第 %d 次测试" % (iter + 1))
                iozone_iter_result_file = os.path.join(
                    self.tmp_dir,
                    "iozone_%s_%d_%d.out" % (self.testmode, parallel,
                                             (iter + 1)))

                #清除缓冲
                method.clean_buffer()
                utils.run_shell2(self.processBin,
                                 args_list=args + parallel_args,
                                 file=iozone_iter_result_file)
                lptlog.info("%s %s方式, %s并行, 第%d次测试数据保存在 %s 中" %
                            (self.tool, self.testmode, parallel,
                             (iter + 1), iozone_iter_result_file))
Exemple #14
0
    def run_once(self, dir=None, args=None):
        """
        Runs IOzone with appropriate parameters, record raw results in a per
        iteration raw output file as well as in the results attribute

        :param dir: IOzone file generation dir.
        :param args: Arguments to the iozone program.
        """
        tool_node = self.check_tool_result_node()

        lptlog.info("----------开始获取测试参数")

        speed_mount_status=False
        args = ["-i", "0", "-i" ,"1", "-i", "2"]

        self.testmode = self.get_config_value(tool_node, "testmode", os.path.join(self.lpttmpdir, "speed"), valueType=str)
        if  self.testmode not in ("speed", "throughput"):
            self.testmode = "speed"
        lptlog.info("测试模式: %s" % self.testmode)

        testdir = self.get_config_testdir(tool_node)
            #获取设备,并尝试挂载到testdir,返回True或者False
        devices_status = self.get_config_devices(tool_node, testdir)

        filesize = self.get_config_value(tool_node, "filesize", "10g")
        if not lutils.check_size_format(filesize):
            lptlog.warning("%s 格式 error,将采用默认大小10g" % filesize)
            filesize = "10g"
        lptlog.info("测试文件大小: %s" % filesize)
        args.append("-s")
        args.append(filesize)

        blocksize = self.get_config_value(tool_node, "blocksize", "4k")
        if not lutils.check_size_format(blocksize, match="[\d]+k?"):
            lptlog.warning("blocksize=%s 格式 error,将采用默认大小4k" % blocksize)

        lptlog.info("测试块大小: %s" % blocksize)
        args.append("-r")
        args.append(blocksize)

        self.times = self.get_config_value(tool_node, "times", 5, valueType=int)
        direct_status = self.get_config_value(tool_node, "directio", "False", valueType=str)
        if direct_status == "True":
            args.append("-I")
            lptlog.info("DirectIO: True")

        self.parallel_type = self.get_config_value(tool_node, "parallel_type", "process", valueType=str)
        if self.parallel_type  not in ("threads", "process"):
            self.parallel_type = "process"
        lptlog.info("测试并行方式: %s" % self.parallel_type)

        self.parallels = self.get_config_array(tool_node, "parallel", [4])
        lptlog.info("测试并行: %s" % lutils.list_to_str(self.parallels))

        if self.testmode == "speed":
            self.parallels = [1]
        #运行测试程序,要求保存结果到tmp目录,result_file命令为iozone_$parallel_type_$iter.out
        self.mainParameters["parameters"] = " ".join(["iozone"]+args)
        lptlog.info("----------运行测试脚本")
        cmd = os.path.join(self.srcdir, 'src', 'current', 'iozone')
        for parallel in self.parallels:
            parallel_args = []
            lptlog.info("%s 并行测试" % parallel)
            if self.testmode == 'throughput':
                parallel_args.append("-t")
                parallel_args.append(str(parallel))
                parallel_args.append("-F")
                for num in range(parallel):
                    parallel_args.append(os.path.join(testdir, "iozone_%s_%s_%s") % (self.testmode, parallel, num+1))

                if self.parallel_type == "threads":
                    parallel_args.append("-T")

            else:
               # if devices_status:
                  #  parallel_args.append("-U")
                 #   parallel_args.append(testdir)

                parallel_args.append("-f")
                parallel_args.append("%s/iozone_test_file" % testdir)

            for iter in range(self.times):
                lptlog.info("第 %d 次测试" % (iter+1))
                iozone_iter_result_file = os.path.join(self.resultsdir, "iozone_%s_%d_%d.out" % (self.testmode, parallel, (iter+1)) )

                    #清除缓冲
                method.clean_buffer()
                lutils.run_shell2(cmd, args_list=args+parallel_args, file=iozone_iter_result_file)
                lptlog.info("%s %s方式, %s并行, 第%d次测试数据保存在 %s 中"  % (self.tool, self.testmode, parallel, (iter+1), iozone_iter_result_file))

        self.create_result()
        #save to result.xml
        self.save_results_to_xml()
        #create txt report
        self.txt_report()
Exemple #15
0
    def run(self):
        
        tool_node = self.check_tool_result_node()
            
        lptlog.info("----------开始获取测试参数")
        
        speed_mount_status=False
        args = ["-i", "0", "-i" ,"1", "-i", "2"]
    
        self.testmode = self.get_config_value(tool_node, "testmode", os.path.join(self.tmp_dir, "speed"), valueType=str)
        if  self.testmode not in ("speed", "throughput"):
            self.testmode = "speed"
        lptlog.info("测试模式: %s" % self.testmode)
        
        testdir = self.get_config_testdir(tool_node)
            #获取设备,并尝试挂载到testdir,返回True或者False
        devices_status = self.get_config_devices(tool_node, testdir)
            
        filesize = self.get_config_value(tool_node, "filesize", "10g")
        if not utils.check_size_format(filesize):
            lptlog.warning("%s 格式 error,将采用默认大小10g" % filesize)
            filesize = "10g"
        lptlog.info("测试文件大小: %s" % filesize)     
        args.append("-s")
        args.append(filesize)
            
        blocksize = self.get_config_value(tool_node, "blocksize", "4k")
        if not utils.check_size_format(blocksize, match="[\d]+k?"):
            lptlog.warning("blocksize=%s 格式 error,将采用默认大小4k" % blocksize)
            
        lptlog.info("测试块大小: %s" % blocksize)
        args.append("-r")
        args.append(blocksize)
            
        self.times = self.get_config_value(tool_node, "times", 5, valueType=int)
	direct_status = self.get_config_value(tool_node, "directio", "False", valueType=str)
	if direct_status == "True":
	    args.append("-I")
	    lptlog.info("DirectIO: True")
        
        self.parallel_type = self.get_config_value(tool_node, "parallel_type", "process", valueType=str)
        if self.parallel_type  not in ("threads", "process"):
            self.parallel_type = "process"
        lptlog.info("测试并行方式: %s" % self.parallel_type)
        
        self.parallels = self.get_config_array(tool_node, "parallel", [4])
        lptlog.info("测试并行: %s" % utils.list_to_str(self.parallels))
        
        if self.testmode == "speed":
            self.parallels = [1]
        #运行测试程序,要求保存结果到tmp目录,result_file命令为iozone_$parallel_type_$iter.out
        self.mainParameters["parameters"] = " ".join(["iozone"]+args)
        lptlog.info("----------运行测试脚本")
        for parallel in self.parallels:
            parallel_args = []
            lptlog.info("%s 并行测试" % parallel)
            if self.testmode == 'throughput':
                parallel_args.append("-t")
                parallel_args.append(str(parallel))
                parallel_args.append("-F")
                for num in range(parallel):
                    parallel_args.append(os.path.join(testdir, "iozone_%s_%s_%s") % (self.testmode, parallel, num+1))
                
                if self.parallel_type == "threads":
                    parallel_args.append("-T")
         
            else:
               # if devices_status:
                  #  parallel_args.append("-U")
                 #   parallel_args.append(testdir)
                    
                parallel_args.append("-f")
                parallel_args.append("%s/iozone_test_file" % testdir) 
        
            for iter in range(self.times):
                lptlog.info("第 %d 次测试" % (iter+1))
                iozone_iter_result_file = os.path.join(self.tmp_dir, "iozone_%s_%d_%d.out" % (self.testmode, parallel, (iter+1)) )

                    #清除缓冲
                method.clean_buffer()
                utils.run_shell2(self.processBin, args_list=args+parallel_args, file=iozone_iter_result_file)
                lptlog.info("%s %s方式, %s并行, 第%d次测试数据保存在 %s 中"  % (self.tool, self.testmode, parallel, (iter+1), iozone_iter_result_file))
Exemple #16
0
    def run_once(self, dir=None, args=None):
        """
        Runs IOzone with appropriate parameters, record raw results in a per
        iteration raw output file as well as in the results attribute

        :param dir: IOzone file generation dir.
        :param args: Arguments to the iozone program.
        """
        tool_node = self.check_tool_result_node()

        lptlog.info("----------开始获取测试参数")

        speed_mount_status = False
        args = ["-i", "0", "-i", "1", "-i", "2"]

        self.testmode = self.get_config_value(tool_node,
                                              "testmode",
                                              os.path.join(
                                                  self.lpttmpdir, "speed"),
                                              valueType=str)
        if self.testmode not in ("speed", "throughput"):
            self.testmode = "speed"
        lptlog.info("测试模式: %s" % self.testmode)

        testdir = self.get_config_testdir(tool_node)
        #获取设备,并尝试挂载到testdir,返回True或者False
        devices_status = self.get_config_devices(tool_node, testdir)

        filesize = self.get_config_value(tool_node, "filesize", "10g")
        if not lutils.check_size_format(filesize):
            lptlog.warning("%s 格式 error,将采用默认大小10g" % filesize)
            filesize = "10g"
        lptlog.info("测试文件大小: %s" % filesize)
        args.append("-s")
        args.append(filesize)

        blocksize = self.get_config_value(tool_node, "blocksize", "4k")
        if not lutils.check_size_format(blocksize, match="[\d]+k?"):
            lptlog.warning("blocksize=%s 格式 error,将采用默认大小4k" % blocksize)

        lptlog.info("测试块大小: %s" % blocksize)
        args.append("-r")
        args.append(blocksize)

        self.times = self.get_config_value(tool_node,
                                           "times",
                                           5,
                                           valueType=int)
        direct_status = self.get_config_value(tool_node,
                                              "directio",
                                              "False",
                                              valueType=str)
        if direct_status == "True":
            args.append("-I")
            lptlog.info("DirectIO: True")

        self.parallel_type = self.get_config_value(tool_node,
                                                   "parallel_type",
                                                   "process",
                                                   valueType=str)
        if self.parallel_type not in ("threads", "process"):
            self.parallel_type = "process"
        lptlog.info("测试并行方式: %s" % self.parallel_type)

        self.parallels = self.get_config_array(tool_node, "parallel", [4])
        lptlog.info("测试并行: %s" % lutils.list_to_str(self.parallels))

        if self.testmode == "speed":
            self.parallels = [1]
        #运行测试程序,要求保存结果到tmp目录,result_file命令为iozone_$parallel_type_$iter.out
        self.mainParameters["parameters"] = " ".join(["iozone"] + args)
        lptlog.info("----------运行测试脚本")
        cmd = os.path.join(self.srcdir, 'src', 'current', 'iozone')
        for parallel in self.parallels:
            parallel_args = []
            lptlog.info("%s 并行测试" % parallel)
            if self.testmode == 'throughput':
                parallel_args.append("-t")
                parallel_args.append(str(parallel))
                parallel_args.append("-F")
                for num in range(parallel):
                    parallel_args.append(
                        os.path.join(testdir, "iozone_%s_%s_%s") %
                        (self.testmode, parallel, num + 1))

                if self.parallel_type == "threads":
                    parallel_args.append("-T")

            else:
                # if devices_status:
                #  parallel_args.append("-U")
                #   parallel_args.append(testdir)

                parallel_args.append("-f")
                parallel_args.append("%s/iozone_test_file" % testdir)

            for iter in range(self.times):
                lptlog.info("第 %d 次测试" % (iter + 1))
                iozone_iter_result_file = os.path.join(
                    self.resultsdir,
                    "iozone_%s_%d_%d.out" % (self.testmode, parallel,
                                             (iter + 1)))

                #清除缓冲
                method.clean_buffer()
                lutils.run_shell2(cmd,
                                  args_list=args + parallel_args,
                                  file=iozone_iter_result_file)
                lptlog.info("%s %s方式, %s并行, 第%d次测试数据保存在 %s 中" %
                            (self.tool, self.testmode, parallel,
                             (iter + 1), iozone_iter_result_file))

        self.create_result()
        #save to result.xml
        self.save_results_to_xml()
        #create txt report
        self.txt_report()