#!/bin/sh
# autopkgtest check: Build and run a program against libdfx-dev, to verify that the
# headers are installed correctly
# (C) 2023 Canonical Ltd.
# Author: Talha Can Havadar <talha.can.havadar@canonical.com>

set -e

WORKDIR=$(mktemp -d)

cleanup () {
    rm -rf "$WORKDIR"
}

trap cleanup 0 INT QUIT ABRT PIPE TERM

cd $WORKDIR

cat <<EOF > libdfx_test.c
#include <libdfx.h>

int main(int argc, char** argv)
{
    return 0;
}
EOF

gcc -o libdfx_test libdfx_test.c

echo "build: OK"

[ -x libdfx_test ]
./libdfx_test

echo "run: OK"
