#!/bin/sh

set -o errexit
set -o nounset
set -o noclobber

out=/tmp/boot-regression.$$.log

opt="-q --vanilla --no-save"

tests="
inst/models/passing/IntroSEM-BivariateRaw.R
inst/models/passing/JointFIMLRegressionTest.R
inst/models/passing/ifa-drm1.R
inst/models/passing/bivLognormDemo.R
"

for t in $tests; do
  echo -n "$t\t"
  if false; then
    R $opt -f $t
  else
    if ! /usr/bin/time --format "%E %F %R %c" bash -c "R $opt -f $t > $out 2>&1"; then
      cat $out
      exit
    else
      rm -f $out
    fi
  fi
done

exit 0

# -----------------------------------
# !! check psensor for overheating !!
# -----------------------------------

