]> granicus.if.org Git - recode/commitdiff
Switch from Valgrind to ASAN
authorReuben Thomas <rrt@sc3d.org>
Wed, 11 Sep 2019 19:12:21 +0000 (20:12 +0100)
committerReuben Thomas <rrt@sc3d.org>
Wed, 11 Sep 2019 19:12:21 +0000 (20:12 +0100)
.travis.yml
HACKING.org
bootstrap.conf
configure.ac
tests/Makefile.am
tests/asan-suppressions.txt [new file with mode: 0644]

index 522b618dae6aff7d140f10a1792367c3216e67eb..590acd05e6d27a63a3f17ce6cfc67f67885133e2 100644 (file)
@@ -1,21 +1,17 @@
 language: c
 
-dist: xenial
+dist: bionic
 sudo: required
 
 addons:
   apt:
-    sources:
-      - ubuntu-toolchain-r-test
     packages: &default_deps
-      - python3-dbg
+      - python3
       - cython3
       - flex
       - help2man
       - autopoint
       - texinfo
-      - valgrind
-      - g++-5
 
 # env:
 #   global:
@@ -23,12 +19,6 @@ addons:
 
 matrix:
   include:
-    - os: linux
-      env:
-        - COMPILER=gcc-5
-        - PYTHON=/usr/bin/python3-dbg
-        - CYTHON=/usr/bin/cython3
-        - DISTCHECK_CONFIGURE_FLAGS="PYTHON=/usr/bin/python3-dbg CYTHON=/usr/bin/cython3"
     - os: osx
       osx_image: xcode9.2
       env:
@@ -37,17 +27,10 @@ matrix:
         - PYTHON=/usr/local/bin/python3
     - compiler: gcc
       env:
-        - COMPILER=gcc-6
         - PYTHON=/usr/bin/python3-dbg
         - CYTHON=/usr/bin/cython3
-        - DISTCHECK_CONFIGURE_FLAGS="PYTHON=/usr/bin/python3-dbg CYTHON=/usr/bin/cython3"
-      addons:
-        apt:
-          sources:
-            - ubuntu-toolchain-r-test
-          packages:
-            - *default_deps
-            - [g++-6]
+        - CONFIGURE_ARGS=(--enable-package-suffix "CFLAGS=\"-g3 -fsanitize=address -fsanitize=undefined\"" "LDFLAGS=\"-fsanitize=address -fsanitize=undefined\"" "PY_LOG_ENV=\"LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/7/libasan.so PYTHONMALLOC=malloc\"")
+        - DISTCHECK_CONFIGURE_FLAGS="PYTHON=/usr/bin/python3 CYTHON=/usr/bin/cython3"
 
 before_install:
   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
@@ -58,5 +41,5 @@ before_install:
 
 script:
   - ./bootstrap
-  - ./configure --enable-silent-rules CC=$COMPILER $DISTCHECK_CONFIGURE_FLAGS
+  - ./configure --enable-silent-rules "${CONFIGURE_ARGS[@]}" $DISTCHECK_CONFIGURE_FLAGS
   - make && make distcheck
index a68acd1f392841e8cde04fa9e0357e932b727f06..5a4c0aeb693f752d9d39ce70dad962515a873a6d 100644 (file)
@@ -15,12 +15,6 @@ m4, GNU Make, libtool, Autoconf, automake, Gettext, Help2man, Perl, Flex, Python
   make install
 #+END_SRC
 
-* Testing with Valgrind
-
-Currently, Valgrind does not play nice with CPython, even with a fairly extensive suppressions file. It works on Ubuntu with the debug build of Python, from the package ~python3-dbg~. Having installed this, configure with the option ~PYTHON=/usr/bin/python3-dbg~ (the full path is required).
-
-To ensure that Valgrind is used for testing releases too, the above setting can be added to ~DISTCHECK_CONFIGURE_FLAGS~.
-
 * Making a release
 
 To make a release, you'll need [[https://github.com/rrthomas/woger][woger]] and [[https://github.com/aktau/github-release][github-release]], suitably configured. Having tested and pushed all the changes, update the version number in =configure.ac= and write the =NEWS= entry and push those too.
index 69cdd759925ce5c306ea67de0a79c6112db09feb..a281ab18611b83a49d3e538de84c01bd7c1f453c 100644 (file)
@@ -1,4 +1,4 @@
-# bootstrap.conf (Recode) version 2019-05-20
+# bootstrap.conf (Recode) version 2019-09-11
 
 # This file is part of Recode.
 #
@@ -69,7 +69,6 @@ gnulib_modules='
         sys_wait
         unistd
         utime
-        valgrind-tests
         vasprintf
         vprintf-posix
         xalloc
index 313312acd2b1b3a365f9258ae54725526df1bf70..81d2c41000fa2f9d68204abbcbd59810323ba3da 100644 (file)
@@ -101,6 +101,9 @@ else
 fi
 AC_SUBST([ISYSTEM])
 
+# Extra settings for running tests, e.g. LD_PRELOAD for ASAN
+AC_SUBST([TESTS_ENVIRONMENT_EXTRA])
+
 AC_CONFIG_HEADERS([config.h])
 AC_HEADER_STDC
 AM_ICONV
index 68b894196c081ac5a409daa906644e4d45b4c7ee..5890c37d0dba2b0395255b4b2c63a18af7f43303 100644 (file)
@@ -33,12 +33,13 @@ DISTCLEANFILES = Recode.c
 clean-local:
        rm -f *@pyextext@
 
+# TESTS_ENVIRONMENT_EXTRA can be set at configure time
 check-local: Recode@pyextext@
-       if test -n "$(VALGRIND)"; then export VALGRIND='$(VALGRIND) --suppressions=$(srcdir)/valgrind-python.supp'; fi; \
        export LD_LIBRARY_PATH=$(top_builddir)/src/@objdir@; \
        export DYLD_LIBRARY_PATH=$(top_builddir)/src/@objdir@; \
+       export LSAN_OPTIONS=suppressions=$(srcdir)/asan-suppressions.txt; \
        RECODE=$(top_builddir)/src/recode$(EXEEXT) PYTHONPATH=.:$(srcdir) \
-         $$VALGRIND $(PYTHON) $(srcdir)/pytest $(LIMIT) $(srcdir)/t*.py
+         $(TESTS_ENVIRONMENT_EXTRA) $(PYTHON) $(srcdir)/pytest $(LIMIT) $(srcdir)/t*.py
 
 Recode@pyextext@: Recode.c setup.py
        rm -f *@pyextext@
diff --git a/tests/asan-suppressions.txt b/tests/asan-suppressions.txt
new file mode 100644 (file)
index 0000000..fac41eb
--- /dev/null
@@ -0,0 +1 @@
+leak:/bin/bash