Skip to content

Commit 7a758db

Browse files
committed
ci: probe Blacksmith display wake and audio TCC (scratch, not for merge)
1 parent 32882cf commit 7a758db

1 file changed

Lines changed: 29 additions & 3 deletions

File tree

‎.github/workflows/bs-recording-probe.yml‎

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,37 @@ jobs:
123123
124124
- name: Probe displays and ScreenCaptureKit
125125
run: |
126+
pmset -g | head -30
127+
cat > /tmp/disp.swift <<'SWIFT0'
128+
import CoreGraphics
129+
print("pre-wake main", CGMainDisplayID(), "asleep", CGDisplayIsAsleep(CGMainDisplayID()), "active", CGDisplayIsActive(CGMainDisplayID()))
130+
SWIFT0
131+
swiftc /tmp/disp.swift -o /tmp/disp0 && /tmp/disp0 || true
132+
echo "--- before wake"; ioreg -n IODisplayWrangler -r -d 1 2>/dev/null | grep -i power | head -3 || true
133+
sudo pmset -a displaysleep 0 sleep 0 disksleep 0 || true
134+
caffeinate -u -t 2 || true
135+
nohup caffeinate -dimsu > /dev/null 2>&1 &
136+
sleep 2
137+
# Microphone lives in the per-user TCC database
138+
udb="$HOME/Library/Application Support/com.apple.TCC/TCC.db"
139+
ls -la "$udb" || true
140+
now=$(date +%s)
141+
sort -u "$RUNNER_TEMP/capture-binaries" | grep '^/' | while read -r client; do
142+
for service in kTCCServiceMicrophone kTCCServiceScreenCapture; do
143+
sqlite3 "$udb" "INSERT OR REPLACE INTO access (service,client,client_type,auth_value,auth_reason,auth_version,indirect_object_identifier,flags,last_modified) VALUES ('$service','$client',1,2,4,1,'UNUSED',0,$now);" || echo "user db insert failed for $client"
144+
done
145+
done
146+
killall tccd || true
147+
sudo killall tccd || true
148+
sleep 2
126149
cat > /tmp/disp.swift <<'SWIFT'
127150
import CoreGraphics
128151
import ScreenCaptureKit
129152
import Foundation
130-
print("CGMainDisplayID", CGMainDisplayID(), "preflight", CGPreflightScreenCaptureAccess())
153+
print("CGMainDisplayID", CGMainDisplayID(), "preflight", CGPreflightScreenCaptureAccess(), "asleep", CGDisplayIsAsleep(CGMainDisplayID()), "active", CGDisplayIsActive(CGMainDisplayID()), "online", CGDisplayIsOnline(CGMainDisplayID()), "bounds", CGDisplayBounds(CGMainDisplayID()))
154+
var on = [CGDirectDisplayID](repeating: 0, count: 8); var m: UInt32 = 0
155+
CGGetOnlineDisplayList(8, &on, &m)
156+
for i in 0..<Int(m) { print("online", on[i], CGDisplayBounds(on[i]), "asleep", CGDisplayIsAsleep(on[i])) }
131157
var ids = [CGDirectDisplayID](repeating: 0, count: 8); var n: UInt32 = 0
132158
CGGetActiveDisplayList(8, &ids, &n)
133159
for i in 0..<Int(n) { print("active", ids[i], CGDisplayBounds(ids[i])) }
@@ -156,11 +182,11 @@ jobs:
156182
sleep 12
157183
pid=$(pgrep -f "cap-verify-stimulus" | head -1)
158184
echo "pid $pid"; cat /tmp/stim-$variant.out; echo "log:"; cat /tmp/stim-$variant.jsonl | head -5
159-
if [ -n "$pid" ]; then sample "$pid" 2 -file /tmp/sample-$variant.txt >/dev/null 2>&1; grep -A45 "Thread_.*DispatchQueue_1: com.apple.main-thread" /tmp/sample-$variant.txt | cut -c1-160 | head -60; pkill -f cap-verify-stimulus || true; fi
185+
if [ -n "$pid" ]; then log show --last 20s --style compact --predicate 'process == "tccd" OR process == "coreaudiod"' 2>/dev/null | grep -iE "deny|prompt|auth|microphone|tcc|error" | tail -15 || true; sample "$pid" 2 -file /tmp/sample-$variant.txt >/dev/null 2>&1; grep -A45 "Thread_.*DispatchQueue_1: com.apple.main-thread" /tmp/sample-$variant.txt | cut -c1-160 | head -60; pkill -f cap-verify-stimulus || true; fi
160186
sleep 2
161187
done
162188
163189
- name: Probe one capture case
164190
run: |
165-
RUST_LOG=cap_recording=debug,scap_targets=debug CAP_VERIFY_CASE=recording/instant/late-mic CAP_VERIFY_TIER=full CAP_VERIFY_REPEAT=1 \
191+
RUST_LOG=cap_recording=debug,scap_targets=debug CAP_VERIFY_CASE=recording/instant/late-mic,recording/studio-screen/gated,recording/instant/system-only CAP_VERIFY_TIER=full CAP_VERIFY_REPEAT=1 \
166192
cargo test --locked -p cap-verify --test recording real_capture -- --nocapture 2>&1 | grep -iE "display|content filter|AsContentFilter|FAIL|pass|xfail|shareable" | head -40 || true

0 commit comments

Comments
 (0)