Esempio n. 1
0
    def begin(self):
        command = sys.argv
        command[0] = os.path.basename(command[0])
        self.logger.info('input command: ' + ' '.join(command))
        self.logger.info('param: ' + str(self.param))
        self.logger.info('ptl version: ' + str(ptl.__version__))
        _m = 'platform: ' + ' '.join(platform.uname()).strip()
        self.logger.info(_m)
        self.logger.info('python version: ' + str(platform.python_version()))
        self.logger.info('user: '******'-' * 80)

        if self.lcov_data is not None:
            self.lcov_utils = LcovUtils(cov_bin=self.lcov_bin,
                                        html_bin=self.genhtml_bin,
                                        cov_out=self.lcov_out,
                                        data_dir=self.lcov_data,
                                        html_nosrc=self.lcov_nosrc,
                                        html_baseurl=self.lcov_baseurl)
            # Initialize coverage analysis
            self.lcov_utils.zero_coverage()
            # The following 'dance' is done due to some oddities on lcov's
            # part, according to this the lcov readme file at
            # http://ltp.sourceforge.net/coverage/lcov/readme.php that reads:
            #
            # Note that this step only works after the application has
            # been started and stopped at least once. Otherwise lcov will
            # abort with an error mentioning that there are no data/.gcda
            # files.
            self.lcov_utils.initialize_coverage(name='PTLTestCov')
            PBSInitServices().restart()
        self._cleanup()
Esempio n. 2
0
 def finalize(self, result):
     if self.lcov_data is not None:
         # See note above that briefly explains the 'dance' needed to get
         # reliable coverage data
         PBSInitServices().restart()
         self.lcov_utils.capture_coverage(name='PTLTestCov')
         exclude = ['"*work/gSOAP/*"', '"*/pbs/doc/*"', 'lex.yy.c',
                    'pbs_ifl_wrap.c', 'usr/include/*', 'unsupported/*']
         self.lcov_utils.merge_coverage_traces(name='PTLTestCov',
                                               exclude=exclude)
         self.lcov_utils.generate_html()
         self.lcov_utils.change_baseurl()
         self.logger.info('\n'.join(self.lcov_utils.summarize_coverage()))
     self._cleanup()