コード例 #1
0
ファイル: ctest.py プロジェクト: CopyOfalibaba/toast
    def OutputHtmlDataForScons(self):
        self.Debug('Start to capture coverage data by lcov.....')
        if self.ignoreDirs != []:
            self.RemoveIgnoreDirs()
        
        lcov_cmd = self.Lcov +" -c -d ./build/ -b . -o "+ " app.info"
        command.DoCmd1(lcov_cmd)


        self.lcov_info = os.path.abspath("app.info")
        
        import replacedir
        replacedir.visit_dir(self.BasePath)
        replacedir.deal_file("app.info")
        if os.path.exists("tmp.info"):
            subprocess.call("mv tmp.info app.info",shell=True)
        print 'replace dir processing end'

        os.system("find -name \"*.gcno\" |xargs rm -rf")
        os.system("find -name \"*.gcda\" |xargs rm -rf")
         #Get Current time and store html output to the directory named with current time
        self.Debug('Store html output to the directory named with current time')
        now=datetime.datetime.now().strftime("%m-%d-%Y-%X")
        directory='/tmp/'+now
        info_path = os.path.join(self.makefilepath,"app.info")
        genhtml_cmd= self.Genhtml +' ' + info_path  + ' -o ' + directory
        cp_info = "cp -r "+info_path+" "+directory
        command.WriteFile('genhtml_cmd is:\t'+genhtml_cmd)
        command.DoCmd(genhtml_cmd,'')
        command.DoCmd(cp_info,'')
        print "\nInfomations for code coverage in the: "+directory+"\n"

        self.OutPutLineInfoForGcov(self.LogFile);
        self.OutPutBranchInfoForGcov(self.LogFile);
        
        self.ToHtdocs(directory)
        self.DisplayURL(now)
コード例 #2
0
    def OutputHtmlDataForScons(self):
        self.Debug('Start to capture coverage data by lcov.....')
        if self.ignoreDirs != []:
            self.RemoveIgnoreDirs()

        lcov_cmd = self.Lcov + " -c -d ./build/ -b . -o " + " app.info"
        command.DoCmd1(lcov_cmd)

        self.lcov_info = os.path.abspath("app.info")

        import replacedir
        replacedir.visit_dir(self.BasePath)
        replacedir.deal_file("app.info")
        if os.path.exists("tmp.info"):
            subprocess.call("mv tmp.info app.info", shell=True)
        print 'replace dir processing end'

        os.system("find -name \"*.gcno\" |xargs rm -rf")
        os.system("find -name \"*.gcda\" |xargs rm -rf")
        #Get Current time and store html output to the directory named with current time
        self.Debug(
            'Store html output to the directory named with current time')
        now = datetime.datetime.now().strftime("%m-%d-%Y-%X")
        directory = '/tmp/' + now
        info_path = os.path.join(self.makefilepath, "app.info")
        genhtml_cmd = self.Genhtml + ' ' + info_path + ' -o ' + directory
        cp_info = "cp -r " + info_path + " " + directory
        command.WriteFile('genhtml_cmd is:\t' + genhtml_cmd)
        command.DoCmd(genhtml_cmd, '')
        command.DoCmd(cp_info, '')
        print "\nInfomations for code coverage in the: " + directory + "\n"

        self.OutPutLineInfoForGcov(self.LogFile)
        self.OutPutBranchInfoForGcov(self.LogFile)

        self.ToHtdocs(directory)
        self.DisplayURL(now)
