#!/bin/sh

# do not run in the source tree, as we want to check the system-installed
# apport
TESTDIR=${ADTTMP:-/tmp}/apport-tests
mkdir -p $TESTDIR
cp test/test_* test/run "$TESTDIR"
cd "$TESTDIR"

# clean up old crash reports
rm -rf /var/crash/*

# Set /proc/sys/kernel/core_uses_pid to 0 as that's the easiest way to fix
# tests that expect the core file to be named core and not core.PID
echo 0 > /proc/sys/kernel/core_uses_pid

export GNUPGHOME=$TESTDIR/gnupg
mkdir -m 700 $GNUPGHOME

./run
ret=$?
echo "Number of failed tests: $ret"
exit $ret
