test/build: add test directory to scanbuild verification

scanbuild_make verifies if all files in repository were
scanned by scanbuild. 'test' directory was not part of this
check, even though it contains C files with applications
used during tests.

This change does not affect what gets, and what does not
scanned by scanbuild. Only what we verify that was.
It will help to spot any files accidentally skipped.

This patch adds 'test' directory to the check.
Along with skipping directories when not compiled with:
- Functional tests disabled - don't check 'test', but still check 'test/unit'
- Unit tests disabled - don't check 'test/unit'

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I01e16de83827022c412a57df379280bfed671797
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1212
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
This commit is contained in:
Tomasz Zawadzki 2020-03-10 05:24:28 -04:00
parent 79c28aa698
commit 606ba0c321

View File

@ -58,9 +58,11 @@ function scanbuild_make {
pass=true
$scanbuild $MAKE $MAKEFLAGS > $out/build_output.txt && rm -rf $out/scan-build-tmp || make_fail_cleanup
xtrace_disable
for ent in $(find app examples lib module -type f | grep -vF ".h"); do
for ent in $(find app examples lib module test -type f | grep -vF ".h"); do
if [[ $ent == lib/env_ocf* ]]; then continue; fi
if [[ SPDK_RUN_FUNCTIONAL_TEST -eq 0 && $ent == examples* ]]; then continue; fi
if [[ SPDK_RUN_FUNCTIONAL_TEST -eq 0 && $ent == test* && $end != test/unit* ]]; then continue; fi
if [[ SPDK_TEST_UNITTEST -eq 0 && $end == test/unit* ]]; then continue; fi
if file -bi $ent | grep -q 'text/x-c'; then
echo $ent | sed 's/\.cp\{0,2\}$//g' >> $out/all_c_files.txt
fi