Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add freebsd runner #1437

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
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
71 changes: 58 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: enforce-g_malloc
run: "! git grep -P '(?<!g_)malloc' ':!.valgrind.suppressions' ':!.github/workflows/main.yml'"

build:
build-linux:
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -67,8 +67,64 @@ jobs:
container:
image: ghcr.io/dunst-project/docker-images:${{ matrix.distro }}

build-freebsd:
runs-on: ubuntu-latest

env:
CC: gcc
EXTRA_CFLAGS: "-Werror"
MAKE: gmake
INSTALL: ginstall
FIND: gfind
SED: gsed
AWK: gawk
RMDIR: grmdir

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Test in FreeBSD
uses: vmactions/freebsd-vm@v1
with:
envs: "CC EXTRA_CFLAGS MAKE INSTALL FIND SED AWK RMDIR"
usesh: true
sync: rsync
copyback: false

prepare: |
pkg install -y x11-toolkits/pango devel/glib20 graphics/gdk-pixbuf2 graphics/cairo graphics/wayland \
devel/libnotify devel/dbus x11/libXScrnSaver x11/libXrandr x11/libXext x11/libX11 lang/perl5.36 \
devel/pkgconf devel/evdev-proto valgrind x11/libXinerama graphics/wayland-protocols x11-fonts/dejavu \
devel/gettext-runtime gsed gawk gcc git librsvg2 bash findutils coreutils gmake

run: |
git config --global --add safe.directory '*'
git describe --tags

echo "* Run test suite"
gmake -j test

echo "* Run install test"
./test/test-install.sh

echo "* Run valgrind test"
gmake -j test-valgrind

doxygen:
steps:
- uses: actions/checkout@v4

- name: doxygen
run: make -j doc-doxygen

runs-on: ubuntu-latest
container:
image: ghcr.io/dunst-project/docker-images:misc-doxygen

coverage:
needs: build
needs: [build-linux, build-freebsd]
env:
CC: gcc

Expand Down Expand Up @@ -101,14 +157,3 @@ jobs:
runs-on: ubuntu-latest
container:
image: ghcr.io/dunst-project/docker-images:fedora

doxygen:
steps:
- uses: actions/checkout@v4

- name: doxygen
run: make -j doc-doxygen

runs-on: ubuntu-latest
container:
image: ghcr.io/dunst-project/docker-images:misc-doxygen
75 changes: 74 additions & 1 deletion .valgrind.suppressions
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@

# a librsvg memoryleak that shows up in arch, but not in the CI environment
{
<librsvg-arch>
librsvg-arch
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
Expand All @@ -136,6 +136,25 @@
...
}

# The same functions leak even without fontconfig :x
{
other_pango_leaks
Memcheck:Leak
fun:*alloc
...
fun:pango_layout_get_pixel_size
...
}

{
other_pango_leaks2
Memcheck:Leak
fun:*alloc
...
fun:pango_renderer_draw_layout
...
}

{
rsvg_conditional_jump
Memcheck:Cond
Expand Down Expand Up @@ -194,3 +213,57 @@
fun:notification_load_icon_with_scaling
...
}

{
g_bus_own_name_supp
Memcheck:Leak
match-leak-kinds: definite
fun:*alloc
...
obj:/usr/local/lib/libgio-2.0.so.0.8000.5
...
fun:g_bus_own_name
fun:dbus_init
fun:test_dbus_init
...
}

{
gdk_pixbuf_new_from_file_freebsd
Memcheck:Leak
match-leak-kinds: definite
fun:calloc
...
obj:/usr/local/lib/librsvg-2.so.2.40.21
...
obj:/usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.so
obj:/usr/local/lib/libgdk_pixbuf-2.0.so.0.4200.10
fun:gdk_pixbuf_new_from_file
fun:notification_setup_raw_image
...
}

{
freebsd_dbus_leak
Memcheck:Leak
match-leak-kinds: definite
fun:calloc
fun:g_malloc0
fun:g_type_create_instance
fun:g_param_spec_internal
...
obj:/usr/local/lib/libgio-2.0.so.0.8000.5
obj:/usr/local/lib/libgobject-2.0.so.0.8000.5
...
fun:g_object_new
...
}

{
glib_freebsd
Memcheck:Leak
fun:*alloc
...
fun:g_dbus_address_get_stream_sync
...
}
38 changes: 19 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ endif
test: test/test clean-coverage-run
# Make sure an error code is returned when the test fails
/usr/bin/env bash -c 'set -euo pipefail;\
TESTDIR=./test ./test/test -v | ./test/greenest.awk '
TESTDIR=./test ./test/test -v | ${AWK} -f ./test/greenest.awk '

