From 23dd471f6b3e03fafb291d63c3bec10f1ee0d9f3 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 17 May 2019 17:11:21 +0100 Subject: [PATCH] Add clang analyzer check using scan-build --- .travis.yml | 6 +++++- scripts/static-analyser-check.sh | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100755 scripts/static-analyser-check.sh diff --git a/.travis.yml b/.travis.yml index cd2bde2..930af05 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,15 +2,18 @@ dist: xenial language: c compiler: gcc sudo: false - addons: apt: packages: + - clang - clang-format - python3-pip - python3-setuptools - libsystemd-dev - ninja-build + artifacts: + paths: + - $(git ls-files -o | tr "\n" ":") before_script: - pip3 install wheel @@ -21,3 +24,4 @@ script: - ./scripts/format-check.sh - ./bootstrap.sh -Dwith-examples=true - gamemoded -v + - ./scripts/static-analyser-check.sh \ No newline at end of file diff --git a/scripts/static-analyser-check.sh b/scripts/static-analyser-check.sh new file mode 100755 index 0000000..bee49a6 --- /dev/null +++ b/scripts/static-analyser-check.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Exit on failure +set -e + +# Build directly +cd build/ + +# Collect scan-build output +ninja scan-build | tee /tmp/scan-build-results.txt + +# Invert the output - if this string exists it's a fail +! grep -E '[0-9]+ bugs? found.' /tmp/scan-build-results.txt + \ No newline at end of file