From f8253267505879a3baf49849fc4780156919030f Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Mon, 19 Aug 2019 14:17:28 +0200 Subject: [PATCH] ci: travis: add job to build efl and run tests with address sanitizer A first step to have addrress sanitizer coverage on our EFL build. It already catched some use after free errors and memory corruptions. Still we have some limititation how we are running this right now. We currently ignore some leaks that are exposed durign the normal build wile haveing the short living runs of edje_cc, elm_prefs_cc, etc. For now the whole leak detection is disabled on the testsuite as well. This is still very valuable, especially for all non-leak cases it finds, thus we are goign to run this on our daily build. Signed-off-by: Stefan Schmidt Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10691 --- .ci/asan-ignore-leaks.supp | 16 ++++++++++++++++ .ci/ci-configure.sh | 8 +++++++- .ci/ci-make-check.sh | 6 +++++- .ci/ci-make-install.sh | 4 ++++ .ci/ci-make.sh | 4 ++++ .travis.yml | 3 +++ 6 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 .ci/asan-ignore-leaks.supp diff --git a/.ci/asan-ignore-leaks.supp b/.ci/asan-ignore-leaks.supp new file mode 100644 index 0000000000..027800db9f --- /dev/null +++ b/.ci/asan-ignore-leaks.supp @@ -0,0 +1,16 @@ +# Evas +leak:evas_module_find_type +leak:generic_cache_new +# Edje / cpplib +leak:handle_directive +# Edje_cc +leak:edje_cc +leak:_efl_loop_message_handler_message_send +leak:ecore_ipc_client_add +# Elm_prefs_cc +leak:st_collection_page_items_item_label +leak:st_collection_page_items_item_name +leak:st_collection_page_items_item_string_placeholder +leak:st_collection_page_items_item_string_default +leak:st_collection_page_items_item_string_deny +leak:ob_collection_page_items_item diff --git a/.ci/ci-configure.sh b/.ci/ci-configure.sh index 035d154508..0cccda0eec 100755 --- a/.ci/ci-configure.sh +++ b/.ci/ci-configure.sh @@ -69,7 +69,13 @@ if [ "$DISTRO" != "" ] ; then travis_endfold cov-download fi - if [ "$1" = "mingw" ]; then + if [ "$1" = "asan" ]; then + travis_fold meson meson + docker exec --env EIO_MONITOR_POLL=1 --env CC="ccache gcc" \ + --env CXX="ccache g++" --env CFLAGS="-O0 -g" --env CXXFLAGS="-O0 -g" \ + --env LD="ld.gold" $(cat $HOME/cid) sh -c "mkdir build && meson build $OPTS -Db_sanitize=address" + travis_endfold meson + elif [ "$1" = "mingw" ]; then OPTS="$OPTS $MINGW_COPTS" travis_fold cross-native cross-native docker exec $(cat $HOME/cid) sh -c '.ci/bootstrap-efl-native-for-cross.sh' diff --git a/.ci/ci-make-check.sh b/.ci/ci-make-check.sh index 1578b3cb65..682d613544 100755 --- a/.ci/ci-make-check.sh +++ b/.ci/ci-make-check.sh @@ -23,7 +23,11 @@ NUM_TRIES=5 travis_fold check "ninja test" if [ "$DISTRO" != "" ] ; then for tries in $(seq 1 ${NUM_TRIES}); do - (docker exec --env EINA_LOG_BACKTRACE="0" --env EIO_MONITOR_POLL=1 $(cat $HOME/cid) meson test -t 120 -C build --wrapper dbus-launch ) && break + if [ "$1" = "asan" ]; then + (docker exec --env EINA_LOG_BACKTRACE="0" --env EIO_MONITOR_POLL=1 --env ASAN_OPTIONS=detect_leaks=0:abort_on_error=0 $(cat $HOME/cid) meson test -t 120 -C build --wrapper dbus-launch) && break + else + (docker exec --env EINA_LOG_BACKTRACE="0" --env EIO_MONITOR_POLL=1 $(cat $HOME/cid) meson test -t 120 -C build --wrapper dbus-launch ) && break + fi docker exec --env EIO_MONITOR_POLL=1 $(cat $HOME/cid) cat build/meson-logs/testlog-dbus-launch.txt if [ $tries != ${NUM_TRIES} ] ; then echo "tests failed, trying again!" ; fi false diff --git a/.ci/ci-make-install.sh b/.ci/ci-make-install.sh index 74769896c3..08bf1db204 100755 --- a/.ci/ci-make-install.sh +++ b/.ci/ci-make-install.sh @@ -9,6 +9,10 @@ if [ "$1" = "coverity" ] ; then exit 0 fi travis_fold install "ninja install" +if [ "$1" = "asan" ]; then + docker exec --env EIO_MONITOR_POLL=1 --env ASAN_OPTIONS=abort_on_error=0 --env LSAN_OPTIONS=suppressions=/src/.ci/asan-ignore-leaks.supp $(cat $HOME/cid) ninja -C build install + exit $? +fi if [ "$DISTRO" != "" ] ; then docker exec --env EIO_MONITOR_POLL=1 $(cat $HOME/cid) ninja -C build install else diff --git a/.ci/ci-make.sh b/.ci/ci-make.sh index 30f7d7c37d..c8d7332f05 100755 --- a/.ci/ci-make.sh +++ b/.ci/ci-make.sh @@ -6,6 +6,10 @@ if [ "$1" = "release-ready" ] ; then exit 0 fi travis_fold ninja ninja +if [ "$1" = "asan" ]; then + docker exec --env EIO_MONITOR_POLL=1 --env ASAN_OPTIONS=abort_on_error=0 --env LSAN_OPTIONS=suppressions=/src/.ci/asan-ignore-leaks.supp $(cat $HOME/cid) ninja -C build + exit $? +fi if [ "$DISTRO" != "" ] ; then if [ "$1" = "coverity" ] ; then docker exec --env EIO_MONITOR_POLL=1 --env PATH="/src/cov-analysis-linux64-2019.03/bin:$PATH" $(cat $HOME/cid) sh -c "cov-build --dir cov-int ninja -C build" diff --git a/.travis.yml b/.travis.yml index e42f637fa9..587dbe939d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -71,6 +71,9 @@ jobs: - os: linux if: type = cron env: DISTRO=Fedora31 CI_BUILD_TYPE=coverity + - os: linux + if: type = cron + env: DISTRO=Fedora31 CI_BUILD_TYPE=asan services: - docker