From 7a5b2019e8820b21917f271572bff4cb61562d25 Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Wed, 5 Feb 2020 15:06:39 +0100 Subject: [PATCH] autobuild.sh: don't rely on make output in listing not-built files To get the list of not-built files, we used to concatenate the list of files expected to be built and a specific chunk of the `make` output, then we cut out any repeated lines. Selecting that specific chunk of make output used to rely on 'Leaving directory' string from make, which apparently doesn't appear under certain circumstances, causing the build to fail with false-positives. Rewrite this code not to rely (this much) on make output: 1. get the list of files expected to be built 2. get the list of all built files 3. check if any file from #1 is not in #2 ^ comm utility does exactly that Change-Id: I6c6c1267c738f23d6804fe5c108cd80141329d10 Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/550 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Tomasz Zawadzki --- autobuild.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/autobuild.sh b/autobuild.sh index c4f2189920..fefa461ee9 100755 --- a/autobuild.sh +++ b/autobuild.sh @@ -58,13 +58,22 @@ function scanbuild_make { pass=true $scanbuild $MAKE $MAKEFLAGS > $out/build_output.txt && rm -rf $out/scan-build-tmp || make_fail_cleanup for ent in $(find app examples lib module -type f | grep -vF ".h"); do + if [[ $ent == lib/env_ocf* ]]; 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 done - sed -n '/Leaving directory /,$p' $out/build_output.txt | grep -E "CC|CXX" | sed 's/\s\s\(CC\|CXX\)\s//g' | sed 's/\.o//g' > $out/built_c_files.txt - paste -d '\n' $out/all_c_files.txt $out/built_c_files.txt $rootdir/test/common/skipped_build_files.txt | grep -vE "^test|lib/env_ocf|#" | sort | uniq -u > $out/unbuilt_c_files.txt + grep -E "CC|CXX" $out/build_output.txt | sed 's/\s\s\(CC\|CXX\)\s//g' | sed 's/\.o//g' > $out/built_c_files.txt + cat $rootdir/test/common/skipped_build_files.txt >> $out/built_c_files.txt + + sort -o $out/all_c_files.txt $out/all_c_files.txt + sort -o $out/built_c_files.txt $out/built_c_files.txt + # from comm manual: + # -2 suppress column 2 (lines unique to FILE2) + # -3 suppress column 3 (lines that appear in both files) + # comm may exit 1 if no lines were printed (undocumented) + ! comm -2 -3 $out/all_c_files.txt $out/built_c_files.txt > $out/unbuilt_c_files.txt if [ $(wc -l < $out/unbuilt_c_files.txt) -ge 1 ]; then echo "missing files"