27 lines
523 B
Bash
27 lines
523 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
OUT="${ROOT}/outputs"
|
|
APP="${OUT}/app"
|
|
|
|
if [[ ! -x "${APP}" ]]; then
|
|
echo "binary missing; run build first" >&2
|
|
exit 1
|
|
fi
|
|
|
|
tmp="$(mktemp -d)"
|
|
trap 'rm -rf "${tmp}"' EXIT
|
|
|
|
# Run command and capture output deterministically
|
|
pushd "${tmp}" >/dev/null
|
|
"${APP}" "echo OK" > "${tmp}/run.out"
|
|
popd >/dev/null
|
|
|
|
if ! grep -q "OK" "${tmp}/run.out"; then
|
|
echo "expected command output not found" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "tests passed"
|