From 6ba3f5f16f477954d8ab3c58e4fadc142ed907e6 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 20 Nov 2024 08:37:02 +0100 Subject: [PATCH] c-list: enable unit tests for third_party/c-list --- .github/workflows/ci.yml | 8 +++++--- Makefile.am | 31 +++++++++++++++++++++++++++++++ tools/check-c-list.sh | 30 ++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 3 deletions(-) create mode 100755 tools/check-c-list.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f34d900c..4962ae13 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -179,6 +180,7 @@ jobs: libtool \ linux-headers \ make \ + meson \ musl-dev \ pkgconfig @@ -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" @@ -220,4 +221,5 @@ jobs: # (odd). # tests/check-all # make -j 15 check || (cat ./test-suite.log; false) + make check-local-c-list done diff --git a/Makefile.am b/Makefile.am index 8411d644..10f79ece 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,6 +6,7 @@ lib_LTLIBRARIES = noinst_LTLIBRARIES = check_LTLIBRARIES = +clean_local = check_PROGRAMS = check_programs = check_local = @@ -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) diff --git a/tools/check-c-list.sh b/tools/check-c-list.sh new file mode 100755 index 00000000..759ba424 --- /dev/null +++ b/tools/check-c-list.sh @@ -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"