#!/bin/sh
# Portable unit check; no services or PDF tools. Production uses the 30s ceiling.
set -eu
cd "$(dirname "$0")/.."
TMP=$(mktemp -d /tmp/signet-command.XXXXXX)
trap 'rm -rf "$TMP"' EXIT
${CC:-cc} -O2 -std=c99 -Ivendor -c vendor/sha256.c -o "$TMP/sha256.o"
${CC:-cc} -O2 -std=c99 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 \
    -D_DARWIN_C_SOURCE -DSIGNET_CMD_TIMEOUT_MS=500 -Wall -Wextra -Isrc \
    test/command-contract.c src/util.c "$TMP/sha256.o" -o "$TMP/command-contract"
"$TMP/command-contract"