test-valgrind: test/test
TESTDIR=./test ${VALGRIND} \
Expand Down Expand Up @@ -223,49 +223,49 @@ clean-wayland-protocols:
install: install-dunst install-dunstctl install-dunstrc install-service

install-dunst: dunst doc
install -Dm755 dunst ${DESTDIR}${BINDIR}/dunst
install -Dm644 docs/dunst.1 ${DESTDIR}${MANPREFIX}/man1/dunst.1
install -Dm644 docs/dunst.5 ${DESTDIR}${MANPREFIX}/man5/dunst.5
install -Dm644 docs/dunstctl.1 ${DESTDIR}${MANPREFIX}/man1/dunstctl.1
install -Dm644 docs/dunstify.1 ${DESTDIR}${MANPREFIX}/man1/dunstify.1
${INSTALL} -Dm755 dunst ${DESTDIR}${BINDIR}/dunst
${INSTALL} -Dm644 docs/dunst.1 ${DESTDIR}${MANPREFIX}/man1/dunst.1
${INSTALL} -Dm644 docs/dunst.5 ${DESTDIR}${MANPREFIX}/man5/dunst.5
${INSTALL} -Dm644 docs/dunstctl.1 ${DESTDIR}${MANPREFIX}/man1/dunstctl.1
${INSTALL} -Dm644 docs/dunstify.1 ${DESTDIR}${MANPREFIX}/man1/dunstify.1

install-dunstctl: dunstctl
install -Dm755 dunstctl ${DESTDIR}${BINDIR}/dunstctl
${INSTALL} -Dm755 dunstctl ${DESTDIR}${BINDIR}/dunstctl

ifeq (1,${SYSCONF_FORCE_NEW})
install-dunstrc:
install -Dm644 dunstrc ${DESTDIR}${SYSCONFFILE}
${INSTALL} -Dm644 dunstrc ${DESTDIR}${SYSCONFFILE}
endif

install-service: install-service-dbus
install-service-dbus: service-dbus
install -Dm644 org.knopwob.dunst.service ${DESTDIR}${SERVICEDIR_DBUS}/org.knopwob.dunst.service
${INSTALL} -Dm644 org.knopwob.dunst.service ${DESTDIR}${SERVICEDIR_DBUS}/org.knopwob.dunst.service
ifneq (0,${SYSTEMD})
install-service: install-service-systemd
install-service-systemd: service-systemd
install -Dm644 dunst.systemd.service ${DESTDIR}${SERVICEDIR_SYSTEMD}/dunst.service
${INSTALL} -Dm644 dunst.systemd.service ${DESTDIR}${SERVICEDIR_SYSTEMD}/dunst.service
endif

ifneq (0,${DUNSTIFY})
install: install-dunstify
install-dunstify: dunstify
install -Dm755 dunstify ${DESTDIR}${BINDIR}/dunstify
${INSTALL} -Dm755 dunstify ${DESTDIR}${BINDIR}/dunstify
endif

ifneq (0,${COMPLETIONS})
install: install-completions
install-completions:
install -Dm644 completions/dunst.bashcomp ${DESTDIR}${BASHCOMPLETIONDIR}/dunst
install -Dm644 completions/dunstctl.bashcomp ${DESTDIR}${BASHCOMPLETIONDIR}/dunstctl
install -Dm644 completions/_dunst.zshcomp ${DESTDIR}${ZSHCOMPLETIONDIR}/_dunst
install -Dm644 completions/_dunstctl.zshcomp ${DESTDIR}${ZSHCOMPLETIONDIR}/_dunstctl
install -Dm644 completions/dunst.fishcomp ${DESTDIR}${FISHCOMPLETIONDIR}/dunst.fish
install -Dm644 completions/dunstctl.fishcomp ${DESTDIR}${FISHCOMPLETIONDIR}/dunstctl.fish
${INSTALL} -Dm644 completions/dunst.bashcomp ${DESTDIR}${BASHCOMPLETIONDIR}/dunst
${INSTALL} -Dm644 completions/dunstctl.bashcomp ${DESTDIR}${BASHCOMPLETIONDIR}/dunstctl
${INSTALL} -Dm644 completions/_dunst.zshcomp ${DESTDIR}${ZSHCOMPLETIONDIR}/_dunst
${INSTALL} -Dm644 completions/_dunstctl.zshcomp ${DESTDIR}${ZSHCOMPLETIONDIR}/_dunstctl
${INSTALL} -Dm644 completions/dunst.fishcomp ${DESTDIR}${FISHCOMPLETIONDIR}/dunst.fish
${INSTALL} -Dm644 completions/dunstctl.fishcomp ${DESTDIR}${FISHCOMPLETIONDIR}/dunstctl.fish

