* Stop pipefail from turning grep -q SIGPIPE exits into false negatives grep -q exits at the first match, and when the producer is still writing it dies with SIGPIPE. Under pipefail that 141 becomes the pipeline's status, so hardware checks like lspci | grep -q read as "not found" on exactly the machines they target. The T2 defaults migration hit this and silently skipped real T2 Macs (#6608). Redirect grep to /dev/null instead of -q wherever a pipeline feeds grep in a pipefail context, so grep reads all input and the producer never gets killed. The install-time T2 checks aren't run under pipefail today but are switched too, since they're the same detection line the issue calls out. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Re-run the T2 defaults migration its broken hardware check skipped The SIGPIPE bug marked 1785944594 as applied without doing anything on affected T2 Macs. The original migration is idempotent, so a fresh migration can just source it now that the guard is fixed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Address Copilot review: fix OCR grep pipeline and prove the T2 repair screen_contains piped tesseract into grep -Fqi under the acceptance suite's pipefail, the same SIGPIPE false negative the rest of the branch fixes. The T2 test's lspci stub now keeps writing past the pipe buffer after the match so every scenario exercises the SIGPIPE case, and a new case runs the rerun migration against fixtures a bitten install would have. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
97 lines
2.2 KiB
Bash
97 lines
2.2 KiB
Bash
#!/bin/bash
|
|
|
|
if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
|
|
echo "source test/acceptance.d/base-test.sh from an acceptance test; do not run it directly" >&2
|
|
exit 1
|
|
fi
|
|
|
|
ROOT=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd)
|
|
ARTIFACTS="${OMARCHY_ACCEPTANCE_DIR:-/tmp/omarchy-acceptance}"
|
|
|
|
mkdir -p "$ARTIFACTS"
|
|
|
|
pass() {
|
|
printf 'ok - %s\n' "$1"
|
|
}
|
|
|
|
fail() {
|
|
local description="$1"
|
|
local detail="${2:-}"
|
|
local step=${description,,}
|
|
|
|
step=${step// /-}
|
|
step=${step//[^a-z0-9-]/}
|
|
|
|
[[ -n $detail ]] && printf '%s\n' "$detail" >&2
|
|
screenshot "failure-$step"
|
|
printf 'not ok - %s\n' "$description" >&2
|
|
exit 1
|
|
}
|
|
|
|
screenshot() {
|
|
timeout 10 grim "$ARTIFACTS/$1.png" 2>/dev/null || true
|
|
}
|
|
|
|
screen_contains() {
|
|
local text="$1"
|
|
local snapshot="/tmp/omarchy-acceptance-ocr-$$.png"
|
|
|
|
if ! timeout 10 grim "$snapshot" 2>/dev/null; then
|
|
rm -f "$snapshot"
|
|
return 1
|
|
fi
|
|
tesseract "$snapshot" stdout --psm 11 2>/dev/null | grep -Fi -- "$text" >/dev/null
|
|
local status=$?
|
|
rm -f "$snapshot"
|
|
return $status
|
|
}
|
|
|
|
# Poll a command until it succeeds; screenshot and fail on timeout.
|
|
wait_until() {
|
|
local description="$1" timeout="$2"
|
|
shift 2
|
|
|
|
local deadline=$((SECONDS + timeout))
|
|
|
|
until "$@" >/dev/null 2>&1; do
|
|
if ((SECONDS >= deadline)); then
|
|
fail "$description" "timed out after ${timeout}s waiting for: $*"
|
|
fi
|
|
sleep 1
|
|
done
|
|
|
|
pass "$description"
|
|
}
|
|
|
|
window_present() {
|
|
hyprctl -j clients | jq -e --arg class "$1" '[.[] | select(.class | test($class))] | length > 0'
|
|
}
|
|
|
|
window_absent() {
|
|
! window_present "$1"
|
|
}
|
|
|
|
layer_present() {
|
|
hyprctl -j layers | jq -e --arg ns "$1" '[.. | objects | select(.namespace? == $ns)] | length > 0'
|
|
}
|
|
|
|
layer_absent() {
|
|
! layer_present "$1"
|
|
}
|
|
|
|
# Close every window matching a class regex, by address so multi-window apps
|
|
# are fully closed. Tries the quattro Lua dispatcher first, then classic.
|
|
close_windows() {
|
|
local class="$1"
|
|
local addr
|
|
|
|
while read -r addr; do
|
|
hyprctl dispatch "hl.dsp.window.close({ window = \"address:$addr\" })" >/dev/null 2>&1 ||
|
|
hyprctl dispatch closewindow "address:$addr" >/dev/null 2>&1 || true
|
|
done < <(hyprctl -j clients | jq -r --arg class "$class" '.[] | select(.class | test($class)) | .address')
|
|
}
|
|
|
|
launch_app() {
|
|
setsid -f bash -c "$1" >/dev/null 2>&1
|
|
}
|