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
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
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.') else: console.info('building done.') return returncode
def run(self): """Run all the test target programs. """ self._generate_inctest_run_list() tests_run_list = [] for target in self.targets.values(): if not target.type.endswith('_test'): continue if (not self.run_all_reason ) and target not in self.inctest_run_list: if not target.data.get('always_run'): self.skipped_tests.append((target.path, target.name)) continue 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.coverage: test_env['BLADE_COVERAGE'] = 'true' tests_run_list.append( (target, self._runfiles_dir(target), test_env, cmd)) sys.stdout.flush() concurrent_jobs = self.options.test_jobs scheduler = TestScheduler(tests_run_list, concurrent_jobs, self.tests_run_map) try: scheduler.schedule_jobs() except KeyboardInterrupt: console.warning('KeyboardInterrupt, all tests stopped') console.flush() if self.coverage: self._generate_coverage_report() self._clean_env() self._show_tests_result(scheduler) if scheduler.failed_targets: return 1 else: return 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
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') console.info('[%s/%s] Running %s' % (self.num_of_run_tests, self.num_of_tests, 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) console.info('Output of %s:\n%s\n%s finished: %s\n' % (test_name, stdout, test_name, result)) console.flush() return p.returncode
#panel = AbsoluteLayout() label1 = Label("Here is some text") >> Padding(top=5) >> Border(double_line, fg_colour=white) >> Fill(bg_colour=dark_blue) label2 = Label("This is a really long string of text.") >> Padding(hpad=3, vpad=2) >> Border(double_line, fg_colour=yellow) >> Fill(bg_colour=dark_red) label3 = Label("This text is right-aligned") >> Padding(hpad=8) >> Border(single_line, fg_colour=red) >> Fill(bg_colour=dark_amber) label4 = Text('The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested.\n\nSections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.', 30, nbsp='s') >> Padding(hpad=2, vpad=1) >> Border(single_line, fg_colour=red) >> Fill(bg_colour=dark_amber) #label4 = Label("This is a really long string of text.") >> Padding(hpad=3, vpad=2) >> Border(double_line, fg_colour=yellow) >> Fill(bg_colour=dark_red) label1.render(root, 30, 9) label2.render(root, 40, 15) label3.render(root, 30, 4) label4.render(root, 10, 25) #panel.add(label1, 30, 9, zlevel=2) #panel.add(label2, 40, 15, halign="left", zlevel=3) #panel.add(label3, 30, 4, zlevel=1, halign="right") #panel.add(label4, 10, 25, halign="left", zlevel=4) bg = RectangleShape(console.width(),console.height(), char="/", fg_colour=dark_grey, bg_colour=darkest_red) #panel.add(bg, 0, 0, zlevel=-100) #bg.render(root,0,0) #panel.render(root, 0,0) #key_input.check_for_input() console.flush() #time.sleep(0.015) console.wait_for_user()