#!/bin/sh
#
# Depend on debconf to get a simple png file

set -e
set -x

at_exit() {
    set +x
    echo "info: test exiting, removing $WORKDIR"
    rm -rf $WORKDIR
}
WORKDIR=$(mktemp -d)
trap at_exit INT TERM EXIT
set -x

cd $WORKDIR

# 2025-01-16: valgrind detects a SIGSEGV wheras neither gdb nor a normal run cause one. Disabling
# all hardening fixes the spurious valgrind error. So do not test with valgrind on armhf - hardning
# is more important.
if [ "$(dpkg --print-architecture)" != "armhf" ] && type valgrind >/dev/null 2>&1 ; then
    VALGRIND=valgrind
fi

$VALGRIND theora_png2theora -o test.ogv /usr/share/pixmaps/debian-logo.png

$VALGRIND theora_dump_video test.ogv > test-video.dump

# FIXME figure out how to test these too:
# theora_encoder_example
# theora_player_example
