Esempio n. 1
0
 def _cleanup(self):
     if not self.no_clean:
         log.notice('***Cleaning tempfiles***')
         path.removeall(self.traces_dir)
         for exe in self.executables:
             trace_file = exe + '.cov'
             if path.exists(trace_file):
                 os.remove(trace_file)
Esempio n. 2
0
 def run_jobs(self, jobs):
     if path.exists(self.build_dir) and not self.options['no-clean']:
         log.notice('Cleaning: %s' % (self.build_dir))
         path.removeall(self.build_dir)
     self.start = _now()
     self.end = _now()
     self.duration = self.end - self.start
     self.average = self.duration
     env_path = os.environ['PATH']
     os.environ['PATH'] = path.host(path.join(self.tools, 'bin')) + \
                          os.pathsep + os.environ['PATH']
     job_count, build_job_count = jobs_option_parse(self.options['jobs'])
     builds = self._create_build_jobs(jobs, build_job_count)
     active_jobs = []
     self.jobs_completed = 0
     try:
         while len(builds) > 0 or len(active_jobs) > 0:
             new_jobs = job_count - len(active_jobs)
             if new_jobs > 0:
                 active_jobs += builds[:new_jobs]
                 builds = builds[new_jobs:]
             finished_jobs = []
             for job in active_jobs:
                 state = job.current_state()
                 if state == 'ready':
                     job.run()
                 elif state != 'running':
                     finished_jobs += [job]
             for job in finished_jobs:
                 self._update_file_counts(job.get_file_counts())
                 job.log_output()
                 job.clean()
                 active_jobs.remove(job)
                 self.jobs_completed += 1
             if self.options['dry-run']:
                 time.sleep(0)
             else:
                 time.sleep(0.100)
     except:
         for job in active_jobs:
             try:
                 job.kill()
             except:
                 pass
         raise
     self.end = _now()
     os.environ['PATH'] = env_path
     self.duration = self.end - self.start
     if self.jobs_completed == 0:
         self.jobs_completed = 1
     self._finished()
     self.average = self.duration / self.jobs_completed
     log.notice('Average BSP Build Time: %s' % (str(self.average)))
     log.notice('Total Time %s' % (str(self.duration)))
Esempio n. 3
0
 def cleanup(self):
     log.notice('Cleaning up')
     for m in self.unmount_paths:
         log.output('unmount: %s' % (m))
         self.unmount(m)
     for i in self.detach_images:
         log.output('detach: %s' % (i))
         self.image_detach(i)
     if self.loader.clean:
         for r in self.remove_paths:
             if path.exists(r):
                 log.output('remove: %s' % (r))
                 path.removeall(r)
Esempio n. 4
0
 def create_path(self, where, recreate=True, cleanup=True):
     if path.exists(where):
         log.output('remove: %s' % (where))
         path.removeall(where)
     try:
         log.output('make: %s' % (where))
         path.mkdir(where)
     except:
         raise error.general('cannot create build path: %s' % (where))
     if not path.isreadable(where):
         raise error.general('build path is not readable: %s' % (where))
     if not path.iswritable(where):
         raise error.general('build path is not writeable: %s' % (where))
     if cleanup:
         self.remove_paths += [where]
Esempio n. 5
0
 def prepare_environment(self):
     symbol_set_files = []
     if (path.exists(self.traces_dir)):
         path.removeall(self.traces_dir)
     path.mkdir(self.traces_dir)
     if self.config_map is None:
         raise error.general(
             'no coverage configuration map specified in %s config file' %
             {bsp})
     self.symbol_config.load(self.symbol_config_path, self.path_to_builddir)
     for sset in self.symbol_config.symbol_sets:
         if sset.is_valid():
             symbol_set_file = (path.join(self.traces_dir,
                                          sset.name + '.symcfg'))
             sset.write_set_file(symbol_set_file)
             self.symbol_sets.append(sset.name)
         else:
             log.notice(
                 'Invalid symbol set %s in symbol_sets.cfg. skipping covoar run.'
                 % (sset.name))
     log.notice('Coverage environment prepared')
