Skip to content

Commit

Permalink
DP-6244 enable coverity
Browse files Browse the repository at this point in the history
  • Loading branch information
TimoSairiala committed Oct 26, 2023
1 parent 5752a1e commit 9e1ca7b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tiiuae-coverity-scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run coverity scan
run:
run: |
docker run --rm -v "$(pwd):/main_ws" ghcr.io/tiiuae/px4-coverity-scan-image:latest
- name: Update summary
run:
Expand Down
1 change: 1 addition & 0 deletions packaging/Dockerfile.coverity
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ RUN curl https://sig-repo.synopsys.com/artifactory/coverity-releases/2023.6.0/co
&& /coverity_install.sh -q --installation.dir=/cov --license.region=6 --license.agreement=agree --license.type.choice=0 --license.cov.path=/license.dat \
&& rm /coverity_install.sh

RUN apt update && apt install -y --no-install-recommends xmlstarlet
COPY px4-firmware/packaging/entrypoint_coverity.sh /
ENTRYPOINT [ "/entrypoint_coverity.sh" ]
2 changes: 1 addition & 1 deletion packaging/coverity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ capture:
commit:
connect:
auth-key-file: /auth_key.txt
stream: px4-coverity-test
stream: px4-coverity
url: https://coverity.ssrc.fi:443/
on-new-cert: trust
13 changes: 13 additions & 0 deletions packaging/entrypoint_coverity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ COVERITY_SCAN_OUT=/main_ws/cov-scan-output.txt
COVERITY_REPORT_OUT=/main_ws/coverity-output

cp /main_ws/packaging/coverity.yaml /main_ws/coverity.yaml
cd /main_ws
git config --global --add safe.directory '*'

export PATH=$PATH:/cov/bin/
cov-configure --gcc
Expand All @@ -29,4 +31,15 @@ echo '------' >> ${COVERITY_SUMMARY_OUT}

# save coverity html output
cov-format-errors --dir idir --html-output ${COVERITY_REPORT_OUT}

# github output to format table
echo "| checker | file |" >> ${COVERITY_SUMMARY_OUT}
echo "| ------- | ---- |" >> ${COVERITY_SUMMARY_OUT}

# findings from output xml, save error, filename and line number
# grep away files which begins with "/" as they are from the environment and not from the project
xmlstarlet sel -t -m "/coverity/error" -o "| " -v "checker" -o " | " -v "file" -o ":" -v "line" -o " |" -n ${COVERITY_REPORT_OUT}/index.xml | grep -v '.*[[:space:]]\/.*'>> ${COVERITY_SUMMARY_OUT}

# echo an empty line to end table formatting
echo '' >> ${COVERITY_SUMMARY_OUT}
echo 'for more details please check attached html report from "Artifacts" -sections above' >> ${COVERITY_SUMMARY_OUT}

0 comments on commit 9e1ca7b

Please sign in to comment.