ifneq (0,${DUNSTIFY})
install: install-completions-dunstify
install-completions-dunstify:
install -Dm644 completions/dunstify.fishcomp ${DESTDIR}${FISHCOMPLETIONDIR}/dunstify.fish
${INSTALL} -Dm644 completions/dunstify.fishcomp ${DESTDIR}${FISHCOMPLETIONDIR}/dunstify.fish
endif
endif

Expand All @@ -281,7 +281,7 @@ uninstall-keepconf: uninstall-service uninstall-dunstctl uninstall-completions

uninstall-dunstrc:
rm -f ${DESTDIR}${SYSCONFFILE}
rmdir --ignore-fail-on-non-empty ${DESTDIR}${SYSCONFDIR}/dunst
${RMDIR} --ignore-fail-on-non-empty ${DESTDIR}${SYSCONFDIR}/dunst

uninstall-dunstctl:
rm -f ${DESTDIR}${BINDIR}/dunstctl
Expand Down
11 changes: 9 additions & 2 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,22 @@ SERVICEDIR_SYSTEMD ?= ${PREFIX}/lib/systemd/user
EXTRA_CFLAGS ?=

DOXYGEN ?= doxygen
FIND ?= find
GCOVR ?= gcovr
GIT ?= git
PKG_CONFIG ?= pkg-config
POD2MAN ?= pod2man
SED ?= sed
SYSTEMDAEMON ?= systemd
VALGRIND ?= valgrind

# Provided for compatibility with BSDs
# You will need to prepend g's to these programs
INSTALL ?= install
MAKE ?= make
FIND ?= find
SED ?= sed
AWK ?= awk
RMDIR ?= rmdir

# Disable systemd service file installation,
# if you don't want to use systemd albeit installed
#SYSTEMD ?= 0
Expand Down
1 change: 1 addition & 0 deletions src/rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ static inline bool rule_field_matches_string(const char *value, const char *patt
}
regex_t regex;

// TODO check if regex pattern is not empty
// TODO compile each regex only once
int err = regcomp(&regex, pattern, REG_NEWLINE | REG_EXTENDED | REG_NOSUB);
if (err) {
Expand Down
1 change: 0 additions & 1 deletion test/rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ TEST test_pattern_match(void) {
ASSERT(rule_field_matches_string("ffffasd", ".*asd"));

// Substring matching
ASSERT(rule_field_matches_string("asd", ""));
ASSERT(rule_field_matches_string("asd", "sd"));
ASSERT(rule_field_matches_string("asd", "a"));
ASSERT(rule_field_matches_string("asd", "d"));
Expand Down
11 changes: 7 additions & 4 deletions test/test-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# Throw error any time a command fails
set -euo pipefail

MAKE=${MAKE:-make}
FIND=${FIND:-find}

# Export parameters so they are useable by subshells and make
export BASE="$(dirname "$(dirname "$(readlink -f "$0")")")"
export DESTDIR="${BASE}/install"
Expand All @@ -14,12 +17,12 @@ export SERVICEDIR_SYSTEMD="/systemd"
export SERVICEDIR_DBUS="/dbus"

do_make() { # for convenience/conciseness
make -C "${BASE}" "$@"
${MAKE} -C "${BASE}" "$@"
}

check_dest() {
# Check file list given on stdin and see if all are actually present
diff -u <(find "${DESTDIR}" -type f -printf "%P\n" | sort) <(sort -)
diff -u <($FIND "${DESTDIR}" -type f -printf "%P\n" | sort) <(sort -)
}

do_make install
Expand Down Expand Up @@ -54,8 +57,8 @@ EOF
do_make uninstall-purge

# Expect empty
if ! [ -z "$(find "${DESTDIR}" -type f)" ]; then
if ! [ -z "$($FIND "${DESTDIR}" -type f)" ]; then
echo "Uninstall failed, following files weren't removed"
find "${DESTDIR}" -type f
$FIND "${DESTDIR}" -type f
exit 1
fi
Loading