Ericsson / clang

Cross Translation Unit analysis capability for Clang Static Analyzer. (Fork of official clang at http://llvm.org/git/clang)
http://clang.llvm.org/
Other
15 stars 10 forks source link

identify the patches needed to be upstreamed for the CURL to be analyzed #548

Closed dkrupp closed 5 years ago

dkrupp commented 5 years ago

so this job should pass: http://ci2.codechecker.gic.ericsson.se:8080/job/Step8-curl-ctu-scanbuild-upstream-master/

gamesh411 commented 5 years ago

Reproduction strategy: on ctu-clang7 branch:

git bisect start
git bisect good de97def3fc
git bisect bad HEAD
git bisect start bash ../test_ctu.sh

where good label indicates that the tests fail, and bad the opposite.

test_ctu.sh for detecting assertions:

#! /bin/bash

clang_home="/home/efulop/projects/clang-reproduction"

# Build Clang
echo "Building!"
make -C "${clang_home}" -j 16

# Check code
echo "Analyzing!"
PATH="${clang_home}/bin:$PATH" \
  CodeChecker analyze /home/efulop/projects/reproduction.json \
  --ctu -j16 -c -o    /home/efulop/projects/reproduction_reports

echo "Testing!"
faildir="/home/efulop/projects/reproduction_reports/failed"
if [[ -d "${faildir}" ]]; then

  echo "There is a fail directory!"
  mkdir "${faildir}/stderrs"

  for zipfile in "${faildir}"/*.zip; do
    unzip "${zipfile}" stderr -d "${faildir}"
    local tu_name
    tu_name="${zipfile##*/}"
    tu_name="${tu_name%%.*}"
    mv "${faildir}/stderr" "${faildir}/stderrs/${tu_name}.stderr"
  done

  grep -rsn 'Assertion' "${faildir}/stderrs"
  found_asserts="$?"
  exit "${found_asserts}"
fi

exit 1

de97def3fc is the branching point from upstream clang release_70.

test_ctu.sh is used to build clang, run ctu-analysis, and indicate "goodness" of currently analyzed commit.

2 bisect analyses were made on Curl 7.62 github release: one to find the first commit where there is no error at all and one to find the first commit where there is no assertion

first commit without error: 693a4f330c first commit without assertion: 13b04000df