#!/bin/sh # End-to-end test of install.sh against a real CoreScope public/ directory. # # tests/run.sh # # Works on a temporary copy; the directory you pass is never modified. set -eu [ $# -eq 1 ] || { echo "usage: $0 " >&2; exit 2; } HERE=$(cd "$(dirname "$0")/.." && pwd) WORK=$(mktemp -d) trap 'rm -rf "$WORK"' EXIT cp -R "$1" "$WORK/public" cp "$WORK/public/index.html" "$WORK/index.orig.html" fail() { echo "FAIL: $*" >&2; exit 1; } sh "$HERE/install.sh" "$WORK/public" >/dev/null sh "$HERE/install.sh" "$WORK/public" >/dev/null # re-run must not duplicate n=$(grep -c 'audio-v2-metal.js' "$WORK/public/index.html") [ "$n" -eq 1 ] || fail "expected 1 metal