#!/bin/sh

set -e

dir=`dirname "$0"`

# change directory to $AUTOPKGTEST_TMP
cd "${AUTOPKGTEST_TMP}"

cleanup() {
  ex=$?
  rm -f randombytes-info
  exit "${ex}"
}
trap "cleanup" EXIT TERM INT

CC="cc -O"

# librandombytes - shared
echo 'librandombytes - shared:'
${CC} -o randombytes-info "${dir}/../../command/randombytes-info.c" -lrandombytes -lm -lrt
./randombytes-info

if ! ./randombytes-info | grep '^randombytes source kernel-' >/dev/null; then
    echo "FAIL: unexpected randombytes-info output" >&2;
    exit 1
fi

exit 0
