#!/bin/sh

# Re run the tests after everything has been set up correctly
# Needs to redo any dynamic configuration required

# Useful functions
#----------------------------------------------------------------------
# Run testset specific config scripts
run_testset_config_script()
{
  # Test argument count
  if test $# -lt 1 
  then
    echo "$func_name: Missing argument"; return 1 # unresolved
  fi

  for i in scripts/*; do
    if [ -x $i/$1.sh ]; 
      then $i/$1.sh $2;
      if [ $? -ne 0 ]; then
        echo "Aborting run"
	exit 1
      fi
    fi;
  done;
}

#---------------------------------------------------------------------- 
# Main bit.

cd ~/
. ./profile
if [ ! -f TESTROOT/tetexec.cfg ]; then
    print "Test suites have not yet been configured."
    print "Please run ~/../setup.sh."
fi

# Create/Clean lock areas
if test ! -d "scripts/locks"
then
    mkdir scripts/locks
else
    rm -f scripts/locks/*
fi

# Do any test set specific setups
run_testset_config_script resetup

# Build/Run the test suites
sh ~/run_testsets.sh
