rename project to runaway

This commit is contained in:
2026-11-09 10:13:51 +08:00
parent 5857081832
commit c9feb8c05a
95 changed files with 1034 additions and 1034 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ import sys
name = pathlib.Path(sys.argv[0]).name
args = sys.argv[1:]
root = pathlib.Path(os.environ["UNLEASH_TEST_ROOT"]).resolve()
root = pathlib.Path(os.environ["RUNAWAY_TEST_ROOT"]).resolve()
with (root / "platform-calls.jsonl").open("a") as log:
log.write(json.dumps([name, *args]) + "\n")
+3 -3
View File
@@ -1,9 +1,9 @@
setup_suite() {
local suite_dir
suite_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export UNLEASH_TEST_ROOT="$BATS_SUITE_TMPDIR"
export TMPDIR="$UNLEASH_TEST_ROOT/tmp"
local mock_bin="$UNLEASH_TEST_ROOT/bin"
export RUNAWAY_TEST_ROOT="$BATS_SUITE_TMPDIR"
export TMPDIR="$RUNAWAY_TEST_ROOT/tmp"
local mock_bin="$RUNAWAY_TEST_ROOT/bin"
mkdir -p "$TMPDIR" "$mock_bin"
local tool
for tool in sudo diskutil profiles security launchctl pfctl pkill pgrep killall \
+2 -2
View File
@@ -2,7 +2,7 @@
@test "admin rejects normal mode before resolving a target volume" {
local entrypoint
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
local script="$BATS_TEST_DIRNAME/../$entrypoint"
run bash -u -c '
source <(sed '\''/^main "\$@"$/d'\'' "$1")
@@ -20,7 +20,7 @@
@test "admin dry run returns before accessing account or enrollment state" {
local entrypoint
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
local script="$BATS_TEST_DIRNAME/../$entrypoint"
run bash -u -c '
source <(sed '\''/^main "\$@"$/d'\'' "$1")
+4 -4
View File
@@ -6,7 +6,7 @@ run_admin_home() {
local target="$BATS_TEST_TMPDIR/External Data"
mkdir -p "$target/private/var/db" "$target/private/etc" "$target/Users"
sed '/^main "\$@"$/d' "$script" > "$definitions"
run "${UNLEASH_TEST_SHELL:-bash}" -c '
run "${RUNAWAY_TEST_SHELL:-bash}" -c '
source "$1"
target="$2" mode="$3" calls="$4"
dscl() {
@@ -32,7 +32,7 @@ run_admin_home() {
@test "dualboot assigns the new home to the target UID and staff group" {
local entrypoint
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
run_admin_home "$BATS_TEST_DIRNAME/../$entrypoint" fresh
[ "$status" -eq 0 ]
grep -qx ownership "$BATS_TEST_TMPDIR/calls"
@@ -44,7 +44,7 @@ run_admin_home() {
@test "dualboot stops before setup and network markers when home ownership fails" {
local entrypoint
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
run_admin_home "$BATS_TEST_DIRNAME/../$entrypoint" ownership-fails
[ "$status" -ne 0 ]
[[ "$output" != *"Admin 'fixture' created"* ]]
@@ -56,7 +56,7 @@ run_admin_home() {
@test "dualboot preserves existing accounts homes and dangling home symlinks" {
local entrypoint mode
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
for mode in existing-user existing-home home-symlink; do
local target="$BATS_TEST_TMPDIR/External Data"
mkdir -p "$target/Users"
+10 -10
View File
@@ -4,7 +4,7 @@ run_cli() {
local script="$1"; shift
local definitions="$BATS_TEST_TMPDIR/${script##*/}.functions"
sed '/^main "\$@"$/d' "$script" > "$definitions"
run "${UNLEASH_TEST_SHELL:-bash}" -u -c '
run "${RUNAWAY_TEST_SHELL:-bash}" -u -c '
source "$1"
shift
load_config() { :; }
@@ -19,7 +19,7 @@ run_capture() {
local script="$1"; shift
local definitions="$BATS_TEST_TMPDIR/${script##*/}.functions"
sed '/^main "\$@"$/d' "$script" > "$definitions"
run "${UNLEASH_TEST_SHELL:-bash}" -u -c '
run "${RUNAWAY_TEST_SHELL:-bash}" -u -c '
source "$1"
shift
load_config() { :; }
@@ -33,7 +33,7 @@ run_capture() {
@test "optional CLI arguments reach usage or privilege guards under nounset" {
local entrypoint
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
local script="$BATS_TEST_DIRNAME/../$entrypoint"
run_cli "$script" audit
[ "$status" -ne 0 ]; [[ "$output" == *"Audit needs sudo"* ]]
@@ -42,15 +42,15 @@ run_capture() {
run_cli "$script" monitor --webhook
[ "$status" -ne 0 ]; [[ "$output" == *"--webhook requires a URL"* ]]
run_cli "$script" config set
[ "$status" -ne 0 ]; [[ "$output" == *"Usage: ./unleash config set KEY VALUE"* ]]
[ "$status" -ne 0 ]; [[ "$output" == *"Usage: ./runaway config set KEY VALUE"* ]]
run_cli "$script" config unset
[ "$status" -ne 0 ]; [[ "$output" == *"Usage: ./unleash config unset KEY"* ]]
[ "$status" -ne 0 ]; [[ "$output" == *"Usage: ./runaway config unset KEY"* ]]
done
}
@test "CLI values retain spaces quotes empty strings and literal shell syntax" {
local entrypoint value
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
for value in 'a b $(printf injected) "quoted"' ''; do
run_capture "$BATS_TEST_DIRNAME/../$entrypoint" config set LOG_FILE "$value"
[ "$status" -eq 0 ]
@@ -63,7 +63,7 @@ run_capture() {
@test "global flags around the command persist in the command shell" {
local entrypoint
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
run_capture "$BATS_TEST_DIRNAME/../$entrypoint" --dry-run config --verbose set LOG_FILE value --log-file 'a b.log'
[ "$status" -eq 0 ]
[[ "$output" == 'dry=true verbose=true log=<a b.log>'* ]]
@@ -73,7 +73,7 @@ run_capture() {
@test "global flags without a command preserve an empty argument list" {
local entrypoint
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
run_cli "$BATS_TEST_DIRNAME/../$entrypoint" --verbose
[ "$status" -eq 0 ]
[ "$output" = 'interactive verbose=true' ]
@@ -82,7 +82,7 @@ run_capture() {
@test "CLI option terminator preserves values that look like global options" {
local entrypoint
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
run_capture "$BATS_TEST_DIRNAME/../$entrypoint" config set LOG_LEVEL -- --verbose
[ "$status" -eq 0 ]
[[ "$output" == 'dry=false verbose=false log=<>'* ]]
@@ -92,7 +92,7 @@ run_capture() {
@test "log-file rejects an empty path or another option as its missing value" {
local entrypoint value
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
for value in '' --dry-run; do
run_cli "$BATS_TEST_DIRNAME/../$entrypoint" --log-file "$value" version
[ "$status" -ne 0 ]
+1 -1
View File
@@ -9,7 +9,7 @@ setup() {
mkdir -p "$TEST_DIR/private/etc"
mkdir -p "$TEST_DIR/private/var/db/ConfigurationProfiles/Settings"
echo "test" > "$TEST_DIR/private/etc/hosts"
BACKUP_DIR="$SCRIPT_DIR/.unleash-backup"
BACKUP_DIR="$SCRIPT_DIR/.runaway-backup"
}
teardown() {
+1 -1
View File
@@ -50,7 +50,7 @@ teardown() {
@test "diagnostics use stderr without contaminating helper return values" {
local source_file
for source_file in lib/colors.sh unleash-standalone.sh; do
for source_file in lib/colors.sh runaway-standalone.sh; do
run --separate-stderr bash -u -c '
source <(sed "/^error_exit()/,\$d" "$1")
volume_path() {
+1 -1
View File
@@ -37,7 +37,7 @@ teardown() {
}
@test "config preserves spaces and literal replacement characters" {
local value='/tmp/Unleash logs/quoted "name" & \tail'
local value='/tmp/Runaway logs/quoted "name" & \tail'
save_config LOG_FILE old
save_config LOG_FILE "$value"
LOG_FILE=''
+4 -4
View File
@@ -21,12 +21,12 @@ setup() {
@test "network doctor reports build power and link using only read commands" {
local entrypoint
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
local script="$BATS_TEST_DIRNAME/../$entrypoint"
local definitions="$BATS_TEST_TMPDIR/$entrypoint.functions"
local calls="$BATS_TEST_TMPDIR/$entrypoint.calls"
sed '/^main "\$@"$/d' "$script" > "$definitions"
run "${UNLEASH_TEST_SHELL:-bash}" -u -c '
run "${RUNAWAY_TEST_SHELL:-bash}" -u -c '
source "$1"
calls="$2"
load_config() { :; }
@@ -61,10 +61,10 @@ setup() {
}
@test "standalone doctor verifies embedded modules without a lib directory" {
local script="$BATS_TEST_DIRNAME/../unleash-standalone.sh"
local script="$BATS_TEST_DIRNAME/../runaway-standalone.sh"
local definitions="$BATS_TEST_TMPDIR/standalone.functions"
sed '/^main "\$@"$/d' "$script" > "$definitions"
run "${UNLEASH_TEST_SHELL:-bash}" -u -c '
run "${RUNAWAY_TEST_SHELL:-bash}" -u -c '
unset LIB_DIR
source "$1"
load_config() { :; }
+2 -2
View File
@@ -2,12 +2,12 @@
@test "dualboot dry run returns before target access with or without root" {
local entrypoint root_status
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
local script="$BATS_TEST_DIRNAME/../$entrypoint"
local definitions="$BATS_TEST_TMPDIR/$entrypoint.functions"
sed '/^main "\$@"$/d' "$script" > "$definitions"
for root_status in 0 1; do
run "${UNLEASH_TEST_SHELL:-bash}" -u -c '
run "${RUNAWAY_TEST_SHELL:-bash}" -u -c '
source "$1"
root_status="$2"
load_config() { :; }
+2 -2
View File
@@ -2,7 +2,7 @@
@test "dualboot keeps passwords out of diagnostics while preserving network preferences" {
local entrypoint
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
local script="$BATS_TEST_DIRNAME/../$entrypoint"
local definitions="$BATS_TEST_TMPDIR/$entrypoint.functions"
local target="$BATS_TEST_TMPDIR/$entrypoint Data" log="$BATS_TEST_TMPDIR/$entrypoint.log"
@@ -11,7 +11,7 @@
printf 'original Wi-Fi networks\n' > "$target/Library/Preferences/com.apple.wifi.known-networks.plist"
cp -R "$target/Library" "$BATS_TEST_TMPDIR/$entrypoint.before"
sed '/^main "\$@"$/d' "$script" > "$definitions"
run "${UNLEASH_TEST_SHELL:-bash}" -u -c '
run "${RUNAWAY_TEST_SHELL:-bash}" -u -c '
source "$1"
target="$2" logfile="$3"
fixture_password="fixture-password-not-for-a-real-account"
+9 -9
View File
@@ -4,7 +4,7 @@ setup() {
load '../lib/colors.sh'
load '../lib/firewall.sh'
TEST_DIR=$(mktemp -d)
mkdir -p "$TEST_DIR/etc/pf.anchors/com.unleash"
mkdir -p "$TEST_DIR/etc/pf.anchors/com.runaway"
mkdir -p "$TEST_DIR/private/etc"
}
@@ -14,12 +14,12 @@ teardown() {
@test "install_pf_mdm_block creates anchor" {
run install_pf_mdm_block "$TEST_DIR" 2>/dev/null || true
[ -f "$TEST_DIR/etc/pf.anchors/com.unleash/mdm" ]
[ -f "$TEST_DIR/etc/pf.anchors/com.runaway/mdm" ]
}
@test "install_pf_mdm_block includes MDM ranges" {
run install_pf_mdm_block "$TEST_DIR" 2>/dev/null || true
run grep -c "17.0.0.0/8" "$TEST_DIR/etc/pf.anchors/com.unleash/mdm"
run grep -c "17.0.0.0/8" "$TEST_DIR/etc/pf.anchors/com.runaway/mdm"
[ "$output" -ge 1 ]
}
@@ -30,14 +30,14 @@ teardown() {
@test "install_pf_mdm_block adds anchor to pf.conf" {
run install_pf_mdm_block "$TEST_DIR" 2>/dev/null || true
run grep -c "com.unleash" "$TEST_DIR/etc/pf.conf"
run grep -c "com.runaway" "$TEST_DIR/etc/pf.conf"
[ "$output" -ge 1 ]
}
@test "install_pf_mdm_block is idempotent on pf.conf" {
run install_pf_mdm_block "$TEST_DIR" 2>/dev/null || true
run install_pf_mdm_block "$TEST_DIR" 2>/dev/null || true
run grep -c "com.unleash" "$TEST_DIR/etc/pf.conf"
run grep -c "com.runaway" "$TEST_DIR/etc/pf.conf"
[ "$output" -ge 1 ]
[ "$output" -le 3 ]
}
@@ -45,20 +45,20 @@ teardown() {
@test "remove_pf_mdm_block cleans anchor file" {
run install_pf_mdm_block "$TEST_DIR" 2>/dev/null || true
run remove_pf_mdm_block "$TEST_DIR" 2>/dev/null || true
[ ! -f "$TEST_DIR/etc/pf.anchors/com.unleash/mdm" ]
[ ! -f "$TEST_DIR/etc/pf.anchors/com.runaway/mdm" ]
}
@test "remove_pf_mdm_block cleans pf.conf" {
run install_pf_mdm_block "$TEST_DIR" 2>/dev/null || true
run remove_pf_mdm_block "$TEST_DIR" 2>/dev/null || true
run grep -c "com.unleash" "$TEST_DIR/etc/pf.conf" || true
run grep -c "com.runaway" "$TEST_DIR/etc/pf.conf" || true
[ "$output" -eq 0 ]
}
@test "pf_backup_anchor creates backup file" {
echo "test" > "$TEST_DIR/etc/pf.anchors/com.unleash/mdm"
echo "test" > "$TEST_DIR/etc/pf.anchors/com.runaway/mdm"
run pf_backup_anchor "$TEST_DIR" 2>/dev/null || true
run ls "$TEST_DIR/etc/pf.anchors/com.unleash/mdm.backup."* 2>/dev/null
run ls "$TEST_DIR/etc/pf.anchors/com.runaway/mdm.backup."* 2>/dev/null
[ -n "$output" ]
}
+2 -2
View File
@@ -11,8 +11,8 @@ setup() {
}
@test "clear_history does not error with no logs" {
echo event > "$BATS_TEST_TMPDIR/unleash-monitor.log"
echo event > "$BATS_TEST_TMPDIR/runaway-monitor.log"
run clear_history "$BATS_TEST_TMPDIR"
[ "$status" -eq 0 ]
[ ! -s "$BATS_TEST_TMPDIR/unleash-monitor.log" ]
[ ! -s "$BATS_TEST_TMPDIR/runaway-monitor.log" ]
}
+2 -2
View File
@@ -4,7 +4,7 @@ setup() {
PROJECT="$BATS_TEST_TMPDIR/project"
mkdir -p "$PROJECT/scripts" "$PROJECT/lib"
cp "$BATS_TEST_DIRNAME/../scripts/check-shell.py" "$PROJECT/scripts/"
cat > "$PROJECT/unleash" <<'SH'
cat > "$PROJECT/runaway" <<'SH'
#!/bin/bash
for _lib in sample; do
source "lib/$_lib.sh"
@@ -12,7 +12,7 @@ done
sample
SH
printf 'sample() { :; }\n' > "$PROJECT/lib/sample.sh"
printf '#!/bin/bash\n' > "$PROJECT/unleash-standalone.sh"
printf '#!/bin/bash\n' > "$PROJECT/runaway-standalone.sh"
}
@test "lint reports sourced module findings without executing the application" {
+7 -7
View File
@@ -5,7 +5,7 @@ setup() {
load '../lib/launchd.sh'
load '../lib/monitor.sh'
TEST_DIR=$(mktemp -d)
SCRIPT_PATH="$TEST_DIR/unleash"
SCRIPT_PATH="$TEST_DIR/runaway"
}
teardown() {
@@ -26,30 +26,30 @@ teardown() {
SCRIPT_DIR="$TEST_DIR"
mkdir -p "$TEST_DIR"
run install_monitor_launchdaemon "$TEST_DIR" 2>/dev/null || true
[ -f "$TEST_DIR/Library/LaunchDaemons/com.unleash.monitor.plist" ]
[ -f "$TEST_DIR/Library/LaunchDaemons/com.runaway.monitor.plist" ]
}
@test "install_monitor_launchdaemon plist is valid xml" {
SCRIPT_DIR="$TEST_DIR"
mkdir -p "$TEST_DIR"
run install_monitor_launchdaemon "$TEST_DIR" 2>/dev/null || true
run grep -c "plist" "$TEST_DIR/Library/LaunchDaemons/com.unleash.monitor.plist"
run grep -c "plist" "$TEST_DIR/Library/LaunchDaemons/com.runaway.monitor.plist"
[ "$output" -gt 0 ]
}
@test "install_monitor_launchdaemon references unleash binary" {
@test "install_monitor_launchdaemon references runaway binary" {
SCRIPT_DIR="$TEST_DIR"
mkdir -p "$TEST_DIR"
run install_monitor_launchdaemon "$TEST_DIR" 2>/dev/null || true
run grep -c "unleash" "$TEST_DIR/Library/LaunchDaemons/com.unleash.monitor.plist"
run grep -c "runaway" "$TEST_DIR/Library/LaunchDaemons/com.runaway.monitor.plist"
[ "$output" -gt 0 ]
}
@test "uninstall_monitor_launchdaemon removes plist" {
mkdir -p "$TEST_DIR/Library/LaunchDaemons"
touch "$TEST_DIR/Library/LaunchDaemons/com.unleash.monitor.plist"
touch "$TEST_DIR/Library/LaunchDaemons/com.runaway.monitor.plist"
run uninstall_monitor_launchdaemon "$TEST_DIR" 2>/dev/null || true
[ ! -f "$TEST_DIR/Library/LaunchDaemons/com.unleash.monitor.plist" ]
[ ! -f "$TEST_DIR/Library/LaunchDaemons/com.runaway.monitor.plist" ]
}
@test "monitor_mdm requires root" {
+4 -4
View File
@@ -4,7 +4,7 @@ run_network_state() {
local script="$1" mode="$2"
local definitions="$BATS_TEST_TMPDIR/network.functions"
sed '/^main "\$@"$/d' "$script" > "$definitions"
run "${UNLEASH_TEST_SHELL:-bash}" -u -c '
run "${RUNAWAY_TEST_SHELL:-bash}" -u -c '
source "$1"
mode="$2"
load_config() { :; }
@@ -41,7 +41,7 @@ run_network_state() {
@test "network doctor distinguishes query failure from absent hardware" {
local entrypoint mode
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
for mode in missing portsfail powerfail linkfail; do
run_network_state "$BATS_TEST_DIRNAME/../$entrypoint" "$mode"
[ "$status" -ne 0 ]
@@ -53,7 +53,7 @@ run_network_state() {
@test "network doctor classifies IPv4 state without exposing addresses" {
local entrypoint mode expected
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
for mode in configured linklocal none; do
expected="$mode"; [ "$mode" != linklocal ] || expected=link-local
run_network_state "$BATS_TEST_DIRNAME/../$entrypoint" "$mode"
@@ -68,7 +68,7 @@ run_network_state() {
@test "network doctor reports absent Wi-Fi after a successful hardware query" {
local entrypoint
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
run_network_state "$BATS_TEST_DIRNAME/../$entrypoint" absent
[ "$status" -eq 0 ]
[[ "$output" == *"No Wi-Fi hardware port reported"* ]]
+5 -5
View File
@@ -3,18 +3,18 @@
check_daemon_path() {
local installer="$1" action="$2" label="$3"
local entrypoint
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
local folder="$BATS_TEST_TMPDIR/$entrypoint/Tool Folder & <profile> \"quoted\""
local target="$BATS_TEST_TMPDIR/$entrypoint/Target"
local script="$folder/renamed standalone.sh"
local definitions="$BATS_TEST_TMPDIR/$entrypoint.functions"
mkdir -p "$folder" "$target/Library"
printf '#!/bin/bash\nprintf "ACTION=%%s\\n" "$1"\n' > "$script"
if [ "$entrypoint" = unleash ]; then
if [ "$entrypoint" = runaway ]; then
ln -s "$BATS_TEST_DIRNAME/../lib" "$folder/lib"
fi
sed '/^main "\$@"$/d' "$BATS_TEST_DIRNAME/../$entrypoint" > "$definitions"
run "${UNLEASH_TEST_SHELL:-bash}" -u -c '
run "${RUNAWAY_TEST_SHELL:-bash}" -u -c '
unset SCRIPT_DIR SCRIPT_PATH
source "$1"
expected="$2/Library/LaunchDaemons"
@@ -40,9 +40,9 @@ PY
}
@test "persistence invokes renamed scripts with spaces and XML text literally" {
check_daemon_path install_persist_launchdaemon heal com.unleash.heal
check_daemon_path install_persist_launchdaemon heal com.runaway.heal
}
@test "monitor invokes renamed scripts with spaces and XML text literally" {
check_daemon_path install_monitor_launchdaemon monitor com.unleash.monitor
check_daemon_path install_monitor_launchdaemon monitor com.runaway.monitor
}
+4 -4
View File
@@ -2,12 +2,12 @@
@test "Recovery download runs without a library directory" {
local repo="$BATS_TEST_DIRNAME/.." artifact target="$BATS_TEST_TMPDIR/recovery"
artifact=$(sed -n 's|^curl -L https://raw.githubusercontent.com/mateussiqueira/unleash/main/\([^ ]*\) -o /tmp/unleash$|\1|p' "$repo/README.md")
artifact=$(sed -n 's|^curl -L https://raw.githubusercontent.com/mateussiqueira/runaway/main/\([^ ]*\) -o /tmp/runaway$|\1|p' "$repo/README.md")
[ -n "$artifact" ]
mkdir -p "$target"
cp "$repo/$artifact" "$target/unleash"
run env HOME="$target" XDG_CONFIG_HOME="$target/config" bash "$target/unleash" version
cp "$repo/$artifact" "$target/runaway"
run env HOME="$target" XDG_CONFIG_HOME="$target/config" bash "$target/runaway" version
[ "$status" -eq 0 ]
[[ "$output" == *"unleash"* ]]
[[ "$output" == *"runaway"* ]]
[ ! -d "$target/lib" ]
}
+3 -3
View File
@@ -4,7 +4,7 @@ run_preview() {
local script="$1" command="$2" recovery="$3"
local definitions="$BATS_TEST_TMPDIR/preview.functions"
sed '/^main "\$@"$/d' "$script" > "$definitions"
run "${UNLEASH_TEST_SHELL:-bash}" -u -c '
run "${RUNAWAY_TEST_SHELL:-bash}" -u -c '
source "$1"
action="$2" recovery="$3"
load_config() { :; }
@@ -16,7 +16,7 @@ run_preview() {
@test "suppress and bypass dry runs return before target resolution" {
local entrypoint action
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
for action in suppress bypass; do
run_preview "$BATS_TEST_DIRNAME/../$entrypoint" "$action" 0
[ "$status" -eq 0 ]
@@ -28,7 +28,7 @@ run_preview() {
@test "bypass dry run still rejects a booted OS" {
local entrypoint
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
run_preview "$BATS_TEST_DIRNAME/../$entrypoint" bypass 1
[ "$status" -ne 0 ]
[[ "$output" == *"Full bypass must run from Recovery mode"* ]]
+10 -10
View File
@@ -13,7 +13,7 @@ suppress_fixture() {
@test "heal repairs old Rosetta blocks even when suppression is otherwise intact" {
local entrypoint
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
local script="$BATS_TEST_DIRNAME/../$entrypoint"
local target="$BATS_TEST_TMPDIR/$entrypoint" hosts
hosts="$target/private/etc/hosts"
@@ -27,7 +27,7 @@ suppress_fixture() {
@test "heal dry run preserves old Rosetta entries" {
local entrypoint
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
local script="$BATS_TEST_DIRNAME/../$entrypoint"
local target="$BATS_TEST_TMPDIR/$entrypoint" hosts
hosts="$target/private/etc/hosts"
@@ -36,13 +36,13 @@ suppress_fixture() {
cp "$hosts" "$target/original"
suppress_fixture "$script" "$target" heal_suppress true
cmp "$target/original" "$hosts"
[ ! -e "$hosts.unleash-rosetta.bak" ]
[ ! -e "$hosts.runaway-rosetta.bak" ]
done
}
@test "suppression does not add hosts blocks for Rosetta configuration" {
local entrypoint
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
local script="$BATS_TEST_DIRNAME/../$entrypoint"
local target="$BATS_TEST_TMPDIR/$entrypoint"
mkdir -p "$target/private/etc"
@@ -56,27 +56,27 @@ suppress_fixture() {
@test "suppression repairs its old Rosetta blocks with an unchanged backup on rerun" {
local entrypoint
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
local script="$BATS_TEST_DIRNAME/../$entrypoint"
local target="$BATS_TEST_TMPDIR/$entrypoint" hosts
hosts="$target/private/etc/hosts"
mkdir -p "$(dirname "$hosts")"
printf '127.0.0.1 localhost\n# Added by unleash — DEP enrollment block\n0.0.0.0 configuration.apple.com\n:: configuration.apple.com\n' > "$hosts"
printf '127.0.0.1 localhost\n# Added by runaway — DEP enrollment block\n0.0.0.0 configuration.apple.com\n:: configuration.apple.com\n' > "$hosts"
cp "$hosts" "$target/original"
suppress_fixture "$script" "$target"
run grep -q 'configuration[.]apple[.]com' "$hosts"
[ "$status" -eq 1 ]
cmp "$target/original" "$hosts.unleash-rosetta.bak"
cmp "$target/original" "$hosts.runaway-rosetta.bak"
cp "$hosts" "$target/repaired"
suppress_fixture "$script" "$target"
cmp "$target/repaired" "$hosts"
cmp "$target/original" "$hosts.unleash-rosetta.bak"
cmp "$target/original" "$hosts.runaway-rosetta.bak"
done
}
@test "suppression preserves Rosetta blocks outside its generated section" {
local entrypoint
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
local script="$BATS_TEST_DIRNAME/../$entrypoint"
local target="$BATS_TEST_TMPDIR/$entrypoint" hosts
hosts="$target/private/etc/hosts"
@@ -85,6 +85,6 @@ suppress_fixture() {
suppress_fixture "$script" "$target"
grep -Fxq '0.0.0.0 configuration.apple.com' "$hosts"
grep -Fxq ':: configuration.apple.com manual.alias' "$hosts"
[ ! -e "$hosts.unleash-rosetta.bak" ]
[ ! -e "$hosts.runaway-rosetta.bak" ]
done
}
+2 -2
View File
@@ -41,7 +41,7 @@ teardown() {
}
@test "text audit completes with zero profiles under nounset" {
run "${UNLEASH_TEST_SHELL:-bash}" -u -c '
run "${RUNAWAY_TEST_SHELL:-bash}" -u -c '
source "$1/lib/colors.sh"
source "$1/lib/status.sh"
pf_status() { :; }
@@ -57,7 +57,7 @@ teardown() {
for module in status report; do
if [ "$module" = status ]; then function_name=deep_status_json; field=profile_count;
else function_name=generate_report_json; field=installed_profiles; fi
run "${UNLEASH_TEST_SHELL:-bash}" -u -c '
run "${RUNAWAY_TEST_SHELL:-bash}" -u -c '
source "$1/lib/colors.sh"
source "$1/lib/$2.sh"
grep() {
+2 -2
View File
@@ -2,7 +2,7 @@
check_optional_record() {
local kind="$1" entrypoint
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
local script="$BATS_TEST_DIRNAME/../$entrypoint"
local definitions="$BATS_TEST_TMPDIR/$entrypoint.functions"
local target="$BATS_TEST_TMPDIR/$entrypoint-volume"
@@ -18,7 +18,7 @@ records = {
}
(settings / ".cloudConfigRecordFound").write_bytes(plistlib.dumps(records[sys.argv[2]]))
PY
run "${UNLEASH_TEST_SHELL:-bash}" -eu -o pipefail -c '
run "${RUNAWAY_TEST_SHELL:-bash}" -eu -o pipefail -c '
source "$1"
target="$2"
load_config() { :; }
+1 -1
View File
@@ -3,7 +3,7 @@
check_volume_output() {
local mode="$1" entrypoint
bats_require_minimum_version 1.5.0
for entrypoint in unleash unleash-standalone.sh; do
for entrypoint in runaway runaway-standalone.sh; do
local script="$BATS_TEST_DIRNAME/../$entrypoint"
local target="$BATS_TEST_TMPDIR/$entrypoint/Data volume"
mkdir -p "$target/private/var/db/dslocal/nodes/Default"
+1 -1
View File
@@ -4,7 +4,7 @@ setup() {
load '../lib/colors.sh'
load '../lib/vpn.sh'
TEST_DIR=$(mktemp -d)
mkdir -p "$TEST_DIR/etc/pf.anchors/com.unleash"
mkdir -p "$TEST_DIR/etc/pf.anchors/com.runaway"
}
teardown() {
+1 -1
View File
@@ -13,7 +13,7 @@ teardown() {
@test "install_selective_block creates anchor" {
run install_selective_block "$TEST_DIR" 2>/dev/null || true
[ -f "$TEST_DIR/etc/pf.anchors/com.unleash.selective" ]
[ -f "$TEST_DIR/etc/pf.anchors/com.runaway.selective" ]
}
@test "install_selective_block creates pf.conf" {