summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2018-11-22 17:19:21 +0100
committerDaiki Ueno <ueno@gnu.org>2018-11-22 18:17:17 +0100
commitb92e8c7f5c082a55073903d53293e6aeecb9d0ed (patch)
tree325ca4631756d8015333a78475c1c69f0a265778
parentd293fd54c754190da333496df070992e2d803a87 (diff)
travis: Add cppcheck profile
-rw-r--r--.travis.yml4
-rw-r--r--.travis/cppcheck/after_failure.sh3
-rw-r--r--.travis/cppcheck/before_install.sh9
-rw-r--r--.travis/cppcheck/install.sh14
-rw-r--r--.travis/cppcheck/script.sh3
5 files changed, 33 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml
index 7c954a1..1be53bd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -24,6 +24,10 @@ matrix:
sudo: required
services: docker
env: BUILD_OPTS="--host=x86_64-w64-mingw32 --without-libffi" CHECK_OPTS="LOG_COMPILER=/srcdir/build/wine-wrapper.sh" SRCDIR=/srcdir BUILDDIR=/builddir EXTRA_PKGS="mingw64-gcc mingw64-libffi mingw64-libtasn1 wine"
+ - os: linux
+ sudo: required
+ services: docker
+ env: PROFILE=cppcheck SRCDIR=/srcdir BUILDDIR=/builddir EXTRA_PKGS="cppcheck"
- os: osx
language: c
diff --git a/.travis/cppcheck/after_failure.sh b/.travis/cppcheck/after_failure.sh
new file mode 100644
index 0000000..c4196f5
--- /dev/null
+++ b/.travis/cppcheck/after_failure.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+docker exec $CONTAINER su - user sh -c "cd $BUILDDIR && cat cppcheck.log"
diff --git a/.travis/cppcheck/before_install.sh b/.travis/cppcheck/before_install.sh
new file mode 100644
index 0000000..454b9eb
--- /dev/null
+++ b/.travis/cppcheck/before_install.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+docker pull fedora
+export CONTAINER=$(docker run -d fedora sleep 1800)
+
+docker exec $CONTAINER dnf -y install 'dnf-command(builddep)'
+docker exec $CONTAINER dnf -y builddep p11-kit
+docker exec $CONTAINER dnf -y install gettext-devel git libtool make opensc openssl valgrind $EXTRA_PKGS
+docker exec $CONTAINER useradd user
diff --git a/.travis/cppcheck/install.sh b/.travis/cppcheck/install.sh
new file mode 100644
index 0000000..a7257d0
--- /dev/null
+++ b/.travis/cppcheck/install.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+docker cp . $CONTAINER:/srcdir
+docker exec $CONTAINER cp -R /srcdir /coverage
+docker exec $CONTAINER mkdir /builddir
+docker exec $CONTAINER chown -R user /builddir
+docker exec $CONTAINER mkdir /installdir
+docker exec $CONTAINER mkdir -p /installdir/etc/pki/ca-trust-source
+docker exec $CONTAINER mkdir -p /installdir/share/pki/ca-trust-source
+docker exec $CONTAINER chown -R user /installdir
+# FIXME: This is needed because some files are included in distribution
+# and need to be generated in $srcdir rather than $builddir
+docker exec $CONTAINER chown -R user /srcdir
+docker exec $CONTAINER chown -R user /coverage
diff --git a/.travis/cppcheck/script.sh b/.travis/cppcheck/script.sh
new file mode 100644
index 0000000..5dcfa23
--- /dev/null
+++ b/.travis/cppcheck/script.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+docker exec $CONTAINER sh -c "cd $SRCDIR && find common p11-kit trust -name '*.c' -print | cppcheck -f --platform=unix64 --relative-paths --language=c --quiet -I common -I p11-kit -I trust --file-list=- --inline-suppr --template='{file}:{line},{severity},{id},{message}' --error-exitcode=1 2> $BUILDDIR/cppcheck.log"