Merge #18166: ci: Run fuzz testing test cases (bitcoin-core/qa-assets) under valgrind to catch memory errors

f2472f64604a0c583f950c56e8753d0bee246388 tests: Improve test runner output in case of target errors (practicalswift)
733bbec34fbec85574cc456832b2b2f807e5dce9 tests: Add --exclude integer,parse_iso8601 (temporarily) to make Travis pass until uninitialized read issue in FormatISO8601DateTime is fixed (practicalswift)
5ea81449f30a6fe6db3b6df5e8009f21a782ff44 tests: Add support for excluding fuzz targets using -x/--exclude (practicalswift)
555236f769c13518db70f5df36e5688d63486bd5 tests: Remove -detect_leaks=0 from test/fuzz/test_runner.py - no longer needed (practicalswift)
a3b539a924f8611abb3096f2bd9d35094b5577e3 ci: Run fuzz testing test cases under valgrind (practicalswift)

Pull request description:

  Run fuzz testing [test cases (bitcoin-core/qa-assets)](https://github.com/bitcoin-core/qa-assets) under `valgrind`.

  This would have caught `util: Avoid potential uninitialized read in FormatISO8601DateTime(int64_t) by checking gmtime_s/gmtime_r return value` (#18162) and similar cases.

ACKs for top commit:
  MarcoFalke:
    ACK f2472f64604a0c583f950c56e8753d0bee246388 👼

Tree-SHA512: bb0879d40167cf6906bc0ed31bed39db83c39c7beb46026f7b0ee53f28ff0526ad6fabc3f4cb3f5f18d3b8cafdcbf5f30105b35919f4e83697c71e838ed71493
This commit is contained in:
MarcoFalke 2020-02-19 08:20:27 -08:00 committed by munkybooty
parent 1d5bdbc724
commit f7d51ad13a
3 changed files with 31 additions and 0 deletions

View File

@ -257,6 +257,12 @@ after_success:
name: 'x86_64 Linux [GOAL: install] [bionic] [no wallet]' name: 'x86_64 Linux [GOAL: install] [bionic] [no wallet]'
env: >- env: >-
FILE_ENV="./ci/test/00_setup_env_native_fuzz.sh" FILE_ENV="./ci/test/00_setup_env_native_fuzz.sh"
- stage: test
name: 'x86_64 Linux [GOAL: install] [bionic] [no depends, only system libs, fuzzers under valgrind]'
env: >-
FILE_ENV="./ci/test/00_setup_env_native_fuzz_with_valgrind.sh"
- stage: test - stage: test
env: >- env: >-
FILE_ENV="./ci/test/00_setup_env_native_nowallet.sh" FILE_ENV="./ci/test/00_setup_env_native_nowallet.sh"

View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
#
# Copyright (c) 2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
export LC_ALL=C.UTF-8
export CONTAINER_NAME=ci_native_fuzz_valgrind
export PACKAGES="clang-8 llvm-8 python3 libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev valgrind"
export NO_DEPENDS=1
export RUN_UNIT_TESTS=false
export RUN_FUNCTIONAL_TESTS=false
export RUN_FUZZ_TESTS=true
export FUZZ_TESTS_CONFIG="--exclude integer,parse_iso8601 --valgrind"
export GOAL="install"
export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer CC=clang-8 CXX=clang++-8"
# Use clang-8, instead of default clang on bionic, which is clang-6 and does not come with libfuzzer on aarch64

View File

@ -267,6 +267,13 @@ def run_once(*, fuzz_pool, corpus, test_list, build_dir, use_valgrind):
logging.debug(output) logging.debug(output)
try: try:
result.check_returncode() result.check_returncode()
except subprocess.CalledProcessError as e:
if e.stdout:
logging.info(e.stdout)
if e.stderr:
logging.info(e.stderr)
logging.info("Target \"{}\" failed with exit code {}: {}".format(t, e.returncode, " ".join(args)))
sys.exit(1)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
if e.stdout: if e.stdout:
logging.info(e.stdout) logging.info(e.stdout)