def run_unittests(options): ret_build = ret_test = 0 for job in JERRY_UNITTESTS_OPTIONS: if job.skip: report_skip(job) continue ret_build, build_dir_path = create_binary(job, options) if ret_build: print("\n%sBuild failed%s\n" % (TERM_RED, TERM_NORMAL)) break if sys.platform == 'win32': if options.build_debug: build_config = "Debug" else: build_config = "MinSizeRel" else: build_config = "" ret_test |= run_check( util.get_python_cmd_prefix() + [settings.UNITTEST_RUNNER_SCRIPT] + [os.path.join(build_dir_path, 'tests', build_config)] + (["-q"] if options.quiet else [])) return ret_build | ret_test
def run_jerry_debugger_tests(options): ret_build = ret_test = 0 for job in DEBUGGER_TEST_OPTIONS: ret_build, build_dir_path = create_binary(job, options) if ret_build: print("\n%sBuild failed%s\n" % (TERM_RED, TERM_NORMAL)) break for channel in ["websocket", "rawpacket"]: for test_file in os.listdir(settings.DEBUGGER_TESTS_DIR): if test_file.endswith(".cmd"): test_case, _ = os.path.splitext(test_file) test_case_path = os.path.join(settings.DEBUGGER_TESTS_DIR, test_case) test_cmd = util.get_python_cmd_prefix() + [ settings.DEBUGGER_TEST_RUNNER_SCRIPT, get_binary_path(build_dir_path), channel, settings.DEBUGGER_CLIENT_SCRIPT, os.path.relpath(test_case_path, settings.PROJECT_DIR) ] if job.test_args: test_cmd.extend(job.test_args) ret_test |= run_check(test_cmd) return ret_build | ret_test
def iterate_test_runner_jobs(jobs, options): tested_paths = set() tested_hashes = {} for job in jobs: ret_build, build_dir_path = create_binary(job, options) if ret_build: yield job, ret_build, None if build_dir_path in tested_paths: sys.stderr.write('(skipping: already tested with %s)\n' % build_dir_path) sys.stderr.flush() continue else: tested_paths.add(build_dir_path) bin_path = get_binary_path(build_dir_path) bin_hash = hash_binary(bin_path) if bin_hash in tested_hashes: sys.stderr.write( '(skipping: already tested with equivalent %s)\n' % tested_hashes[bin_hash]) sys.stderr.flush() continue else: tested_hashes[bin_hash] = build_dir_path test_cmd = util.get_python_cmd_prefix() test_cmd.extend([settings.TEST_RUNNER_SCRIPT, '--engine', bin_path]) yield job, ret_build, test_cmd
def run_test262_test_suite(options): ret_build = ret_test = 0 jobs = TEST262_TEST_SUITE_OPTIONS for job in jobs: ret_build, build_dir_path = create_binary(job, options) if ret_build: print("\n%sBuild failed%s\n" % (TERM_RED, TERM_NORMAL)) break test_cmd = util.get_python_cmd_prefix() + [ settings.TEST262_RUNNER_SCRIPT, '--engine', get_binary_path(build_dir_path), '--test262-object', '--test-dir', settings.TEST262_TEST_SUITE_DIR, '--mode', options.test262 ] if job.test_args: test_cmd.extend(job.test_args) if options.test262_test_list: test_cmd.append('--test262-test-list') test_cmd.append(options.test262_test_list) ret_test |= run_check(test_cmd, env=dict(TZ='America/Los_Angeles')) return ret_build | ret_test
def create_binary(job, options): build_args = job.build_args[:] build_dir_path = os.path.join(options.outdir, job.name) if options.build_debug: build_args.extend(OPTIONS_DEBUG) build_dir_path = os.path.join(options.outdir, job.name + '-debug') if options.buildoptions: for option in options.buildoptions.split(','): if option not in build_args: build_args.append(option) build_cmd = util.get_python_cmd_prefix() build_cmd.append(settings.BUILD_SCRIPT) build_cmd.extend(build_args) build_cmd.append('--builddir=%s' % build_dir_path) install_dir_path = os.path.join(build_dir_path, 'local') build_cmd.append('--install=%s' % install_dir_path) if options.toolchain: build_cmd.append('--toolchain=%s' % options.toolchain) report_command('Build command:', build_cmd) binary_key = tuple(sorted(build_args)) if binary_key in BINARY_CACHE: ret, build_dir_path = BINARY_CACHE[binary_key] sys.stderr.write( '(skipping: already built at %s with returncode %d)\n' % (build_dir_path, ret)) sys.stderr.flush() return ret, build_dir_path try: subprocess.check_output(build_cmd) ret = 0 except subprocess.CalledProcessError as err: print(err.output.decode(errors="ignore")) ret = err.returncode BINARY_CACHE[binary_key] = (ret, build_dir_path) return ret, build_dir_path