From 6eef35d561d3dc2682e35c81580e899696905de6 Mon Sep 17 00:00:00 2001 From: ptarjan Date: Tue, 16 Apr 2013 18:08:00 -0700 Subject: [PATCH] nicer message on failure smith asked for this. Prints out the exact options to run it by hand. If it is in repo mode, it uses the already built repo. Otherwise it just runs the file. If you are only running 1 test, it does the FILENAME sustitution for you. I thought it would get pretty ugly if I printed out that line for every test. --- hphp/test/run | 28 ++++++++++++++++++++++++++-- hphp/test/verify | 2 +- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/hphp/test/run b/hphp/test/run index d17f4af7f..b7942cab9 100755 --- a/hphp/test/run +++ b/hphp/test/run @@ -44,6 +44,7 @@ function error($message) { if (!isset($_ENV['HPHP_HOME'])) { error("HPHP_HOME must be set in your environment"); } +$_ENV['HPHP_HOME'] = rtrim($_ENV['HPHP_HOME'], '/'); function idx($array, $key, $default = null) { return isset($array[$key]) ? $array[$key] : $default; @@ -57,6 +58,10 @@ function bin_root() { return idx($_ENV, 'FBMAKE_BIN_ROOT', $_ENV['HPHP_HOME'].'/_bin'); } +function verify_hhbc() { + return idx_file($_ENV, 'VERIFY_HHBC', bin_root().'/verify.hhbc'); +} + function get_options($argv) { $parameters = array( 'r' => 'repo', @@ -157,8 +162,7 @@ function file_arg($options) { } function mode_arg($options) { - $verify_hhbc = idx_file($_ENV, 'VERIFY_HHBC', bin_root().'/verify.hhbc'); - $repo_args = "-v Repo.Local.Mode=-- -v Repo.Central.Path=$verify_hhbc"; + $repo_args = "-v Repo.Local.Mode=-- -v Repo.Central.Path=".verify_hhbc(); $jit_args = "$repo_args -v Eval.Jit=true -v Eval.JitEnableRenameFunction=true"; $mode = idx($options, 'mode'); switch ($mode) { @@ -181,6 +185,7 @@ function command_arg($options, $tests) { find_config($tests, 'config.hdf'), file_arg($options), mode_arg($options), + '-v Eval.EnableArgsInBacktraces=true', ); } @@ -222,4 +227,23 @@ $verify = array( ); passthru(implode(' ', $verify), $return_status); + +if ($return_status) { + $command = implode(' ', command_arg($options, $tests)); + $filename = 'FILENAME'; + $extra_help = ' change FILENAME to the test you want'; + if (count($tests) == 1) { + $filename = current($tests); + $extra_help = ''; + } + $command = str_replace('%3\\$s', $filename, $command); + + if (isset($options['repo'])) { + $command .= " -v Repo.Authoritative=true "; + $command = str_replace(verify_hhbc(), "$filename.repo/hhvm.hhbc", $command); + } + + print "\nTo run these by hand$extra_help:\n". + "$command\n"; +} exit($return_status); diff --git a/hphp/test/verify b/hphp/test/verify index 2dc581cff..a9ecef51a 100755 --- a/hphp/test/verify +++ b/hphp/test/verify @@ -389,7 +389,7 @@ sub run_test } unlink "$opt_objdir/$test.repo/hhvm.hhbc"; `$opt_hphp -thhbc -l0 -k1 -o $opt_objdir/$test.repo $hphp_opts $opt_objdir/$test`; - $opts .= " -v Repo.Authoritative=true -v Repo.Central.Path=$opt_objdir/$test.repo/hhvm.hhbc -v Eval.EnableArgsInBacktraces=true"; + $opts .= " -v Repo.Authoritative=true -v Repo.Central.Path=$opt_objdir/$test.repo/hhvm.hhbc"; } }