ci: travis: add job to build efl and run tests with address sanitizer
authorStefan Schmidt <s.schmidt@samsung.com>
Mon, 19 Aug 2019 12:17:28 +0000 (14:17 +0200)
committerJongmin Lee <jm105.lee@samsung.com>
Wed, 27 Nov 2019 21:24:45 +0000 (06:24 +0900)
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 <s.schmidt@samsung.com>
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D10691

.ci/asan-ignore-leaks.supp [new file with mode: 0644]
.ci/ci-configure.sh
.ci/ci-make-check.sh
.ci/ci-make-install.sh
.ci/ci-make.sh
.travis.yml

diff --git a/.ci/asan-ignore-leaks.supp b/.ci/asan-ignore-leaks.supp
new file mode 100644 (file)
index 0000000..027800d
--- /dev/null
@@ -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
index 035d154..0cccda0 100755 (executable)
@@ -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'
index 1578b3c..682d613 100755 (executable)
@@ -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
index 7476989..08bf1db 100755 (executable)
@@ -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
index 30f7d7c..c8d7332 100755 (executable)
@@ -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"
index e42f637..587dbe9 100644 (file)
@@ -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