Skip to content

Commit

Permalink
Fix remaining issues with --hackc and --hhbbc2 flags
Browse files Browse the repository at this point in the history
Summary:
Don't skip .hhas tests in --hackc mode, they work fine there.
Don't skip .onlyhackc tests if --hackc is absent, instead skip them if the mode we're running in runs hphpc (either explicit --hphpc mode or default in a HHVM_NO_DEFAULT_HACKC build).
Fix --hhbbc2 --hackc mode by moving the right repo file between the 2 hhbbc passes.

Reviewed By: paulbiss

Differential Revision: D7445364

fbshipit-source-id: 65865f1aa6b5765466d553e35c8eb8bd1e1a0835
  • Loading branch information
alexeyt authored and hhvm-bot committed Apr 2, 2018
1 parent 30ece56 commit 26f4fb1
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions hphp/test/run
Original file line number Diff line number Diff line change
Expand Up @@ -2191,21 +2191,32 @@ function get_hhvm_ini_values($test, $options) {
return $test_config;
}

function get_hhvm_compiler_frontend($options, $test) {
$get_fe_script = tempnam(sys_get_temp_dir(), "get_frontend");
$fe_temp_file = tempnam(sys_get_temp_dir(), "hhvm_frontend");
file_put_contents(
$get_fe_script,
"<?php\nfile_put_contents('$fe_temp_file', __COMPILER_FRONTEND__);"
);
list ($hhvm, $_) = hhvm_cmd($options, $test, $get_fe_script, true);
if (is_array($hhvm)) $hhvm = $hhvm[0];
system("$hhvm &> /dev/null");
$frontend = file_get_contents($fe_temp_file);
unlink($fe_temp_file);
return $frontend;
}

function run_test($options, $test) {
if (skip_test($options, $test)) return 'skip';

// Skip pure hhas tests if we're running the Hack compiler
if (isset($options['hackc'])) {
if (substr($test, -5) === ".hhas") return 'skip';
}

// Skip any tests that would require HPHPC for HackC-only features
// If the test_name.onlyhackc exists or the foler has .onlyhackc
// If the test_name.onlyhackc exists or the folder has .onlyhackc
$only_hackc_tag = '.onlyhackc';
$only_hackc = file_exists($test.$only_hackc_tag) ||
file_exists(dirname($test).'/'.$only_hackc_tag);
if ($only_hackc) {
if (!isset($options['hackc']) || isset($options['compare-hh-codegen'])) {
if (isset($options['compare-hh-codegen']) ||
get_hhvm_compiler_frontend($options, $test) !== 'hackc') {
return 'skip-onlyhackc';
}
}
Expand All @@ -2222,7 +2233,6 @@ function run_test($options, $test) {
return 'skip-nodumphhas';
}

$test_ext = pathinfo($test, PATHINFO_EXTENSION);
list($hhvm, $hhvm_env) = hhvm_cmd($options, $test);
if ((isset($options['relocate']) ||
isset($options['recycle-tc']) ||
Expand Down Expand Up @@ -2265,7 +2275,7 @@ function run_test($options, $test) {
);
return false;
}
shell_exec("mv $hhbbc_hhvm_repo $hphp_hhvm_repo");
shell_exec("mv $test.repo/$program.hhbbc $test.repo/$program.hhbc");
$hhbbc = hhbbc_cmd($options, $test, timeout_prefix(), $program);
shell_exec("$hhbbc 2>&1");
$hhas_temp2 = dump_hhas_to_temp($hhvm, "$test.after");
Expand Down

0 comments on commit 26f4fb1

Please sign in to comment.