#!/bin/sh
set -e -u
[ -d "$AUTOPKGTEST_TMP/" ] # sanity check
cp -a test "$AUTOPKGTEST_TMP/"
cd "$AUTOPKGTEST_TMP"
mkdir -p home mock src/shell
ln -sf /bin/false mock/scp
# bash_tap_tw expects to find a task binary in a few places
# relative to the current directory
ln -sf /usr/bin/task ./task
export HOME="$PWD/home/"
export PATH="$PWD/mock/:$PATH"
export TASKRC="$HOME/taskrc"
export TASKDATA="$HOME/taskdata"
export TASK_USE_PATH=1

cd test
rm -f bash_completion.test.py # broken paths

for py in *.test.py; do
  echo $py
  python3 $py
done
for shtest in *.test.sh; do
  echo $shtest
  bash $shtest
done
