2020-06-15 17:27:17 -07:00
|
|
|
#!/usr/bin/env bash
|
2020-06-08 13:22:12 -07:00
|
|
|
|
2020-06-15 17:27:17 -07:00
|
|
|
set -euxo pipefail
|
2020-06-08 13:22:12 -07:00
|
|
|
|
2020-06-15 17:27:17 -07:00
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd)"
|
2021-05-04 23:10:04 +02:00
|
|
|
RAY_DIR="${ROOT_DIR}/../.."
|
2020-06-08 13:22:12 -07:00
|
|
|
|
2020-06-15 17:27:17 -07:00
|
|
|
asan_install() {
|
2020-08-07 10:06:13 -07:00
|
|
|
echo "installing"
|
2021-05-04 23:10:04 +02:00
|
|
|
(cd "${RAY_DIR}"/python && pip install -e . --verbose)
|
2020-06-15 17:27:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
asan_setup() {
|
|
|
|
echo "Setting up the environment"
|
2020-08-07 10:06:13 -07:00
|
|
|
pip uninstall -y ray || true
|
|
|
|
conda uninstall -y wrapt || true
|
|
|
|
pip install wrapt || true
|
2020-06-15 17:27:17 -07:00
|
|
|
pip install -r ray-project/requirements.txt
|
2020-07-28 19:54:48 -07:00
|
|
|
pip install -U pytest==5.4.3
|
2020-06-15 17:27:17 -07:00
|
|
|
|
|
|
|
echo "Installing cython example"
|
2021-05-04 23:10:04 +02:00
|
|
|
(cd "${RAY_DIR}"/doc/examples/cython && python setup.py install --user)
|
2020-06-15 17:27:17 -07:00
|
|
|
|
|
|
|
echo "Settting up the shell"
|
|
|
|
echo "build --config=asan" >> ~/.bazelrc # Setup cache
|
2021-05-04 23:10:04 +02:00
|
|
|
echo "LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/9/libasan.so" >> ~/.bashrc
|
2020-06-15 17:27:17 -07:00
|
|
|
echo "ASAN_OPTIONS=detect_leaks=0" >> ~/.bashrc
|
|
|
|
|
|
|
|
echo "Compiling ray"
|
2021-05-04 23:10:04 +02:00
|
|
|
cd "${RAY_DIR}"
|
2020-06-15 17:27:17 -07:00
|
|
|
asan_install || true
|
|
|
|
}
|
|
|
|
|
|
|
|
asan_run() {
|
|
|
|
(
|
2021-05-04 23:10:04 +02:00
|
|
|
export LD_PRELOAD="/usr/lib/gcc/x86_64-linux-gnu/9/libasan.so"
|
2020-06-15 17:27:17 -07:00
|
|
|
export ASAN_OPTIONS="detect_leaks=0"
|
|
|
|
|
2021-05-04 23:10:04 +02:00
|
|
|
cd "${RAY_DIR}"
|
2020-06-15 17:27:17 -07:00
|
|
|
|
|
|
|
# Ray tests
|
2021-10-12 10:05:46 +01:00
|
|
|
bazel test --test_output=streamed python/ray/serve/...
|
|
|
|
bazel test --test_output=streamed python/ray/dashboard/...
|
|
|
|
bazel test --test_output=streamed python/ray/tests/...
|
|
|
|
bazel test --test_output=streamed python/ray/tune/...
|
2020-06-15 17:27:17 -07:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
asan_recompile() {
|
|
|
|
git fetch
|
2021-05-04 23:10:04 +02:00
|
|
|
git checkout "${GIT_SHA:-$1}"
|
2020-06-15 17:27:17 -07:00
|
|
|
asan_install || true
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ 0 -lt "$#" ]; then
|
2020-07-21 19:56:41 -07:00
|
|
|
"asan_$1" "${@:2}"
|
2020-06-15 17:27:17 -07:00
|
|
|
else
|
|
|
|
echo "Available commands: setup, run, recompile"
|
|
|
|
fi
|