From cbcbaaf715882eafcec4ae9005e5e91d73ac790c Mon Sep 17 00:00:00 2001 From: Kellen Sunderland Date: Mon, 27 Aug 2018 10:00:34 +0200 Subject: [PATCH] WIP: Add clang Sanitizers to CI --- CMakeLists.txt | 2 ++ Jenkinsfile | 9 ++++++++- ci/docker/runtime_functions.sh | 11 +++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index adff53336654..09fab7fa6a7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,6 +62,8 @@ else() project(mxnet C CXX) endif() +set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address") +set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_STATIC_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address") if(MSVC) set(SYSTEM_ARCHITECTURE x86_64) diff --git a/Jenkinsfile b/Jenkinsfile index 0e4aa199a6c7..fdfcec879860 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -50,6 +50,13 @@ def python3_ut(docker_container_name) { } } +// Python 3 +def python3_ut_asan(docker_container_name) { + timeout(time: max_time, unit: 'MINUTES') { + utils.docker_run(docker_container_name, 'unittest_ubuntu_python3_cpu_asan', false) + } +} + def python3_ut_mkldnn(docker_container_name) { timeout(time: max_time, unit: 'MINUTES') { utils.docker_run(docker_container_name, 'unittest_ubuntu_python3_cpu_mkldnn', false) @@ -454,7 +461,7 @@ core_logic: { try { utils.init_git() utils.unpack_lib('cpu_debug', mx_cmake_lib_debug) - python3_ut('ubuntu_cpu') + python3_ut_asan('ubuntu_cpu') } finally { utils.collect_test_results_unix('nosetests_unittest.xml', 'nosetests_python3_cpu_debug_unittest.xml') utils.collect_test_results_unix('nosetests_quantization.xml', 'nosetests_python3_cpu_debug_quantization.xml') diff --git a/ci/docker/runtime_functions.sh b/ci/docker/runtime_functions.sh index 1e38ec48e6ce..9847d81ecb9e 100755 --- a/ci/docker/runtime_functions.sh +++ b/ci/docker/runtime_functions.sh @@ -598,6 +598,17 @@ unittest_ubuntu_python3_cpu() { nosetests-3.4 $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_quantization.xml --verbose tests/python/quantization } +unittest_ubuntu_python3_cpu_asan() { + set -ex + export PYTHONPATH=./python/ + export MXNET_MKLDNN_DEBUG=1 # Ignored if not present + export MXNET_STORAGE_FALLBACK_LOG_VERBOSE=0 + export PATH=$PATH:/usr/lib/llvm-6.0/bin/ # Enable clang de-mangling of ASAN output + export LD_PRELOAD=$LD_PRELOAD:/usr/lib/llvm-6.0/lib/clang/6.0.1/lib/linux/libclang_rt.asan-x86_64.so + nosetests-3.4 $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_unittest.xml --verbose tests/python/unittest + nosetests-3.4 $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_quantization.xml --verbose tests/python/quantization +} + unittest_ubuntu_python3_cpu_mkldnn() { set -ex export PYTHONPATH=./python/