Commit 34874fb2 authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼
Browse files

Merge branch 'cppcheck' into 'master'

Add cppcheck to CI pipeline

See merge request !14
parents 7e0ca3ec e61bb67c
Pipeline #333291 failed with stages
in 32 seconds
......@@ -56,3 +56,31 @@ test:unit:
echo "System is currently used by: $(who)"
echo "We are skipping the test. Please restart manually."
fi
test:cppcheck:
stage: test
script:
- cppcheck -j $(nproc)
--max-configs=32
--error-exitcode=1
--quiet
--inline-suppr
--enable=warning,performance,portability,information,missingInclude
--std=c++11
--suppress=noValidConfiguration
-I include
-I common/include
gpu/
src/
lib/
tests/unit/ | tee cppcheck.log
image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
dependencies:
- build:source
tags:
- docker
artifacts:
when: on_failure
paths:
- cppcheck.log
expose_as: cppcheck
......@@ -66,7 +66,7 @@ add_subdirectory(lib)
add_subdirectory(src)
if(CRITERION_FOUND AND TOPLEVEL_PROJECT)
add_subdirectory(tests)
add_subdirectory(tests/unit)
endif()
if(NOT CMAKE_PROJECT_NAME STREQUAL "villas-node")
......
......@@ -50,6 +50,7 @@ RUN yum -y install \
devtoolset-7-toolchain \
pkgconfig make cmake3 \
autoconf automake autogen libtool \
cppcheck \
texinfo git curl tar
# Several tools only needed for developement and testing
......@@ -65,24 +66,24 @@ RUN yum -y install \
# Build & Install Fmtlib
RUN git clone --recursive https://github.com/fmtlib/fmt.git /tmp/fmt && \
mkdir -p /tmp/fmt/build && cd /tmp/fmt/build && \
git checkout 5.2.0 && \
cmake3 -DBUILD_SHARED_LIBS=1 .. && \
make -j$(nproc) install && \
mkdir -p /tmp/fmt/build && cd /tmp/fmt/build && \
git checkout 5.2.0 && \
cmake3 -DBUILD_SHARED_LIBS=1 .. && \
make -j$(nproc) install && \
rm -rf /tmp/fmt
# Build & Install spdlog
RUN git clone --recursive https://github.com/gabime/spdlog.git /tmp/spdlog && \
mkdir -p /tmp/spdlog/build && cd /tmp/spdlog/build && \
git checkout v1.3.1 && \
cmake3 -DSPDLOG_FMT_EXTERNAL=ON -DSPDLOG_BUILD_BENCH=OFF .. && \
make -j$(nproc) install && \
mkdir -p /tmp/spdlog/build && cd /tmp/spdlog/build && \
git checkout v1.3.1 && \
cmake3 -DSPDLOG_FMT_EXTERNAL=ON -DSPDLOG_BUILD_BENCH=OFF .. && \
make -j$(nproc) install && \
rm -rf /tmp/spdlog
# Build & Install Criterion
RUN git clone --recursive https://github.com/Snaipe/Criterion /tmp/criterion && \
mkdir -p /tmp/criterion/build && cd /tmp/criterion/build && \
git checkout v2.3.3 && \
mkdir -p /tmp/criterion/build && cd /tmp/criterion/build && \
git checkout v2.3.3 && \
cmake3 .. && \
make -j$(nproc) install && \
rm -rf /tmp/*
......
......@@ -33,6 +33,7 @@
using namespace villas;
// cppcheck-suppress unknownMacro
Test(fpga, dma, .description = "DMA")
{
auto logger = logging.get("unit-test:dma");
......
......@@ -32,6 +32,7 @@
using namespace villas;
// cppcheck-suppress unknownMacro
Test(fpga, fifo, .description = "FIFO")
{
ssize_t len;
......
......@@ -90,6 +90,7 @@ static void fini()
state.cards.clear();
}
// cppcheck-suppress unknownMacro
TestSuite(fpga,
.init = init,
.fini = fini,
......
......@@ -39,7 +39,7 @@
using namespace villas;
// cppcheck-suppress unknownMacro
Test(fpga, gpu_dma, .description = "GPU DMA tests")
{
auto logger = logging.get("unit-test:dma");
......
......@@ -30,6 +30,7 @@
extern struct fpga_card *card;
// cppcheck-suppress unknownMacro
Test(fpga, hls_dft, .description = "HLS: hls_dft")
{
int ret;
......
......@@ -29,6 +29,7 @@
extern struct fpga_card *card;
// cppcheck-suppress unknownMacro
Test(fpga, intc, .description = "Interrupt Controller")
{
int ret;
......
......@@ -41,7 +41,7 @@
using namespace villas::fpga::ip;
// cppcheck-suppress unknownMacro
Test(fpga, rtds, .description = "RTDS")
{
auto logger = villas::logging.get("unit-test:rtds");
......
......@@ -68,6 +68,7 @@ static void dumpMem(const uint32_t* addr, size_t len)
}
}
// cppcheck-suppress unknownMacro
Test(fpga, rtds2gpu_loopback_dma, .description = "Rtds2Gpu")
{
auto logger = logging.get("unit-test:rtds2gpu");
......@@ -176,6 +177,7 @@ Test(fpga, rtds2gpu_loopback_dma, .description = "Rtds2Gpu")
}
}
// cppcheck-suppress unknownMacro
Test(fpga, rtds2gpu_rtt_cpu, .description = "Rtds2Gpu RTT via CPU")
{
auto logger = logging.get("unit-test:rtds2gpu");
......@@ -247,6 +249,7 @@ void gpu_rtds_rtt_start(volatile uint32_t* dataIn, volatile reg_doorbell_t* door
void gpu_rtds_rtt_stop();
// cppcheck-suppress unknownMacro
Test(fpga, rtds2gpu_rtt_gpu, .description = "Rtds2Gpu RTT via GPU")
{
auto logger = logging.get("unit-test:rtds2gpu");
......
......@@ -31,6 +31,7 @@
extern struct fpga_card *card;
// cppcheck-suppress unknownMacro
Test(fpga, rtds_rtt, .description = "RTDS: tight rtt")
{
int ret;
......
......@@ -29,6 +29,7 @@
#include <villas/config.h>
#include "global.hpp"
// cppcheck-suppress unknownMacro
Test(fpga, timer, .description = "Timer Counter")
{
auto logger = villas::logging.get("unit-test:timer");
......
......@@ -34,6 +34,7 @@
extern struct fpga_card *card;
// cppcheck-suppress unknownMacro
Test(fpga, xsg, .description = "XSG: multiply_add")
{
int ret;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment