Пример #1
0
    def run(self):
        if self.runlist:
            self.use_runlist = self.runlist
        else:
            self.default_runlist()

        #check if  user provided runlist exsis or not
        if not utilities.is_file_valid(self.use_runlist):
            raise RunfileError("runlist %s does not exist" %
                               self.use_runlist)

        #check if targetfile exist or not
        if (not self.targetfile) or \
           (not utilities.is_file_valid(self.targetfile)):
            raise RunnerError("Target file %s is not passed or does not exist" % (self.targetfile))
        #create log folder if not existing
        if self.bat not in self.bat_list:
            raise RunnerError("Invalid bat type %s, provide bvt, ceph_qa")
        #check if set_number is provided, not mendatory for bvt
        if self.bat != 'bvt':
            if not self.set_number:
                raise RunnerError("Please pass set_number with -s option")
        self.log_dir_inuse = self.default_log_path_dict.get(self.bat)
        if not utilities.is_path(self.log_dir_inuse):
            utilities.create_dir(self.log_dir_inuse)

        #start executing the test present in the runlist
        obj = teuthology.Teuthology(targetfile=self.targetfile,
                                    bat_type=self.bat,
                                    set_number=self.set_number,
                                    report_result=self.report_result,
                                    runlist_path=self.use_runlist,
                                    log_path=self.log_dir_inuse,
                                    nuke=self.debug,  mail=self.mail,
                                    no_poweroff=self.no_poweroff)
        obj.run()
Пример #2
0
    def run(self):
        self.parse_runlist()
        self.total_result = {}
        log_path = self.log_path + CURRENT_DATE
        self.result = log_path + '/' + 'result.log'
        if not utilities.is_path(log_path):
            utilities.create_dir(log_path)

        no_of_testcases = len(self.runlist_use)

        if no_of_testcases == 0:
            print "No testcases to run"
            sys.exit()
        count = 1
        #Execution started, start time
        start_time = time.time()
        for each_test in self.runlist_use:
            if self.set_number:
               set_no = "_%s" % self.set_number
               log_no = 'Log' + str(count) + set_no
            else:
               log_no = 'Log' + str(count)
            log_suffix = log_path + '/' + log_no
            if type(each_test) is tuple:
                each_name, each_test = each_test[0], each_test[1]
            status = self.run_teuthology(each_test, log_suffix)
            if self.tls_obj:
                testcase_IDList = self.get_testcaseID(log_suffix)
                if testcase_IDList:
                    for tcid in testcase_IDList:
                        try:
                            self.tls_obj.report_result(tcid, status,
                                                       self.ceph_version)
                        except Exception:
                            print ("Error while reporting Testcases: "
                                   "%s to testlink" % tcid)
            try:
                each_name
            except Exception:
                pass
            else:
                each_test = each_name

            if not status:
                self.total_result["%s. %s" %(count,each_test)] = 'Fail'
            else:
                self.total_result["%s. %s" %(count,each_test)] = 'Pass'
            count+=1
        #Exection completed, stop time

        stop_time = time.time()
        self.execution_time = int(stop_time - start_time)
        with open(self.result,'w')  as result_handle:
            result_handle.write(pprint.pformat(self.total_result))
        print pprint.pformat(self.total_result)
        #send mail
        if self.mail:
            self.sendmail()

        #stop all the nodes
        if not self.no_poweroff:
            self.poweroff_nodes()
        return