コード例 #3
0
ファイル: ctest.py プロジェクト: CopyOfalibaba/toast
    def OutputHtmlData(self):
        self.Debug('Start to capture coverage data by lcov.....')
        if self.ignoreDirs != []:
            self.RemoveIgnoreDirs()
        i = 0;
        for root,dirs,files in os.walk(self.makefilepath,False):
            for dirname in dirs:
                dirname = os.path.join(root,dirname)
                command.WriteFile( "lcovpath: "+dirname)
                if os.path.isdir(dirname) and self.HasGcda(dirname) == True:
                     os.chdir(dirname)
                     outputpath = os.path.join(self.makefilepath,str(i)+".info")
                     lcov_cmd= self.Lcov+" -c -d . -b . -o " + outputpath +" >> "+ self.LogFile
                     i = i+1
                     command.DoCmd1(lcov_cmd)
        dirlist = os.listdir(self.makefilepath);
        hasgcda = False;
        for myfile in dirlist:
            if os.path.isfile(os.path.join(self.makefilepath,myfile)) and myfile.endswith(".gcda"):
                hasgcda = True;
                break;
        if hasgcda:
            os.chdir(self.makefilepath);
            outputpath = os.path.join(self.makefilepath,str(i)+".info")
            lcov_cmd= self.Lcov+" -c -d . -b . -o " + outputpath  + ">>" +self.LogFile
            command.DoCmd1(lcov_cmd);
        
        infolist = os.listdir(self.makefilepath)
        lcov = self.Lcov
        
        for myfile in infolist:
            if myfile.endswith(".info"):
                if  dealinfo.check_file(os.path.join(self.makefilepath,myfile)):
                    lcov = lcov+" -a " +myfile
	
        os.chdir(self.makefilepath)
        if (self.extract == 1):
            lcov = lcov + " -o app1.info"
            command.DoCmd(lcov,'')

            lcov = self.Lcov + " -e app1.info *" + self.makefilepath +"* -o app.info"
            command.DoCmd(lcov,'')
        else:
            lcov = lcov + " -o app.info"
            command.DoCmd(lcov,'')

        replacedir.visit_dir(self.BasePath)
        replacedir.deal_file("app.info")
        if os.path.exists("tmp.info"):
            subprocess.call("mv tmp.info app.info",shell=True)
        print 'replace dir processing end'

        self.lcov_info = os.path.abspath("app.info")

	if(self.keep == 1):
	    dealinfo.modify_info("app.info",self.BasePath)

        os.system("find -name \"*.gcno\" |xargs rm -rf")
        os.system("find -name \"*.gcda\" |xargs rm -rf")
         #Get Current time and store html output to the directory named with current time
        self.Debug('Store html output to the directory named with current time')
        now=datetime.datetime.now().strftime("%m-%d-%Y-%X")
        directory='/tmp/'+now
        info_path = os.path.join(self.makefilepath,"app.info")
        genhtml_cmd= self.Genhtml +' ' + info_path  + ' -o ' + directory
        cp_info = "cp -r "+info_path+" "+directory
        command.WriteFile('genhtml_cmd is:\t'+genhtml_cmd)
        command.DoCmd(genhtml_cmd,'')
        command.DoCmd(cp_info,'')
        print "\nInfomations for code coverage in the: "+directory+"\n"

        self.OutPutLineInfoForGcov(self.LogFile);
        self.OutPutBranchInfoForGcov(self.LogFile);
        
        self.ToHtdocs(directory)
        self.DisplayURL(now)
コード例 #4
0
    def OutputHtmlData(self):
        self.Debug('Start to capture coverage data by lcov.....')
        if self.ignoreDirs != []:
            self.RemoveIgnoreDirs()
        i = 0
        for root, dirs, files in os.walk(self.makefilepath, False):
            for dirname in dirs:
                dirname = os.path.join(root, dirname)
                command.WriteFile("lcovpath: " + dirname)
                if os.path.isdir(dirname) and self.HasGcda(dirname) == True:
                    os.chdir(dirname)
                    outputpath = os.path.join(self.makefilepath,
                                              str(i) + ".info")
                    lcov_cmd = self.Lcov + " -c -d . -b . -o " + outputpath + " >> " + self.LogFile
                    i = i + 1
                    command.DoCmd1(lcov_cmd)
        dirlist = os.listdir(self.makefilepath)
        hasgcda = False
        for myfile in dirlist:
            if os.path.isfile(os.path.join(
                    self.makefilepath, myfile)) and myfile.endswith(".gcda"):
                hasgcda = True
                break
        if hasgcda:
            os.chdir(self.makefilepath)
            outputpath = os.path.join(self.makefilepath, str(i) + ".info")
            lcov_cmd = self.Lcov + " -c -d . -b . -o " + outputpath + ">>" + self.LogFile
            command.DoCmd1(lcov_cmd)

        infolist = os.listdir(self.makefilepath)
        lcov = self.Lcov

        for myfile in infolist:
            if myfile.endswith(".info"):
                if dealinfo.check_file(os.path.join(self.makefilepath,
                                                    myfile)):
                    lcov = lcov + " -a " + myfile

        os.chdir(self.makefilepath)
        if (self.extract == 1):
            lcov = lcov + " -o app1.info"
            command.DoCmd(lcov, '')

            lcov = self.Lcov + " -e app1.info *" + self.makefilepath + "* -o app.info"
            command.DoCmd(lcov, '')
        else:
            lcov = lcov + " -o app.info"
            command.DoCmd(lcov, '')

        replacedir.visit_dir(self.BasePath)
        replacedir.deal_file("app.info")
        if os.path.exists("tmp.info"):
            subprocess.call("mv tmp.info app.info", shell=True)
        print 'replace dir processing end'

        self.lcov_info = os.path.abspath("app.info")

        if (self.keep == 1):
            dealinfo.modify_info("app.info", self.BasePath)

        os.system("find -name \"*.gcno\" |xargs rm -rf")
        os.system("find -name \"*.gcda\" |xargs rm -rf")
        #Get Current time and store html output to the directory named with current time
        self.Debug(
            'Store html output to the directory named with current time')
        now = datetime.datetime.now().strftime("%m-%d-%Y-%X")
        directory = '/tmp/' + now
        info_path = os.path.join(self.makefilepath, "app.info")
        genhtml_cmd = self.Genhtml + ' ' + info_path + ' -o ' + directory
        cp_info = "cp -r " + info_path + " " + directory
        command.WriteFile('genhtml_cmd is:\t' + genhtml_cmd)
        command.DoCmd(genhtml_cmd, '')
        command.DoCmd(cp_info, '')
        print "\nInfomations for code coverage in the: " + directory + "\n"

        self.OutPutLineInfoForGcov(self.LogFile)
        self.OutPutBranchInfoForGcov(self.LogFile)

        self.ToHtdocs(directory)
        self.DisplayURL(now)