diff --git a/.travis.yml b/.travis.yml index c1bd6da5..312aedef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,38 +24,38 @@ matrix: osx_image: xcode9.4 env: CC=cc CXX=c++ -script: > - if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then - git fetch --unshallow --tags --prune && - git submodule foreach --recursive git fetch --unshallow --tags --prune && - (if which clang-format-6.0 > /dev/null && make reformat && [[ -n $(git diff) ]]; - then - echo "You must run 'make reformat' before submitting a pull request"; - echo ""; - git diff; - exit -1; - fi) && - make --keep-going all && MALLOC_CHECK_=7 MALLOC_PERTURB_=42 make --keep-going check - else - [ ! -s cov-int/scm_log.txt ] || cat cov-int/scm_log.txt; - fi && sleep 3 - env: global: - secure: "M+W+heGGyRQJoBq2W0uqWVrpL4KBXmL0MFL7FSs7f9vmAaDyEgziUXeZRj3GOKzW4kTef3LpIeiu9SmvqSMoQivGGiomZShqPVl045o/OUgRCAT7Al1RLzEZ0efSHpIPf0PZ6byEf6GR2ML76OfuL6JxTVdnz8iVyO2sgLE1HbX1VeB+wgd/jfMeOBhCCXskfK6MLyZihfMYsiYZYSaV98ZDhDLSlzuuRIgzb0bMi8aL6AErs0WLW0NelRBeHkKPYfAUc85pdQHscgrJw6Rh/zT6+8BQ/q5f4IgWhiu4xoRg3Ngl7SNoedRQh93ADM3UG2iGl6HDFpVORaXcFWKAtuYY+kHQ0HB84BRYpQmeBuXNpltsfxQ3d1Q3u0RlE45zRvmr2+X1mFnkcNUAWISLPbsOUlriDQM8irGwRpho77/uYnRC00bJsHW//s6+uPf9zrAw1nI4f0y3PAWukGF/xs6HAI3FZPsuSSnx18Tj3Opgbc9Spop+V3hkhdiJoPGpNKTkFX4ZRXfkPgoRVJmtp4PpbpH0Ps/mCriKjMEfGGi0HcVCi0pEGLXiecdqJ5KPg5+22zNycEujQBJcNTKd9shN+R3glrbmhAxTEzGdGwxXXJ2ybwJ2PWJLMYZ7g98nLyX+uQPaA3BlsbYJHNeS5283/9pJsd9DzfHKsN2nFSc=" -before_install: - - echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- - - ${CC} --version - - ${CXX} --version +before_script: | + if [ "${TRAVIS_BRANCH}" = "coverity_scan" ]; then + # call Coverity Scan manually of addons.coverity_scan for first job only + if [ "${TRAVIS_JOB_NUMBER}" = "${TRAVIS_BUILD_NUMBER}.1" ]; then + export COVERITY_SCAN_BRANCH=1 + echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- + curl -s 'https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh' -o coverity_scan.sh + else + echo 'echo "Skip CoverityScan for unrelated os/compiler"' > coverity_scan.sh + fi + elif [ "${TRAVIS_JOB_NUMBER}" = "${TRAVIS_BUILD_NUMBER}.1" ] && make reformat && [[ -n $(git diff) ]]; then + echo "You must run 'make reformat' before submitting a pull request" + echo "" + git diff + exit -1 + fi -addons: - coverity_scan: - project: - name: "ReOpen/libmdbx" - version: 0.1 - description: "Build submitted via Travis CI" - notification_email: leo@yuriev.ru - build_command_prepend: "git fetch --unshallow --tags --prune && make dist" - build_command: "make MDBX_OPTIONS=-DMDBX_DEBUG=2 -C dist all" - branch_pattern: coverity_scan +script: | + ${CC} --version + ${CXX} --version + git fetch --unshallow --tags --prune || exit 1 + if [ ! -s ./coverity_scan.sh ]; then + make --keep-going all && MALLOC_CHECK_=7 MALLOC_PERTURB_=42 make --keep-going check + else + COVERITY_SCAN_PROJECT_NAME="ReOpen/libmdbx" \ + COVERITY_SCAN_NOTIFICATION_EMAIL="leo@yuriev.ru" \ + COVERITY_SCAN_BUILD_COMMAND_PREPEND="" \ + COVERITY_SCAN_BUILD_COMMAND="make MDBX_OPTIONS=-DMDBX_DEBUG=2 build-test" \ + COVERITY_SCAN_BRANCH_PATTERN="$TRAVIS_BRANCH" \ + bash ./coverity_scan.sh || cat cov-int/scm_log.txt + fi diff --git a/GNUmakefile b/GNUmakefile index cf3dc1b9..5ea424b5 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -146,9 +146,11 @@ MDBX_GIT_DESCRIBE = $(shell git describe --tags --long --dirty=-dirty || echo 'P MDBX_VERSION_SUFFIX = $(shell set -o pipefail; echo -n '$(MDBX_GIT_DESCRIBE)' | tr -c -s '[a-zA-Z0-9]' _) MDBX_BUILD_SOURCERY = $(shell set -o pipefail; $(MAKE) -s src/version.c && (openssl dgst -r -sha256 src/version.c || sha256sum src/version.c || shasum -a 256 src/version.c) 2>/dev/null | cut -d ' ' -f 1 || echo 'Please install openssl or sha256sum or shasum')_$(MDBX_VERSION_SUFFIX) -check: test mdbx_example dist +check: test dist -test: all mdbx_example mdbx_test +build-test: all mdbx_example mdbx_test + +test: build-test rm -f $(TEST_DB) $(TEST_LOG) && (set -o pipefail; \ (./mdbx_test --progress --console=no --repeat=$(TEST_ITER) --pathname=$(TEST_DB) --dont-cleanup-after basic && \ ./mdbx_test --mode=-writemap,-mapasync,-lifo --progress --console=no --repeat=12 --pathname=$(TEST_DB) --dont-cleanup-after basic) \ diff --git a/Makefile b/Makefile index 15f9d69c..66a5f50e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -all install mdbx tools strip clean test check dist test-singleprocess test-fault memcheck test-valgrind cross-gcc cross-qemu bench bench-quartet clean-bench reformat: +all install mdbx tools strip clean test check dist test-singleprocess test-fault memcheck test-valgrind cross-gcc cross-qemu bench bench-quartet clean-bench reformat build-test: @CC=$(CC) \ CXX=`if test -n "$(CXX)" && which "$(CXX)" > /dev/null; then echo "$(CXX)"; elif test -n "$(CCC)" && which "$(CCC)" > /dev/null; then echo "$(CCC)"; else echo "c++"; fi` \ `which gmake || which gnumake || echo 'echo "GNU Make is required"; exit 2;'` \