#!/bin/sh
# keyd's integration test suite requires:
#   * access to /dev/uinput
#   * a running keyd daemon (which should be started by the testbed's init system)
#   * a temporary test configuration file in /etc/keyd
set -e
conf=/etc/keyd/integration-test.conf
cd "${0%/*}"/../../t
! [ -e "${conf}" ] || { printf %s\\n "ERROR: config file ${conf} already exists" >&2; exit 1; }
cleanup() {
    rm -f "${conf}"
    keyd.rvaiya reload
}
trap cleanup EXIT
trap 'exit 1' ALRM HUP INT PIPE TERM USR1 USR2
cp test.conf "${conf}"
keyd.rvaiya reload
./runner.py -v --flaky-attempts 5 *.t
