Skip to content
Myr

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

8 files+19 added−29 removed

modified:.github/workflows/ci.yml-4 removed
86 unmodified lines
87 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 lines
152 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 lines
227 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 lines
272 run: |273 autoreconf -i274 ./configure \275 --disable-docs \279 --disable-valgrind \276 --with-oniguruma=builtin277 make distcheck278 make dist dist-zip279 git diff --exit-code
140 unmodified lines
modified:.github/workflows/oniguruma.yml+2 added
modified:.github/workflows/scanbuild.yml+1 added-1 removed
modified:.github/workflows/valgrind.yml+1 added
modified:tests/setup+1 added-1 removed
14 unmodified lines
15# Some tests have locale-dependent output; use C locale. Fixes #303816LC_ALL=C17export LC_ALL1819if [ -z "${NO_VALGRIND-}" ] && which valgrind > /dev/null; then19if [ -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=0
24 unmodified lines
modified:configure.ac+3 added-10 removed
37 unmodified lines
3839 AC_CHECK_PROGS(LEX, flex lex)40fi4142dnl Check for valgrind43AC_CHECK_PROGS(valgrind_cmd, valgrind)44if test "x$valgrind_cmd" = "x" ; then45 AC_MSG_WARN([valgrind is required to test jq.])46fi42AC_CHECK_FUNCS(memmem)4344AC_CHECK_HEADER("sys/cygwin.h", [have_cygwin=1;])45AC_CHECK_HEADER("shlwapi.h",[have_shlwapi=1;])
2 unmodified lines
48dnl Running tests with Valgrind is slow. It is faster to iterate on49dnl code without Valgrind until tests pass, then enable Valgrind and50dnl fix leaks.51AC_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]))5359dnl Running tests with Valgrind is slow; address sanitizer (ASAN) is60dnl faster.54dnl Address sanitizer (ASan)55AC_ARG_ENABLE([asan],56 AS_HELP_STRING([--enable-asan],[enable address sanitizer]))5758dnl Undefined Behavior Sanitizer
48 unmodified lines
107AS_IF([test "x$enable_decnum" != "xno"],[108 AC_DEFINE([USE_DECNUM], 1, [Define to enable decnum support.])109])110117AM_CONDITIONAL([ENABLE_VALGRIND], [test "x$enable_valgrind" != xno])111AM_CONDITIONAL([ENABLE_VALGRIND], [test "x$enable_valgrind" = xyes])112AM_CONDITIONAL([ENABLE_ASAN], [test "x$enable_asan" = xyes])113AM_CONDITIONAL([ENABLE_UBSAN], [test "x$enable_ubsan" = xyes])114AM_CONDITIONAL([ENABLE_GCOV], [test "x$enable_gcov" = xyes])115AM_CONDITIONAL([ENABLE_DOCS], [test "x$enable_docs" != xno])
168 unmodified lines
284AC_SUBST(onig_LDFLAGS)285286AM_CONDITIONAL([BUILD_ONIGURUMA], [test "x$build_oniguruma" = xyes])287AM_CONDITIONAL([WITH_ONIGURUMA], [test "x$with_oniguruma" != xno])294AC_SUBST([BUNDLER], ["$bundle_cmd"])288289AC_CONFIG_MACRO_DIRS([config/m4 m4])290AC_CONFIG_HEADERS([src/config.h])291CFLAGS="$CFLAGS --include src/config.h"
3 unmodified lines
modified:Dockerfile-1 removed
17 unmodified lines
18COPY . /app19RUN 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 lines
modified:Makefile.am+11 added-12 removed
63 unmodified lines
64endif6566include_HEADERS = src/jv.h src/jq.h6768if ENABLE_UBSAN69AM_CFLAGS += -fsanitize=undefined70endif7168AM_CPPFLAGS = -I$(srcdir)/src -I$(srcdir)/vendor6974### Running tests under Valgrind70### Address sanitizer (ASan)7172if ENABLE_ASAN73AM_CFLAGS += -fsanitize=address78NO_VALGRIND = 179else80if ENABLE_VALGRIND81NO_VALGRIND =82else83NO_VALGRIND = 174endif7576### Undefined Behavior Sanitizer7778if ENABLE_UBSAN79AM_CFLAGS += -fsanitize=undefined80endif8182### Code coverage with gcov83
37 unmodified lines
121TESTS = tests/mantest tests/jqtest tests/shtest tests/utf8test tests/base64test tests/uritest122if !WIN32123TESTS += tests/optionaltest124endif130AM_TESTS_ENVIRONMENT = JQ=$(abs_builddir)/jq NO_VALGRIND=$(NO_VALGRIND)125126AM_TESTS_ENVIRONMENT = JQ=$(abs_builddir)/jq127if ENABLE_VALGRIND128AM_TESTS_ENVIRONMENT += ENABLE_VALGRIND=1129endif130131# 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 updated
100 unmodified lines