From c583b0a70cb1e9d5bf52e89ee7efab03fd65de49 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sun, 18 Oct 2020 14:21:26 -0700 Subject: [PATCH] scripts, Makefile: move static_analysis_tests to a Makefile target To further trim down run_tests.sh, move the code that runs the clang static analyzer into a 'make' target. --- .travis.yml | 6 ++++-- Makefile | 7 ++++++- scripts/run_tests.sh | 12 ------------ 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 894bf58..17cd49f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,8 @@ matrix: - sudo apt-get install -y libz-dev gcc-multilib libz-dev:i386 libc6-dev-i386 clang script: - - scripts/run_tests.sh checksum_benchmarks static_analysis + - scripts/run_tests.sh checksum_benchmarks + - make scan-build - name: Native tests (Linux aarch64) os: linux @@ -40,7 +41,8 @@ matrix: before_install: - sudo apt-get install -y libz-dev clang script: - - scripts/run_tests.sh checksum_benchmarks static_analysis + - scripts/run_tests.sh checksum_benchmarks + - make scan-build - name: gzip and cross-compile-for-Windows tests (Linux) os: linux diff --git a/Makefile b/Makefile index e7359c4..d0eda8b 100644 --- a/Makefile +++ b/Makefile @@ -324,6 +324,10 @@ check:test_programs ./$$prog || exit 1; \ done +# Run the clang static analyzer. +scan-build: + scan-build --status-bugs make all test_programs + help: @echo "Available targets:" @echo "------------------" @@ -346,6 +350,7 @@ realclean: clean FORCE: -.PHONY: all install uninstall test_programs help clean realclean +.PHONY: all install uninstall test_programs check scan-build help \ + clean realclean .DEFAULT_GOAL = all diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index d84d7fc..53df547 100755 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -239,17 +239,6 @@ windows_tests() { ############################################################################### -static_analysis_tests() { - test_group_included static_analysis || return 0 - if ! type -P scan-build > /dev/null; then - log_skip "clang static analyzer (scan-build) not found" - return 0 - fi - run_cmd scan-build --status-bugs make -j$NPROC all test_programs -} - -############################################################################### - gzip_tests() { test_group_included gzip || return 0 @@ -288,7 +277,6 @@ native_tests freestanding_tests checksum_benchmarks windows_tests -static_analysis_tests gzip_tests if (( TESTS_SKIPPED )); then