[monitoring-plugins] CI: Add build and unit tests on FreeBSD, OpenBSD ...

GitHub git at monitoring-plugins.org
Fri Aug 7 15:20:14 CEST 2026


    Module: monitoring-plugins
    Branch: release_3.0.3
    Commit: c05eeb7f33ce0779b9e351babc68615010c2c7d8
    Author: neil <github at neilpang.com>
 Committer: GitHub <noreply at github.com>
      Date: Fri Aug  7 21:12:06 2026 +0800
       URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=c05eeb7f

CI: Add build and unit tests on FreeBSD, OpenBSD and NetBSD (#2304)

* CI: Add build and unit tests on FreeBSD, OpenBSD and NetBSD

Adds .github/workflows/test-unix.yml, which boots a QEMU VM per platform
via the vmactions actions and runs the autotools bootstrap, the full C
build and the standalone libtap unit tests under lib/tests. The jobs are
triggered manually (workflow_dispatch) only.

The top level 'make test' is not run there: it depends on the service zoo
(apache, squid, slapd, mariadb, postfix, snmpd, sshd) that
.github/prepare_debian.sh sets up only for the Linux job.

Refs #2160

* Fix portability problems uncovered by the new BSD CI

plugins-root/check_icmp.d/config.h uses struct timeval without including
sys/time.h. Linux and FreeBSD happen to pull it in transitively, NetBSD does
not, so the build stops there with

  check_icmp.d/./config.h:88:17: error: field 'stime' has incomplete type

lib/Makefile.am recursed into lib/tests with a bare 'make' instead of
$(MAKE), which every other recursive rule in the tree uses. The BSD logs
show the recursion switching make implementation halfway through the build.

* Run the BSD tests on push and pull_request

---------

Co-authored-by: Lorenz Kästle <12514511+RincewindsHat at users.noreply.github.com>

---

 .github/workflows/test-unix.yml    | 106 +++++++++++++++++++++++++++++++++++++
 lib/Makefile.am                    |   2 +-
 plugins-root/check_icmp.d/config.h |   1 +
 3 files changed, 108 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/test-unix.yml b/.github/workflows/test-unix.yml
new file mode 100644
index 00000000..84ab9d44
--- /dev/null
+++ b/.github/workflows/test-unix.yml
@@ -0,0 +1,106 @@
+---
+name: Tests on other Unixes
+
+# Build and run the self-contained unit tests on the Unixes that
+# configure.ac has explicit support for but that GitHub does not offer as a
+# hosted runner. Each job boots a QEMU VM via the vmactions actions.
+#
+# These jobs deliberately do NOT run the top level "make test": that suite
+# needs a full service zoo (apache, squid, slapd, mariadb, postfix, snmpd,
+# sshd, ...) which .github/prepare_debian.sh sets up only for the Linux job.
+# What is exercised here is the autotools bootstrap, the C build of every
+# plugin, and the standalone libtap unit tests under lib/tests.
+
+on:
+  workflow_dispatch:
+    inputs:
+      debug_enabled:
+        type: boolean
+        description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
+        required: false
+        default: false
+  push:
+    branches:
+      - '*'
+  pull_request:
+
+jobs:
+  freebsd:
+    name: Running build and unit tests on FreeBSD
+    runs-on: ubuntu-latest
+    timeout-minutes: 60
+    steps:
+      - name: Git clone repository
+        uses: actions/checkout at v7
+      - name: Build and test in a FreeBSD VM
+        uses: vmactions/freebsd-vm at v1
+        with:
+          usesh: true
+          cache-after-prepare: true
+          prepare: |
+            pkg install -y autoconf automake gmake
+          run: |
+            set -e
+            uname -a
+            tools/setup
+            ./configure --enable-libtap
+            gmake
+            cd lib && gmake test
+
+  openbsd:
+    name: Running build and unit tests on OpenBSD
+    runs-on: ubuntu-latest
+    timeout-minutes: 60
+    steps:
+      - name: Git clone repository
+        uses: actions/checkout at v7
+      - name: Build and test in an OpenBSD VM
+        uses: vmactions/openbsd-vm at v1
+        with:
+          usesh: true
+          cache-after-prepare: true
+          # OpenBSD carries about eighteen parallel autoconf packages and a
+          # dozen automake ones, so pkg_add needs an exact version and the
+          # metaauto wrappers then dispatch on AUTO*_VERSION. Both are
+          # resolved at run time -- the newest the mirror offers, and the
+          # version read back off the binary that pkg_add installed -- so
+          # nothing here needs revisiting when the next release lands.
+          prepare: |
+            set -e
+            newest() {
+              pkg_info -Q "$1" | grep -E "^$1-[0-9]" | sort -V | tail -1
+            }
+            pkg_add -I "$(newest autoconf)" "$(newest automake)" gmake
+          run: |
+            set -e
+            AUTOCONF_VERSION=$(ls /usr/local/bin/autoconf-* | sed 's:.*/autoconf-::' | sort -V | tail -1)
+            AUTOMAKE_VERSION=$(ls /usr/local/bin/automake-* | sed 's:.*/automake-::' | sort -V | tail -1)
+            export AUTOCONF_VERSION AUTOMAKE_VERSION
+            echo "autoconf $AUTOCONF_VERSION, automake $AUTOMAKE_VERSION"
+            uname -a
+            tools/setup
+            ./configure --enable-libtap
+            gmake
+            cd lib && gmake test
+
+  netbsd:
+    name: Running build and unit tests on NetBSD
+    runs-on: ubuntu-latest
+    timeout-minutes: 60
+    steps:
+      - name: Git clone repository
+        uses: actions/checkout at v7
+      - name: Build and test in a NetBSD VM
+        uses: vmactions/netbsd-vm at v1
+        with:
+          usesh: true
+          cache-after-prepare: true
+          prepare: |
+            /usr/sbin/pkg_add -u autoconf automake gmake perl
+          run: |
+            set -e
+            uname -a
+            tools/setup
+            ./configure --enable-libtap
+            gmake
+            cd lib && gmake test
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 27a08278..c65ccadf 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -27,4 +27,4 @@ libmonitoringplug_a_SOURCES += parse_ini.c extra_opts.c
 endif USE_PARSE_INI
 
 test test-debug:
-	cd tests && make $@
+	cd tests && $(MAKE) $@
diff --git a/plugins-root/check_icmp.d/config.h b/plugins-root/check_icmp.d/config.h
index be388d0a..c77b89c9 100644
--- a/plugins-root/check_icmp.d/config.h
+++ b/plugins-root/check_icmp.d/config.h
@@ -3,6 +3,7 @@
 #include "../../config.h"
 #include "../../lib/states.h"
 #include <stddef.h>
+#include <sys/time.h>
 #include <netinet/in_systm.h>
 #include <netinet/in.h>
 #include <netinet/ip.h>



More information about the Commits mailing list