Ejemplo n.º 1
0
    def _run_job_redirect(self, job, job_thread):
        """run job and redirect the output. """
        target, run_dir, test_env, cmd = job
        test_name = target.fullname
        shell = target.data.get('run_in_shell', False)
        if shell:
            cmd = subprocess.list2cmdline(cmd)
        timeout = target.data.get('test_timeout')
        self._show_progress(cmd)
        p = subprocess.Popen(cmd,
                             env=test_env,
                             cwd=run_dir,
                             stdout=subprocess.PIPE,
                             stderr=subprocess.STDOUT,
                             close_fds=True,
                             shell=shell)
        job_thread.set_job_data(p, test_name, timeout)
        stdout = p.communicate()[0]
        result = self._get_result(p.returncode)
        msg = 'Output of //%s:\n%s\n//%s finished: %s\n' % (
            test_name, stdout, test_name, result)
        if console.verbosity_le('quiet') and p.returncode != 0:
            console.error(msg, prefix=False)
        else:
            console.info(msg)
            console.flush()

        return p.returncode
Ejemplo n.º 2
0
def build(options):
    console.info('Building...')
    console.flush()
    returncode = _ninja_build(options)
    if returncode == 0 and not build_manager.instance.verify():
        returncode = 1
    if returncode != 0:
        console.error('Build failure.')
    else:
        console.info('Build success.')
    return returncode
Ejemplo n.º 3
0
def build(options):
    _check_code_style(_TARGETS)
    console.info('Building...')
    console.flush()
    returncode = _ninja_build(options)
    if not build_manager.instance.verify():
        if returncode == 0:
            returncode = 1
    if returncode != 0:
        console.error('Build failure.')
        return returncode
    console.info('Build success.')
    return 0
Ejemplo n.º 4
0
def build(options):
    _check_code_style(_TARGETS)
    console.info('building...')
    console.flush()
    returncode = _ninja_build(options)
    if returncode != 0:
        console.error('building failure.')
        return returncode
    if not build_manager.instance.verify():
        console.error('building failure.')
        return 1
    console.info('building done.')
    return 0
Ejemplo n.º 5
0
 def build(self):
     """Implement the "build" subcommand."""
     console.info('Building...')
     console.flush()
     returncode = ninja_runner.build(self.get_build_dir(),
                                     self.build_script(),
                                     self.build_jobs_num(), self.__options)
     if returncode == 0 and not self.verify():
         returncode = 1
     if returncode != 0:
         console.error('Build failure.')
     else:
         console.info('Build success.')
     return returncode
Ejemplo n.º 6
0
def build(options):
    _check_code_style(_TARGETS)
    console.info('building...')
    console.flush()
    if config.get_item('global_config', 'native_builder') == 'ninja':
        returncode = _ninja_build(options)
    else:
        returncode = _scons_build(options)
    if returncode != 0:
        console.error('building failure.')
        return returncode
    if not build_manager.instance.verify():
        console.error('building failure.')
        return 1
    console.info('building done.')
    return 0
Ejemplo n.º 7
0
def build(options):
    _check_code_style(_TARGETS)
    console.info('building...')
    console.flush()
    if config.get_item('global_config', 'native_builder') == 'ninja':
        returncode = _ninja_build(options)
    else:
        returncode = _scons_build(options)
    if returncode != 0:
        console.error('building failure.')
        return returncode
    if not build_manager.instance.verify():
        console.error('building failure.')
        return 1
    console.info('building done.')
    return 0
Ejemplo n.º 8
0
 def build(self):
     """Implement the "build" subcommand."""
     console.info('Building...')
     console.flush()
     start_time = time.time()
     returncode = ninja_runner.build(
         self.get_build_dir(),
         self.build_script(),
         self.build_jobs_num(),
         targets='',  # FIXME: because not all targets has a targets
         options=self.__options)
     self._write_build_stamp_fime(start_time, returncode)
     if returncode != 0:
         console.error('Build failure.')
     else:
         console.info('Build success.')
     return returncode
Ejemplo n.º 9
0
    def run(self):
        """Run all the test target programs. """
        self._collect_test_jobs()
        tests_run_list = []
        for target_key in self.test_jobs:
            target = self.target_database[target_key]
            test_env = self._prepare_env(target)
            cmd = [os.path.abspath(self._executable(target))]
            cmd += self.options.args
            if console.color_enabled():
                test_env['GTEST_COLOR'] = 'yes'
            else:
                test_env['GTEST_COLOR'] = 'no'
            test_env['GTEST_OUTPUT'] = 'xml'
            test_env['HEAPCHECK'] = target.data.get('heap_check', '')
            pprof_path = config.get_item('cc_test_config', 'pprof_path')
            if pprof_path:
                test_env['PPROF_PATH'] = os.path.abspath(pprof_path)
            if self.options.coverage:
                test_env['BLADE_COVERAGE'] = 'true'
            tests_run_list.append(
                (target, self._runfiles_dir(target), test_env, cmd))

        console.notice('%d tests to run' % len(tests_run_list))
        console.flush()
        scheduler = TestScheduler(tests_run_list, self.options.test_jobs)
        try:
            scheduler.schedule_jobs()
        except KeyboardInterrupt:
            console.clear_progress_bar()
            console.error('KeyboardInterrupt, all tests stopped')
            console.flush()

        if self.options.coverage:
            self._generate_coverage_report()

        self._clean_env()

        passed_run_results, failed_run_results = scheduler.get_results()
        self._save_test_history(passed_run_results, failed_run_results)
        self._show_tests_result(passed_run_results, failed_run_results)

        return 0 if len(passed_run_results) == len(self.test_jobs) else 1
Ejemplo n.º 10
0
    def run(self):
        """Run all the test target programs. """
        self._collect_test_jobs()
        tests_run_list = []
        for target_key in self.test_jobs:
            target = self.target_database[target_key]
            test_env = self._prepare_env(target)
            cmd = [os.path.abspath(self._executable(target))]
            cmd += self.options.args
            if console.color_enabled():
                test_env['GTEST_COLOR'] = 'yes'
            else:
                test_env['GTEST_COLOR'] = 'no'
            test_env['GTEST_OUTPUT'] = 'xml'
            test_env['HEAPCHECK'] = target.data.get('heap_check', '')
            pprof_path = config.get_item('cc_test_config', 'pprof_path')
            if pprof_path:
                test_env['PPROF_PATH'] = os.path.abspath(pprof_path)
            if self.options.coverage:
                test_env['BLADE_COVERAGE'] = 'true'
            tests_run_list.append((target, self._runfiles_dir(target), test_env, cmd))

        console.notice('%d tests to run' % len(tests_run_list))
        sys.stdout.flush()
        scheduler = TestScheduler(tests_run_list, self.options.test_jobs)
        try:
            scheduler.schedule_jobs()
        except KeyboardInterrupt:
            console.clear_progress_bar()
            console.error('KeyboardInterrupt, all tests stopped')
            console.flush()

        if self.options.coverage:
            self._generate_coverage_report()

        self._clean_env()

        passed_run_results, failed_run_results = scheduler.get_results()
        self._save_test_history(passed_run_results, failed_run_results)
        self._show_tests_result(passed_run_results, failed_run_results)

        return 0 if len(passed_run_results) == len(self.test_jobs) else 1