Don't rely on shallow_class decls being available in NastInitCheck
[hiphop-php.git] / hphp / test / run
blob5332fab09422f185c952930177ad553c84a86437
1 #!/bin/bash
3 readonly script_dir="$(dirname "$0")"
5 # Try to find an hhvm binary. Prefer a version built from this source tree,
6 # then in /usr/local, and finally from $PATH.
7 function get_hhvm_bin {
8 local -a candidates
9 candidates=(
10 "$script_dir/../../buck-out/gen/hphp/hhvm/hhvm/hhvm"
11 "$script_dir/../hhvm/hhvm"
12 "/usr/local/hphpi/bin/hhvm"
15 for binary in "${candidates[@]}"; do
16 if [[ ! -d "$binary" && -x "$binary" ]]; then
17 echo "$binary"
18 return
20 done
22 if command -v hhvm 2>/dev/null; then
23 return
26 return 1
29 if ! hhvm_bin="$(get_hhvm_bin)"; then
30 echo "Couldn't find hhvm binary to run test/run" 1>&2
31 exit 1
34 # Try to find a cli config.
35 function get_cli_config {
36 local -a candidates
37 candidates=(
38 "/usr/local/hphpi/cli.hdf"
41 for config in "${candidates[@]}"; do
42 if [[ ! -d "$config" && -r "$config" ]]; then
43 echo "$config"
44 return
46 done
48 return 1
51 if hhvm_cfg="$(get_cli_config)"; then
52 exec "$hhvm_bin" -c "$hhvm_cfg" "$script_dir/run.php" "$@"
53 else
54 exec "$hhvm_bin" "$script_dir/run.php" "$@"