Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ configure
configure~
libtool
stamp-h1
.deps/
.dirstamp
.libs/
*.o
*.lo
*.la
*.gcda
*.gcno
*.log
*.tar.gz
**/.deps/
**/.dirstamp
**/.libs/
**/*.o
**/*.lo
**/*.la
**/*.gcda
**/*.gcno
**/*.log
**/*.tar.gz

# the built binary itself
/spine
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# +-------------------------------------------------------------------------+

.deps
.dirstamp
Makefile
Makefile.in
configure
Expand Down
18 changes: 9 additions & 9 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = -I m4

spine_SOURCES = sql.c spine.c util.c snmp.c locks.c poller.c nft_popen.c php.c ping.c keywords.c error.c
spine_SOURCES = sql.c spine.c util.c snmp.c src/core/locks.c poller.c \
nft_popen.c php.c ping.c src/core/keywords.c error.c

configdir = $(sysconfdir)
config_DATA = spine.conf.dist
Expand All @@ -33,8 +34,9 @@ man_MANS = spine.1

# Headers are not referenced by any _SOURCES, so automake will not distribute
# them unless they are listed. Without this the release tarball builds nothing.
noinst_HEADERS = common.h error.h keywords.h locks.h nft_popen.h php.h \
ping.h poller.h snmp.h spine.h spine_sem.h sql.h uthash.h util.h
noinst_HEADERS = common.h error.h src/core/keywords.h src/core/locks.h \
nft_popen.h php.h ping.h poller.h snmp.h spine.h spine_sem.h sql.h \
uthash.h util.h

EXTRA_DIST = spine.1 spine.conf.dist

Expand All @@ -51,12 +53,9 @@ verify: docker-dev
docker run --rm spine-dev

cppcheck: docker-dev
docker run --rm spine-dev bash -c \
"cppcheck --enable=all --std=c11 --error-exitcode=1 \
--suppress=missingIncludeSystem --suppress=unusedFunction \
--suppress=checkersReport --suppress=toomanyconfigs $(spine_SOURCES)"
docker run --rm -e VERIFY_CPPCHECK_ONLY=1 spine-dev

AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/src/core -I$(top_builddir)
Comment thread
somethingwithproof marked this conversation as resolved.

check_PROGRAMS =

Expand All @@ -83,7 +82,8 @@ tests_unit_test_safety_fixes_LDADD = $(CMOCKA_LIBS)
# Everything except spine.c is linked as built; tests/fuzz/stubs.c supplies the
# globals that spine.c would define.
tests_unit_test_linked_SOURCES = tests/unit/test_linked.c tests/fuzz/stubs.c \
sql.c util.c snmp.c locks.c poller.c nft_popen.c php.c ping.c keywords.c error.c
sql.c util.c snmp.c src/core/locks.c poller.c nft_popen.c php.c ping.c \
src/core/keywords.c error.c
tests_unit_test_linked_LDADD = $(CMOCKA_LIBS) $(LIBS)

TESTS = $(check_PROGRAMS)
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ AC_CONFIG_SRCDIR(spine.c)
AC_PREFIX_DEFAULT(/usr/local/spine)
AC_LANG(C)

AM_INIT_AUTOMAKE([foreign])
AM_INIT_AUTOMAKE([foreign subdir-objects])
Comment thread
somethingwithproof marked this conversation as resolved.
AM_SILENT_RULES([yes])
AC_CONFIG_HEADERS(config/config.h)

Expand Down
21 changes: 20 additions & 1 deletion scripts/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,31 @@
set -euo pipefail

echo "=== cppcheck ==="
source_list=$(mktemp)
trap 'rm -f "$source_list"' EXIT
find . -maxdepth 1 -type f \( -name '*.c' -o -name '*.h' \) \
-print0 > "$source_list"
find src -type f \( -name '*.c' -o -name '*.h' \) \
-print0 >> "$source_list"
source_files=()
while IFS= read -r -d '' source_file; do
source_files+=("$source_file")
done < "$source_list"
if (( ${#source_files[@]} == 0 )); then
echo "ERROR: no C sources or headers found" >&2
exit 1
fi
cppcheck --enable=all --std=c11 --error-exitcode=1 \
-I. -Isrc/core \
--suppress=missingIncludeSystem \
--suppress=unusedFunction \
--suppress=checkersReport \
--suppress=toomanyconfigs \
-- *.c *.h 2>&1 | tee /tmp/cppcheck.txt
-- "${source_files[@]}" 2>&1 | tee /tmp/cppcheck.txt

if [[ "${VERIFY_CPPCHECK_ONLY:-0}" == "1" ]]; then
exit 0
fi

echo ""
echo "=== scan-build ==="
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions tests/fuzz/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ NETSNMP_CFLAGS := $(filter -I% -D%, $(shell net-snmp-config --base-cflags 2>/dev
NETSNMP_LIBS := $(filter -l% -L%, $(shell net-snmp-config --libs 2>/dev/null))

SPINE_SRC := $(addprefix $(SPINE_ROOT)/, \
ping.c util.c sql.c snmp.c locks.c poller.c nft_popen.c php.c keywords.c error.c)
ping.c util.c sql.c snmp.c src/core/locks.c poller.c nft_popen.c php.c \
src/core/keywords.c error.c)

FUZZ_CFLAGS := $(SANITIZERS) -g -O1 -DHAVE_CONFIG_H \
-I$(SPINE_ROOT) -I$(SPINE_ROOT)/config \
-I$(SPINE_ROOT) -I$(SPINE_ROOT)/src/core -I$(SPINE_ROOT)/config \
$(NETSNMP_CFLAGS) \
$(shell mysql_config --include 2>/dev/null)

Expand Down
1 change: 1 addition & 0 deletions tests/unit/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ CFLAGS += \
-std=c99 \
-D_DEFAULT_SOURCE \
-I$(SPINE_ROOT) \
-I$(SPINE_ROOT)/src/core \
-I$(SPINE_ROOT)/config \
$(CMOCKA_CFLAGS) \
$(MYSQL_CFLAGS) \
Expand Down
Loading