Esempio n. 6
0
 def build_arch_bsp(self, arch, bsp):
     if not self.config.bsp_present(arch, bsp):
         raise error.general('BSP not found: %s/%s' % (arch, bsp))
     log.output('-' * 70)
     log.notice('] BSP: %s/%s' % (arch, bsp))
     log.notice('. Creating: %s' % (self._path(arch, bsp)))
     self._arch_bsp_dir_clean(arch, bsp)
     self._arch_bsp_dir_make(arch, bsp)
     variations = self._variations(arch, bsp)
     build_set = self._build_set(variations)
     bsp_start = datetime.datetime.now()
     bsp_warnings = warnings_counter(self.rtems)
     env_path = os.environ['PATH']
     os.environ['PATH'] = path.host(path.join(self.tools, 'bin')) + \
                          os.pathsep + os.environ['PATH']
     for bs in sorted(build_set.keys()):
         warnings = warnings_counter(self.rtems)
         start = datetime.datetime.now()
         log.output('- ' * 35)
         log.notice('. Configuring: %s' % (bs))
         try:
             result = '+ Pass'
             bpath = self._build_dir(arch, bsp, bs)
             path.mkdir(bpath)
             config_cmd = self._config_command(build_set[bs], arch, bsp)
             cmd = config_cmd
             e = execute.capture_execution(log = warnings)
             log.output('run: ' + cmd)
             if self.options['dry-run']:
                 exit_code = 0
             else:
                 exit_code, proc, output = e.shell(cmd, cwd = path.host(bpath))
             if exit_code != 0:
                 result = '- FAIL'
                 self.errors['configure'] += 1
                 log.notice('- Configure failed: %s' % (bs))
                 log.output('cmd failed: %s' % (cmd))
                 if self.options['stop-on-error']:
                     raise error.general('Configuring %s failed' % (bs))
             else:
                 log.notice('. Building: %s' % (bs))
                 cmd = 'make'
                 if 'jobs' in self.options:
                     cmd += ' -j %s' % (self.options['jobs'])
                 log.output('run: ' + cmd)
                 if self.options['dry-run']:
                     exit_code = 0
                 else:
                     exit_code, proc, output = e.shell(cmd, cwd = path.host(bpath))
                 if exit_code != 0:
                     result = '- FAIL'
                     self.errors['build'] += 1
                     log.notice('- FAIL: %s: %s' % (bs, self._error_str()))
                     log.output('cmd failed: %s' % (cmd))
                     if self.options['stop-on-error']:
                         raise error.general('Building %s failed' % (bs))
                 files = self._count_files(arch, bsp, bs)
                 log.notice('%s: %s: warnings:%d  exes:%d  objs:%s  libs:%d' % \
                            (result, bs, warnings.get(),
                             files['exes'], files['objs'], files['libs']))
             log.notice('  %s' % (self._error_str()))
             self.results.add(result[0] == '+', arch, bsp, config_cmd, warnings.get())
         finally:
             end = datetime.datetime.now()
             if not self.options['no-clean']:
                 log.notice('. Cleaning: %s' % (self._build_dir(arch, bsp, bs)))
                 path.removeall(self._build_dir(arch, bsp, bs))
         log.notice('^ Time %s' % (str(end - start)))
         log.output('Warnings Report:')
         log.output(warnings.report())
         warnings.accumulate(bsp_warnings)
         warnings.accumulate(self.warnings)
     bsp_end = datetime.datetime.now()
     log.notice('^ BSP Time %s' % (str(bsp_end - bsp_start)))
     log.output('BSP Warnings Report:')
     log.output(bsp_warnings.report())
     os.environ['PATH'] = env_path
Esempio n. 7
0
 def _arch_bsp_dir_clean(self, arch, bsp):
     if path.exists(self._path(arch, bsp)):
         path.removeall(self._path(arch, bsp))
Esempio n. 8
0
 def clean(self):
     if not self.commands['no-clean']:
         self._notice('Cleaning: %s' % (self._build_dir()))
         path.removeall(self._build_dir())
Esempio n. 9
0
 def build_arch_bsp(self, arch, bsp):
     if not self.config.bsp_present(arch, bsp):
         raise error.general('BSP not found: %s/%s' % (arch, bsp))
     log.output('-' * 70)
     log.notice('] BSP: %s/%s' % (arch, bsp))
     log.notice('. Creating: %s' % (self._path(arch, bsp)))
     self._arch_bsp_dir_clean(arch, bsp)
     self._arch_bsp_dir_make(arch, bsp)
     variations = self._variations(arch, bsp)
     build_set = self._build_set(variations)
     bsp_start = datetime.datetime.now()
     bsp_warnings = warnings_counter(self.rtems)
     env_path = os.environ['PATH']
     os.environ['PATH'] = path.host(path.join(self.tools, 'bin')) + \
                          os.pathsep + os.environ['PATH']
     for bs in sorted(build_set.keys()):
         warnings = warnings_counter(self.rtems)
         start = datetime.datetime.now()
         log.output('- ' * 35)
         log.notice('. Configuring: %s' % (bs))
         try:
             result = '+ Pass'
             bpath = self._build_dir(arch, bsp, bs)
             path.mkdir(bpath)
             config_cmd = self._config_command(build_set[bs], arch, bsp)
             cmd = config_cmd
             e = execute.capture_execution(log=warnings)
             log.output('run: ' + cmd)
             if self.options['dry-run']:
                 exit_code = 0
             else:
                 exit_code, proc, output = e.shell(cmd,
                                                   cwd=path.host(bpath))
             if exit_code != 0:
                 result = '- FAIL'
                 self.errors['configure'] += 1
                 log.notice('- Configure failed: %s' % (bs))
                 log.output('cmd failed: %s' % (cmd))
                 if self.options['stop-on-error']:
                     raise error.general('Configuring %s failed' % (bs))
             else:
                 log.notice('. Building: %s' % (bs))
                 cmd = 'make'
                 if 'jobs' in self.options:
                     cmd += ' -j %s' % (self.options['jobs'])
                 log.output('run: ' + cmd)
                 if self.options['dry-run']:
                     exit_code = 0
                 else:
                     exit_code, proc, output = e.shell(cmd,
                                                       cwd=path.host(bpath))
                 if exit_code != 0:
                     result = '- FAIL'
                     self.errors['build'] += 1
                     log.notice('- FAIL: %s: %s' % (bs, self._error_str()))
                     log.output('cmd failed: %s' % (cmd))
                     if self.options['stop-on-error']:
                         raise error.general('Building %s failed' % (bs))
                 files = self._count_files(arch, bsp, bs)
                 log.notice('%s: %s: warnings:%d  exes:%d  objs:%s  libs:%d' % \
                            (result, bs, warnings.get(),
                             files['exes'], files['objs'], files['libs']))
             log.notice('  %s' % (self._error_str()))
             self.results.add(result[0] == '+', arch, bsp, config_cmd,
                              warnings.get())
         finally:
             end = datetime.datetime.now()
             if not self.options['no-clean']:
                 log.notice('. Cleaning: %s' %
                            (self._build_dir(arch, bsp, bs)))
                 path.removeall(self._build_dir(arch, bsp, bs))
         log.notice('^ Time %s' % (str(end - start)))
         log.output('Warnings Report:')
         log.output(warnings.report())
         warnings.accumulate(bsp_warnings)
         warnings.accumulate(self.warnings)
     bsp_end = datetime.datetime.now()
     log.notice('^ BSP Time %s' % (str(bsp_end - bsp_start)))
     log.output('BSP Warnings Report:')
     log.output(bsp_warnings.report())
     os.environ['PATH'] = env_path
Esempio n. 10
0
 def _arch_bsp_dir_clean(self, arch, bsp):
     if path.exists(self._path(arch, bsp)):
         path.removeall(self._path(arch, bsp))
Esempio n. 11
0
 def _cleanup(self):
     if not self.no_clean:
         log.notice("Cleaning workspace up")
         path.removeall(self.traces_dir)
Esempio n. 12
0
 def prepare_environment(self):
     if (path.exists(self.traces_dir)):
         path.removeall(self.traces_dir)
     path.mkdir(self.traces_dir)
     log.notice("Coverage environment prepared", stdout_only=True)
Esempio n. 13
0
 def _cleanup(self):
     log.notice("Cleaning workspace up")
     path.removeall(self.tracesDir)
Esempio n. 14
0
 def prepareEnvironment(self):
     if(path.exists(self.tracesDir)):
         path.removeall(self.tracesDir)
     path.mkdir(self.tracesDir)
     log.notice("Coverage environment prepared", stdout_only = True)