tests: pin the platform-first journal dispatch in collect_tail
AuthorPico <picobot@scorpioplayer.com>
Date2026-11-12 07:01:02
Commitaea8d44b
Parents0ed5b7e1
Changed files
tests/run.sh+7−0■■■■■
1 file+7−0
Diff
tests/run.sh+7−0■■■■■
index da5757f..2fd1edf 100755
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -333,6 +333,13 @@ check_not "source never calls system()" 'system(' "$SRCCAT"
333333 check "journal argv is built with snprintf" 'journalctl -o json --no-pager' "$SRCCAT"
334334 check "macOS log is called by absolute path" '/usr/bin/log show --style compact' "$SRCCAT"
335335 check "wevtutil argv names the channel" 'wevtutil qe %s /c:%d /rd:true /f:text' "$SRCCAT"
336+# the journal kind means journalctl on Linux and `log show` on macOS, so the
337+# platform branch must come BEFORE the generic kind check in both collectors
338+check "platform branch precedes the journalctl branch" \
339+ 'if defined(__APPLE__)
340+ if (strcmp(s->kind, "journal") == 0)' "$(printf '%s' "$SRCCAT" | sed -n '/static int collect_tail/,/^}/p')"
341+check "search collector dispatches by platform too" \
342+ '/usr/bin/log show' "$SRCCAT"
336343 check "unit names are validated" 'valid_unit' "$SRCCAT"
337344 check "files are opened read-only" '"rb"' "$SRCCAT"
338345 check "tail reads are bounded" 'FILE_TAIL_BYTES' "$SRCCAT"
339346
tests/run.sh+7−0■■■■■
index da5757f..2fd1edf 100755index da5757f..2fd1edf 100755
--- a/tests/run.sh--- a/tests/run.sh
+++ b/tests/run.sh+++ b/tests/run.sh
@@ -333,6 +333,13 @@ check_not "source never calls system()" 'system(' "$SRCCAT"@@ -333,6 +333,13 @@ check_not "source never calls system()" 'system(' "$SRCCAT"
333 check "journal argv is built with snprintf" 'journalctl -o json --no-pager' "$SRCCAT"333 check "journal argv is built with snprintf" 'journalctl -o json --no-pager' "$SRCCAT"
334 check "macOS log is called by absolute path" '/usr/bin/log show --style compact' "$SRCCAT"334 check "macOS log is called by absolute path" '/usr/bin/log show --style compact' "$SRCCAT"
335 check "wevtutil argv names the channel" 'wevtutil qe %s /c:%d /rd:true /f:text' "$SRCCAT"335 check "wevtutil argv names the channel" 'wevtutil qe %s /c:%d /rd:true /f:text' "$SRCCAT"
336+# the journal kind means journalctl on Linux and `log show` on macOS, so the
337+# platform branch must come BEFORE the generic kind check in both collectors
338+check "platform branch precedes the journalctl branch" \
339+ 'if defined(__APPLE__)
340+ if (strcmp(s->kind, "journal") == 0)' "$(printf '%s' "$SRCCAT" | sed -n '/static int collect_tail/,/^}/p')"
341+check "search collector dispatches by platform too" \
342+ '/usr/bin/log show' "$SRCCAT"
336 check "unit names are validated" 'valid_unit' "$SRCCAT"343 check "unit names are validated" 'valid_unit' "$SRCCAT"
337 check "files are opened read-only" '"rb"' "$SRCCAT"344 check "files are opened read-only" '"rb"' "$SRCCAT"
338 check "tail reads are bounded" 'FILE_TAIL_BYTES' "$SRCCAT"345 check "tail reads are bounded" 'FILE_TAIL_BYTES' "$SRCCAT"
339346