Files
proxy/scripts/test-hermetic.sh
T

44 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
set -eu
repo=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd)
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT HUP INT TERM
snapshot() {
for path in \
"$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.docker/config.json" \
/etc/apt/apt.conf.d /etc/docker/daemon.json /var/lib/proxyctl \
/etc/systemd/system/docker.service.d
do
if [ -d "$path" ]; then
find "$path" -type f -print0 2>/dev/null | sort -z | xargs -0 -r sha256sum 2>/dev/null || ls -ld "$path"
elif [ -r "$path" ]; then
sha256sum "$path"
elif [ -e "$path" ]; then
ls -ld "$path"
else
printf 'absent %s\n' "$path"
fi
done
if command -v gsettings >/dev/null 2>&1; then
gsettings list-recursively org.gnome.system.proxy 2>&1 || true
else
printf 'gsettings absent\n'
fi
if command -v systemctl >/dev/null 2>&1; then
systemctl show docker.service -p ActiveState -p SubState -p NRestarts -p ExecMainStartTimestampMonotonic 2>&1 || true
else
printf 'systemctl absent\n'
fi
}
snapshot >"$work/before"
(
cd "$repo"
go test ./...
)
snapshot >"$work/after"
cmp "$work/before" "$work/after"
printf 'full Go suite passed without changing host Shell, APT, Docker, GNOME, or system-service state\n'