Skip to content

Commit dcfe374

Browse files
committed
ci: test the suite on OpenBSD with vmactions
Run make test inside an OpenBSD 7.x VM. The workflow surfaced two Linux-only assumptions in the test harness, now fixed: - the group/world-readable check used stat -c (GNU); read the mode from ls(1) instead, which works with both GNU and BSD stat/ls flags; - EDITOR/OPENER were set to /bin/true; OpenBSD ships true(1) in /usr/bin, so resolve it through PATH.
1 parent 8a5e383 commit dcfe374

2 files changed

Lines changed: 49 additions & 3 deletions

File tree

‎.github/workflows/openbsd.yml‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: OpenBSD
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 30
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Test on OpenBSD
20+
uses: vmactions/openbsd-vm@v1
21+
with:
22+
# Newest OpenBSD 7.x; the action defaults to 7.9.
23+
release: "7"
24+
sync: rsync
25+
copyback: false
26+
prepare: |
27+
uname -a
28+
run: |
29+
set -eu
30+
31+
echo "== environment =="
32+
uname -a
33+
id
34+
make --version 2>&1 | head -n 1 || true
35+
36+
echo "== test suite =="
37+
make test

‎tests/run_tests.sh‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,15 @@ expect "header cache directory created" test -d "$H1/.cache/mutt-wizard/user_exa
286286
expect "notmuch config created" test -f "$H1/.notmuch-config"
287287
expect "imapnotify config created" test -f "$H1/.config/imapnotify/user@example.com.yaml"
288288
expect "urlview config created" test -f "$H1/.urlview"
289-
expect "config files are not group/world readable" sh -c 'stat -c "%a" "$1" | grep -qE "^[67]00$"' x "$MUTTRC"
289+
# Portable permission check: stat(1) flags differ between GNU (-c) and
290+
# BSD (-f), so inspect the mode field from ls(1) instead.
291+
expect "config files are not group/world readable" sh -c '
292+
mode=$(ls -l "$1" | cut -c1-10)
293+
case "$mode" in
294+
-rw------- | -rwx------) exit 0 ;;
295+
*) exit 1 ;;
296+
esac
297+
' x "$MUTTRC"
290298

291299
mw "$H1" -l >"$TMP/cap.out" 2>/dev/null
292300
expect "mw lists the added account" grep -q user@example.com "$TMP/cap.out"
@@ -405,7 +413,8 @@ H10=$(mkhome "$TMP/h10")
405413
mw "$H10" -a one@example.com -f -x p -i i1.example.com -s s1.example.com >/dev/null 2>&1
406414
mw "$H10" -a two@example.com -f -x p -i i2.example.com -s s2.example.com >/dev/null 2>&1
407415
mkdir -p "$TMP/mwtmp"
408-
EDITOR=/bin/true TMPDIR="$TMP/mwtmp" expect "mw -r reorders accounts" mw "$H10" -r
416+
# `true` is resolved through PATH: /bin/true does not exist on OpenBSD.
417+
EDITOR=true TMPDIR="$TMP/mwtmp" expect "mw -r reorders accounts" mw "$H10" -r
409418
expect_file "muttrc regenerated with i1 macro" "$H10/.config/mutt/muttrc" 'macro index,pager i1'
410419
expect_file "muttrc regenerated with i2 macro" "$H10/.config/mutt/muttrc" 'macro index,pager i2'
411420
expect_file "default account sourced first" "$H10/.config/mutt/muttrc" "source $H10/.config/mutt/accounts/one@example.com.muttrc"
@@ -511,7 +520,7 @@ while [ "$(wc -l <"$OPENED_LOG" 2>/dev/null || echo 0)" -lt 2 ] && [ "$i" -lt 10
511520
done
512521
expect_file "macOS open recorded" "$OPENED_LOG" 'attach file.txt'
513522

514-
OPENER=/bin/true expect 'openfile honors $OPENER' \
523+
OPENER=true expect 'openfile honors $OPENER' \
515524
openfile "$H15" "$TMP/attach file.txt"
516525

517526
############################################################

0 commit comments

Comments
 (0)