Break out LocalChanges into a separate functor.
[hiphop-php.git] / hphp / test / run
blob7b25bcab815d8e25d6e18ba7a0a5b2b24e8ce70a
1 #!/bin/bash
3 readonly script_dir="$(dirname "$0")"
5 # Try to find an hhvm binary. Prefer php (if it's hhvm) or hhvm from $PATH. If
6 # neither of those work, look for hhvm in a few common locations, preferring a
7 # released version over a locally-built version for stability.
8 function get_hhvm_bin {
9 local -a candidates
10 candidates=(
11 "/usr/local/hphpi/bin/hhvm"
12 "$script_dir/../../buck-out/gen/hphp/hhvm/hhvm"
13 "$script_dir/../hhvm/hhvm"
16 if php --version |& grep -qF 'HipHop VM'; then
17 command -v php
18 return
21 if command -v hhvm 2>/dev/null; then
22 return
25 for binary in "${candidates[@]}"; do
26 if [[ -x "$binary" ]]; then
27 echo "$binary"
28 return
30 done
32 return 1
35 if ! hhvm_bin="$(get_hhvm_bin)"; then
36 echo "Couldn't find hhvm binary to run test/run" 1>&2
37 exit 1
40 exec "$hhvm_bin" "$script_dir/run.php" "$@"