#!/bin/sh
# Build and test the sibling emulator and the full kernel before reporting acceptance.
set -eu
mkdir -p bin/acceptance
if ! make -C ../kernel-emulator test > bin/acceptance/emulator.log 2>&1; then
    cat bin/acceptance/emulator.log
    exit 1
fi
if ! KERNEL_REPLAY=1 make test RAD_EMULATOR=../kernel-emulator/bin/emulator > bin/acceptance/kernel.log 2>&1; then
    cat bin/acceptance/kernel.log
    exit 1
fi
python3 test/acceptance/sizes > bin/acceptance/sizes.log
python3 test/acceptance/metrics bin/acceptance/kernel.log > bin/acceptance/metrics.log
cat bin/acceptance/sizes.log bin/acceptance/metrics.log
printf 'kernel acceptance: emulator and complete kernel matrix passed\n'
