ray/ci/asan_tests/run_asan_tests.sh

61 lines
1.6 KiB
Bash
Raw Normal View History

2020-06-15 17:27:17 -07:00
#!/usr/bin/env bash
2020-06-15 17:27:17 -07:00
set -euxo pipefail
2020-06-15 17:27:17 -07:00
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd)"
2020-06-15 17:27:17 -07:00
asan_install() {
echo "installing"
(cd "${ROOT_DIR}"/../ray/python && pip install -e . --verbose)
2020-06-15 17:27:17 -07:00
}
asan_setup() {
echo "Setting up the environment"
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"
(cd "${ROOT_DIR}"/../ray/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
echo "LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/7/libasan.so" >> ~/.bashrc
echo "ASAN_OPTIONS=detect_leaks=0" >> ~/.bashrc
echo "Compiling ray"
cd "${ROOT_DIR}"/../ray/
2020-06-15 17:27:17 -07:00
git fetch
git pull origin master
asan_install || true
}
asan_run() {
(
export LD_PRELOAD="/usr/lib/gcc/x86_64-linux-gnu/7/libasan.so"
export ASAN_OPTIONS="detect_leaks=0"
cd "${ROOT_DIR}"/../ray
2020-06-15 17:27:17 -07:00
# Ray tests
bazel test --test_tag_filters=-jenkins_only --test_output=streamed python/ray/serve/...
bazel test --test_tag_filters=-jenkins_only --test_output=streamed python/ray/dashboard/...
bazel test --test_tag_filters=-jenkins_only --test_output=streamed python/ray/tests/...
bazel test --test_tag_filters=-jenkins_only --test_output=streamed python/ray/tune/...
2020-06-15 17:27:17 -07:00
)
}
asan_recompile() {
git fetch
git checkout "$1"
2020-06-15 17:27:17 -07:00
asan_install || true
}
if [ 0 -lt "$#" ]; then
"asan_$1" "${@:2}"
2020-06-15 17:27:17 -07:00
else
echo "Available commands: setup, run, recompile"
fi