Disable Valgrind by default during testing (#3269)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Previously, the configure script automatically enables Valgrind during testing when the valgrind command is found. However, running tests with Valgrind is quite slow, so it is better to disable it by default, and to enable it only when the user specifies the `--enable-valgrind` flag.
authored by itchyny · committed by GitHub · parent c4e1fb0 · Browse files · 8 files·+19 added−29 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
8 files+19 added−29 removed
- tests:+1 added−1 removed
- other:+18 added−28 removed
Provenance
- Commit
5df471f- Tree
37b1d3d- Author
itchyny <itchyny@cybozu.co.jp>- Committer
GitHub <noreply@github.com>- Parent
c4e1fb0
8 files changed+19 added−29 removed
modified:.github/workflows/ci.yml-4 removed
86 unmodified lines87 autoreconf -i88 ./configure \89 --host=${{ matrix.CC }} \90 --disable-docs \91- --disable-valgrind \91 --with-oniguruma=builtin \92 --enable-static \93 --enable-all-static \94 CFLAGS="-O2 -pthread -fstack-protector-all"57 unmodified lines152 autoreconf -i153 ./configure \154 --host="${{ matrix.target }}$(uname -r)" \155 --disable-docs \157- --disable-valgrind \156 --with-oniguruma=builtin \157 --enable-static \158 --enable-all-static \159 CFLAGS="-O2 -pthread -fstack-protector-all"67 unmodified lines227 run: |228 autoreconf -i229 ./configure \230 --disable-docs \233- --disable-valgrind \231 --with-oniguruma=builtin \232 --disable-shared \233 --enable-static \234 --enable-all-static \37 unmodified lines272 run: |273 autoreconf -i274 ./configure \275 --disable-docs \279- --disable-valgrind \276 --with-oniguruma=builtin277 make distcheck278 make dist dist-zip279 git diff --exit-code140 unmodified linesmodified:.github/workflows/oniguruma.yml+2 added
20 unmodified lines21222324252627282924 unmodified lines54555657585960616213 unmodified lines20 unmodified lines run: | autoreconf -i ./configure \ --disable-docs \ --enable-valgrind \ --with-oniguruma=yes make -j"$(nproc)" file ./jq - name: Test24 unmodified lines run: | autoreconf -i ./configure \ --disable-docs \ --enable-valgrind \ --with-oniguruma=no make -j"$(nproc)" file ./jq - name: Test13 unmodified linesmodified:.github/workflows/scanbuild.yml+1 added-1 removed
47 unmodified lines4849505152525354555619 unmodified lines47 unmodified lines CC: ${{ matrix.compiler }} MAKEVARS: ${{ matrix.makevars }} run: | autoreconf -i ./configure --with-oniguruma=builtin $COVERAGE ./configure --with-oniguruma=builtin --enable-valgrind $COVERAGE scan-build --keep-going make -j4 - name: Test env: CC: ${{ matrix.compiler }}19 unmodified linesmodified:.github/workflows/valgrind.yml+1 added
20 unmodified lines21222324252627282912 unmodified lines20 unmodified lines run: | autoreconf -i ./configure \ --disable-docs \ --enable-valgrind \ --with-oniguruma=builtin make -j"$(nproc)" file ./jq - name: Test12 unmodified linesmodified:tests/setup+1 added-1 removed
14 unmodified lines15 # Some tests have locale-dependent output; use C locale. Fixes #303816 LC_ALL=C17 export LC_ALL18 19-if [ -z "${NO_VALGRIND-}" ] && which valgrind > /dev/null; then19+if [ -n "${ENABLE_VALGRIND-}" ] && which valgrind > /dev/null; then20 VALGRIND="valgrind --error-exitcode=1 --leak-check=full \21 --suppressions=$JQTESTDIR/onig.supp \22 --suppressions=$JQTESTDIR/local.supp"23 VG_EXIT0=--error-exitcode=024 unmodified linesmodified:configure.ac+3 added-10 removed
37 unmodified lines38 39 AC_CHECK_PROGS(LEX, flex lex)40 fi41 42-dnl Check for valgrind43-AC_CHECK_PROGS(valgrind_cmd, valgrind)44-if test "x$valgrind_cmd" = "x" ; then45- AC_MSG_WARN([valgrind is required to test jq.])46-fi42 AC_CHECK_FUNCS(memmem)43 44 AC_CHECK_HEADER("sys/cygwin.h", [have_cygwin=1;])45 AC_CHECK_HEADER("shlwapi.h",[have_shlwapi=1;])2 unmodified lines48 dnl Running tests with Valgrind is slow. It is faster to iterate on49 dnl code without Valgrind until tests pass, then enable Valgrind and50 dnl fix leaks.51 AC_ARG_ENABLE([valgrind],57- AS_HELP_STRING([--disable-valgrind],[do not run tests under Valgrind]))52+ AS_HELP_STRING([--enable-valgrind],[enable Valgrind during testing]))53 59-dnl Running tests with Valgrind is slow; address sanitizer (ASAN) is60-dnl faster.54+dnl Address sanitizer (ASan)55 AC_ARG_ENABLE([asan],56 AS_HELP_STRING([--enable-asan],[enable address sanitizer]))57 58 dnl Undefined Behavior Sanitizer48 unmodified lines107 AS_IF([test "x$enable_decnum" != "xno"],[108 AC_DEFINE([USE_DECNUM], 1, [Define to enable decnum support.])109 ])110 117-AM_CONDITIONAL([ENABLE_VALGRIND], [test "x$enable_valgrind" != xno])111+AM_CONDITIONAL([ENABLE_VALGRIND], [test "x$enable_valgrind" = xyes])112 AM_CONDITIONAL([ENABLE_ASAN], [test "x$enable_asan" = xyes])113 AM_CONDITIONAL([ENABLE_UBSAN], [test "x$enable_ubsan" = xyes])114 AM_CONDITIONAL([ENABLE_GCOV], [test "x$enable_gcov" = xyes])115 AM_CONDITIONAL([ENABLE_DOCS], [test "x$enable_docs" != xno])168 unmodified lines284 AC_SUBST(onig_LDFLAGS)285 286 AM_CONDITIONAL([BUILD_ONIGURUMA], [test "x$build_oniguruma" = xyes])287 AM_CONDITIONAL([WITH_ONIGURUMA], [test "x$with_oniguruma" != xno])294-AC_SUBST([BUNDLER], ["$bundle_cmd"])288 289 AC_CONFIG_MACRO_DIRS([config/m4 m4])290 AC_CONFIG_HEADERS([src/config.h])291 CFLAGS="$CFLAGS --include src/config.h"3 unmodified linesmodified:Dockerfile-1 removed
17 unmodified lines18 COPY . /app19 RUN autoreconf -i \20 && ./configure \21 --disable-docs \22- --disable-valgrind \22 --with-oniguruma=builtin \23 --enable-static \24 --enable-all-static \25 --prefix=/usr/local \9 unmodified linesmodified:Makefile.am+11 added-12 removed
63 unmodified lines64 endif65 66 include_HEADERS = src/jv.h src/jq.h67 68-if ENABLE_UBSAN69-AM_CFLAGS += -fsanitize=undefined70-endif71-68 AM_CPPFLAGS = -I$(srcdir)/src -I$(srcdir)/vendor69 74-### Running tests under Valgrind70+### Address sanitizer (ASan)71 72 if ENABLE_ASAN73 AM_CFLAGS += -fsanitize=address78-NO_VALGRIND = 179-else80-if ENABLE_VALGRIND81-NO_VALGRIND =82-else83-NO_VALGRIND = 174 endif75+76+### Undefined Behavior Sanitizer77+78+if ENABLE_UBSAN79+AM_CFLAGS += -fsanitize=undefined80 endif81 82 ### Code coverage with gcov83 37 unmodified lines121 TESTS = tests/mantest tests/jqtest tests/shtest tests/utf8test tests/base64test tests/uritest122 if !WIN32123 TESTS += tests/optionaltest124 endif130-AM_TESTS_ENVIRONMENT = JQ=$(abs_builddir)/jq NO_VALGRIND=$(NO_VALGRIND)125 126+AM_TESTS_ENVIRONMENT = JQ=$(abs_builddir)/jq127+if ENABLE_VALGRIND128+AM_TESTS_ENVIRONMENT += ENABLE_VALGRIND=1129+endif130+131 # This is a magic make variable that causes it to treat tests/man.test as a132 # DATA-type dependency for the check target. As a result, it will attempt to133 # run any defined targets for tests/man.test as a dependency for check. This134 # allows us to ensure that the tests are up-to-date if the manual has been updated100 unmodified lines