#!/usr/bin/env bash
set -eu
top="$(pwd)"
log_path="${top}/test.log"
./clean
ls -d */ | parallel "$@" --will-cite "
cd '${top}/{}'
if [ -e test ]; then
  echo '{}'
  ret=0
  ./test >> '$log_path' 2>&1 || ret=$?
  if [ $? -ne 0 ]; then
    echo 'Test failed: {}'
  fi
fi
"
echo 'All tests passed'
