#!/bin/bash
SIGNAL_FILE=/tmp/build-complete.known
PREV_SIGNAL_FILE=/tmp/build-complete.known.jdigidoc

echo "Starting loop, waiting for 'build complete' signal"
while true
do
  sleep 1
  if [ ! -f $SIGNAL_FILE ]; then continue; fi
  if [ ! $SIGNAL_FILE -nt $PREV_SIGNAL_FILE ]; then continue; fi
  cp $SIGNAL_FILE $PREV_SIGNAL_FILE
  echo "Got 'build complete' signal, running tests"
  ./run-tests.sh
  echo "Waiting for 'build complete' signal"
done

