Skip to content

Commit

Permalink
c-list: enable unit tests for third_party/c-list
Browse files Browse the repository at this point in the history
  • Loading branch information
thom311 committed Nov 20, 2024
1 parent d4d1eb7 commit 6ba3f5f
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ jobs:
sudo apt-get update
sudo apt-get -y --no-install-recommends install \
check \
valgrind \
libtool-bin
libtool-bin \
meson \
valgrind
- name: Check out repository code
uses: actions/checkout@v3
Expand Down Expand Up @@ -179,6 +180,7 @@ jobs:
libtool \
linux-headers \
make \
meson \
musl-dev \
pkgconfig
Expand All @@ -193,7 +195,6 @@ jobs:
run: |
set -x
export CC="${{ matrix.cc }}"
export CFLAGS="-DNL_MORE_ASSERTS=1000 -O2 -Werror -std=gnu11 -fexceptions"
if [ "$CC" = "clang" ]; then
CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument -Wno-error=unused-function"
Expand All @@ -220,4 +221,5 @@ jobs:
# (odd).
# tests/check-all
# make -j 15 check || (cat ./test-suite.log; false)
make check-local-c-list
done
31 changes: 31 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ lib_LTLIBRARIES =
noinst_LTLIBRARIES =
check_LTLIBRARIES =

clean_local =
check_PROGRAMS =
check_programs =
check_local =
Expand Down Expand Up @@ -1184,6 +1185,36 @@ endif

###############################################################################

EXTRA_DIST += \
third_party/c-list/AUTHORS \
third_party/c-list/.editorconfig \
third_party/c-list/.github/workflows/ci.yml \
third_party/c-list/meson.build \
third_party/c-list/NEWS.md \
third_party/c-list/README.md \
third_party/c-list/src/c-list.h \
third_party/c-list/src/meson.build \
third_party/c-list/src/test-api.c \
third_party/c-list/src/test-basic.c \
third_party/c-list/src/test-embed.c \
$(NULL)

check-local-c-list:
"$(srcdir)/tools/check-c-list.sh"

check_local += check-local-c-list

clean-local-c-list:
rm -rf ./build-c-list/

clean_local += clean-local-c-list

EXTRA_DIST += tools/check-c-list.sh

###############################################################################

clean-local: $(clean_local)

check-local: $(check_build) $(check_local)

.PHONY: $(check_local)
Expand Down
30 changes: 30 additions & 0 deletions tools/check-c-list.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/bash

set -e

print_and_exit() {
local err="$1"
shift
printf '%s\n' "$*"
exit "$err"
}

die() {
print_and_exit 1 "$@"
}

command -v meson &>/dev/null || print_and_exit 0 "$0: skip: meson not available"
command -v ninja &>/dev/null || print_and_exit 0 "$0: skip: ninja not available"

BUILDDIR="$PWD"
SRCDIR="$(dirname "$0")/.."

_BUILDDIR="$BUILDDIR/build-c-list"
_SRCDIR="$SRCDIR/third_party/c-list"

if [ ! -d "$_BUILDDIR" ] ; then
meson setup "$_BUILDDIR" "$_SRCDIR" || die "meson failed"
ninja -C "$_BUILDDIR" || die "failed build"
fi

ninja -C "$_BUILDDIR" test || die "c-list tests failed"

0 comments on commit 6ba3f5f

Please sign in to comment.