#!/usr/bin/env bash # RUN THE SAME DRIVE N TIMES AND REPORT A RATE, because asserting one has been wrong repeatedly. # # N=12 scripts/app-rate.sh --prefix /tmp/cider-sp-1000/prefix \ # --app "/Applications/Swift Publisher 5.app/Contents/MacOS/Swift Publisher 5" \ # --name sp-rate --click "1022,619;60,197" # # SURVIVED means the driver hit its time limit with the application still running: app-drive prints # cider-app exit=124 for the timeout, or no exit line at all. ANY other exit code is a failure for # this purpose, because the application was supposed to still be up. That distinction matters: a # crash iA Writer swallowed reported exit=0, which reads as success to anything naive. # # TWO CONTROLS ARE PRINTED, and neither is optional. A trial whose click did not land is vacuous, # so the run compares d1 against d2 and counts how many actually changed the screen. And a detector # that cannot fail proves nothing, so the exit classification is stated for the reader to check. # # The arithmetic to go with the count, for 0 failures in N trials: # 95 percent upper bound on the rate is 1 - 0.05^(1/N) N=12 -> 0.22, N=25 -> 0.11, N=40 -> 0.07 # Zero failures NEVER means the defect is gone; it bounds how common it can still be. set -u cd "$(dirname "$0")/.." N=${N:-10} PREFIX=""; APP=""; NAME="rate"; CLICKS=""; TYPETEXT="" while [ $# -gt 0 ]; do case "$1" in --prefix) PREFIX="$2"; shift 2 ;; --app) APP="$2"; shift 2 ;; --name) NAME="$2"; shift 2 ;; --click) CLICKS="$2"; shift 2 ;; --type) TYPETEXT="$2"; shift 2 ;; *) echo "unknown option: $1" >&2; exit 2 ;; esac done [ -n "$PREFIX" ] && [ -n "$APP" ] || { echo "usage: $0 --prefix