Files
xen/automation/build/debian/unstable-cppcheck.dockerfile
T
Michal Orzel bfc3780f23 automation: Add container and build jobs to run cppcheck analysis
Add a debian container with cppcheck installation routine inside,
capable of performing cppcheck analysis on Xen-only build including
cross-builds for arm32 and x86_64.

Populate build jobs making use of that container to run cppcheck
analysis to produce a text report (xen-cppcheck.txt) containing the list
of all the findings.

This patch does not aim at performing any sort of bisection. Cppcheck is
imperfect and for now, our goal is to at least be aware of its reports,
so that we can compare them with the ones produced by better tools and
to be able to see how these reports change as a result of further
infrastructure improvements (e.g. exception list, rules exclusion).

Signed-off-by: Michal Orzel <michal.orzel@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2023-02-27 14:12:35 -08:00

54 lines
1.5 KiB
Docker

FROM arm64v8/debian:unstable AS builder
ENV DEBIAN_FRONTEND=noninteractive
ENV CPPCHECK_VERSION=2.7
ENV USER root
# dependencies for cppcheck build
RUN apt-get update && \
apt-get --quiet --yes install \
curl \
build-essential \
python-is-python3 \
libpcre3-dev
RUN mkdir /build
WORKDIR /build
# cppcheck release build (see cppcheck readme.md)
RUN curl -fsSLO https://github.com/danmar/cppcheck/archive/"$CPPCHECK_VERSION".tar.gz && \
tar xvzf "$CPPCHECK_VERSION".tar.gz && \
cd cppcheck-"$CPPCHECK_VERSION" && \
make install -j$(nproc) \
MATCHCOMPILER=yes \
FILESDIR=/usr/share/cppcheck \
HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function"
FROM arm64v8/debian:unstable
COPY --from=builder /usr/bin/cppcheck /usr/bin/cppcheck
COPY --from=builder /usr/share/cppcheck /usr/share/cppcheck
LABEL maintainer.name="The Xen Project" \
maintainer.email="xen-devel@lists.xenproject.org"
ENV DEBIAN_FRONTEND=noninteractive
ENV USER root
RUN mkdir /build
WORKDIR /build
# dependencies for cppcheck analysis including Xen-only build/cross-build
RUN apt-get update && \
apt-get --quiet --yes install \
build-essential \
python-is-python3 \
libpcre3-dev \
flex \
bison \
gcc-arm-linux-gnueabihf \
gcc-x86-64-linux-gnu \
&& \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*