#
# Part of the ht://Dig package   <http://www.htdig.org/>
# Copyright (c) 1999, 2000 The ht://Dig Group
# For copyright details, see the file COPYING in your distribution
# or the GNU General Public License version 2 or later
# <http://www.gnu.org/copyleft/gpl.html>
#
# $Id: test_functions.in,v 1.6.2.5 2000/05/31 10:54:00 ghutchis Exp $
#

testdir=`pwd`

perl=@PERL@

@SET_MAKE@

if test -z "$MAKE"
then
	echo "no make command found"
	exit 77
fi

#
# Prepare http server
#
(
    cd conf
    $MAKE user="@USER@" modules="@APACHE_MODULES@" testdir=$testdir all > /dev/null
)

httpd=@APACHE@

if test -z "$httpd"
then
	echo "no apache server provided. Run configure with --with-apache=<httpd path>"
	exit 77
fi

if [ ! -d logs ] 
then 
  mkdir -p logs
else
  if [ -f logs/httpd.pid ]
  then
    kill -15 `cat logs/httpd.pid`
    sleep 2
  fi
fi
$httpd -f $testdir/conf/httpd.conf

#
# Prepare htdig test environment
#
rm -fr var/htdig
mkdir -p var/htdig
mkdir -p var/htdig2

fail() {
   echo $1
   exit 1
}

htdig=../htdig/htdig
htsearch=../htsearch/htsearch
htmerge=../httools/htmerge
htpurge=../httools/htpurge
htstat=../httools/htstat
htdump=../httools/htdump
htload=../httools/htload

#
# Default index description used for testing
#
export MIFLUZ_CONFIG ; MIFLUZ_CONFIG=${srcdir}/mifluz.conf

rm -f test test_weakcmpr __db*

fail() {
   echo $1
   exit 1
}

