26 lines
506 B
Bash
26 lines
506 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
|
|
|
|
# Trigger overflow-prone copy with large length; expect exit code 0
|
|
RUN_OUT="${tmp}/run.out"
|
|
"${APP}" "300" > "${RUN_OUT}"
|
|
|
|
if ! grep -q "result=" "${RUN_OUT}"; then
|
|
echo "expected output missing" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "tests passed"
|