#!/usr/bin/env bash # Job-level check that PRINTER_OPTIONS queue defaults reach the emitted job. # # The authority for this test is the PostScript that cupsd sends to the # printer, not a settings file and NOT `lpoptions -p -l`: that command # renders PPD Boolean options incorrectly (it shows `TonerSaveMode ... *False` # even when the queue default is `True`), which is exactly the misreading this # test guards against. # # Why `cupsfilter` and not "read cupsd's spool file after `lp`": with no # reachable printer the job sticks at "The printer may not exist or is # unavailable", the filters never run, and the spool file still holds the # unfiltered input PDF. `cupsfilter -p /etc/cups/ppd/.ppd` produces the # same `%%BeginFeature`/effect-line structure without needing a printer. # # Verified against cups-daemon 2.4.2-3+deb12u9 (Debian bookworm, the base of # Containerfile). set -euo pipefail IMAGE="${IMAGE:-printserver:latest}" QUEUE="${QUEUE:-HL4150CDN}" CONTAINER="${CONTAINER:-printserver-queue-defaults-test}" SAMPLE="${SAMPLE:-/usr/share/cups/data/default-testpage.pdf}" PPD="/etc/cups/ppd/${QUEUE}.ppd" # The documented PRINTER_OPTIONS example from the spec / README. PRINTER_OPTIONS_VALUE="BRColorMode=Vivid TonerSaveMode=False" pass=0 fail=0 cleanup() { podman rm -f "${CONTAINER}" >/dev/null 2>&1 || true } trap cleanup EXIT check() { # check