def main(args): tests = get_tests(args.test_dir, args.test_list, args.skip_list) total = len(tests) if total == 0: print("No test to execute.") return 1 if sys.platform == 'win32': original_timezone = util.get_timezone() util.set_sighdl_to_reset_timezone(original_timezone) util.set_timezone('UTC') if args.snapshot: passed = run_snapshot_tests(args, tests) else: passed = run_normal_tests(args, tests) if sys.platform == 'win32': util.set_timezone(original_timezone) failed = total - passed summary_list = [os.path.relpath(args.engine)] if args.snapshot: summary_list.append('--snapshot') if args.test_dir: summary_list.append(os.path.relpath(args.test_dir)) if args.test_list: summary_list.append(os.path.relpath(args.test_list)) util.print_test_summary(' '.join(summary_list), total, passed, failed) return bool(failed)
def main(args): return_code = prepare_test262_test_suite(args) if return_code: return return_code if sys.platform == 'win32': original_timezone = util.get_timezone() util.set_sighdl_to_reset_timezone(original_timezone) util.set_timezone('Pacific Standard Time') proc = subprocess.Popen(get_platform_cmd_prefix() + [os.path.join(args.test_dir, 'tools/packaging/test262.py'), '--command', (args.runtime + ' ' + args.engine).strip(), '--tests', args.test_dir, '--summary'], universal_newlines=True, stdout=subprocess.PIPE) return_code = 1 with open(os.path.join(os.path.dirname(args.engine), 'test262.report'), 'w') as output_file: counter = 0 summary_found = False while True: counter += 1 output = proc.stdout.readline() if not output: break output_file.write(output) if not summary_found and (counter % 100) == 0: print("\rExecuted approx %d tests..." % counter, end='') if output.startswith('=== Summary ==='): summary_found = True print('') if summary_found: print(output, end='') if 'All tests succeeded' in output: return_code = 0 proc.wait() if sys.platform == 'win32': util.set_timezone(original_timezone) return return_code
def main(args): return_code = prepare_test262_test_suite(args) if return_code: return return_code if sys.platform == 'win32': original_timezone = util.get_timezone() util.set_sighdl_to_reset_timezone(original_timezone) util.set_timezone('Pacific Standard Time') command = (args.runtime + ' ' + args.engine).strip() kwargs = {} if sys.version_info.major >= 3: kwargs['errors'] = 'ignore' if args.es51: test262_harness_path = os.path.join(args.test262_harness_dir, 'tools/packaging/test262.py') else: test262_harness_path = os.path.join(args.test262_harness_dir, 'test262-harness.py') test262_command = get_platform_cmd_prefix() + \ [test262_harness_path, '--command', command, '--tests', args.test_dir, '--summary'] if 'excludelist_path' in args and args.mode == 'default': test262_command.extend(['--exclude-list', args.excludelist_path]) if args.test262_test_list: test262_command.extend(args.test262_test_list.split(',')) proc = subprocess.Popen(test262_command, universal_newlines=True, stdout=subprocess.PIPE, **kwargs) return_code = 1 with open(os.path.join(os.path.dirname(args.engine), 'test262.report'), 'w') as output_file: counter = 0 summary_found = False summary_end_found = False while True: output = proc.stdout.readline() if not output: break output_file.write(output) if output.startswith('=== Summary ==='): summary_found = True print('') if summary_found: if not summary_end_found: print(output, end='') if not output.strip(): summary_end_found = True if 'All tests succeeded' in output: return_code = 0 elif re.search('in (non-)?strict mode', output): counter += 1 if (counter % 100) == 0: print(".", end='') if (counter % 5000) == 0: print(" Executed %d tests." % counter) proc.wait() if sys.platform == 'win32': util.set_timezone(original_timezone) if args.mode == 'update': return_code = update_exclude_list(args) return return_code
def run_test262_tests(runtime, engine, path_to_test262): if not os.path.isdir(os.path.join(path_to_test262, '.git')): return_code = subprocess.call([ 'git', 'clone', 'https://github.com/tc39/test262.git', '-b', 'es5-tests', path_to_test262 ]) if return_code: print('Cloning test262 repository failed.') return return_code path_to_remove = os.path.join(path_to_test262, 'test', 'suite', 'bestPractice') if os.path.isdir(path_to_remove): shutil.rmtree(path_to_remove) path_to_remove = os.path.join(path_to_test262, 'test', 'suite', 'intl402') if os.path.isdir(path_to_remove): shutil.rmtree(path_to_remove) if sys.platform == 'win32': original_timezone = util.get_timezone() util.set_sighdl_to_reset_timezone(original_timezone) util.set_timezone('Pacific Standard Time') proc = subprocess.Popen(get_platform_cmd_prefix() + [ os.path.join(path_to_test262, 'tools/packaging/test262.py'), '--command', (runtime + ' ' + engine).strip(), '--tests', path_to_test262, '--summary' ], universal_newlines=True, stdout=subprocess.PIPE) return_code = 0 with open(os.path.join(os.path.dirname(engine), 'test262.report'), 'w') as output_file: counter = 0 summary_found = False while True: counter += 1 output = proc.stdout.readline() if not output: break output_file.write(output) if (counter % 100) == 0: print("\rExecuted approx %d tests..." % counter, end='') if output.startswith('=== Summary ==='): summary_found = True print('') if summary_found: print(output, end='') if ('Failed tests' in output) or ('Expected to fail but passed' in output): return_code = 1 proc.wait() if sys.platform == 'win32': util.set_timezone(original_timezone) return return_code
def main(args): return_code = prepare_test262_test_suite(args) if return_code: return return_code return_code = prepare_exclude_list(args) if return_code: return return_code if sys.platform == 'win32': original_timezone = util.get_timezone() util.set_sighdl_to_reset_timezone(original_timezone) util.set_timezone('Pacific Standard Time') command = (args.runtime + ' ' + args.engine).strip() if args.es2015: try: subprocess.check_output(["timeout", "--version"]) command = "timeout 3 " + command except subprocess.CalledProcessError: pass kwargs = {} if sys.version_info.major >= 3: kwargs['errors'] = 'ignore' proc = subprocess.Popen(get_platform_cmd_prefix() + [os.path.join(args.test_dir, 'tools/packaging/test262.py'), '--command', command, '--tests', args.test_dir, '--full-summary'], universal_newlines=True, stdout=subprocess.PIPE, **kwargs) return_code = 1 with open(os.path.join(os.path.dirname(args.engine), 'test262.report'), 'w') as output_file: counter = 0 summary_found = False while True: counter += 1 output = proc.stdout.readline() if not output: break output_file.write(output) if not summary_found and (counter % 100) == 0: print("\rExecuted approx %d tests..." % counter, end='') if output.startswith('=== Summary ==='): summary_found = True print('') if summary_found: print(output, end='') if 'All tests succeeded' in output: return_code = 0 proc.wait() if sys.platform == 'win32': util.set_timezone(original_timezone) if args.es2015 == 'update': return_code = update_exclude_list(args) return return_code