#!/bin/sh
# $Id$

echo "starting test environment:"

echo "echo server @ port 65000 as e_echo..."
@SCREEN@ -d -m -S e_echo @abs_srcdir@/echoserver.py
echo "GnuTLS server w/o client checking @ port 65001 as s_server1..."
@SCREEN@ -d -m -S s_server1 \
	@GTLSSRV@ -a --x509keyfile=cert_u.pem --x509certfile=cert_u.pem --echo -p 65001
echo "GnuTLS server w/ client checking @ port 65002 as s_server2..."
@SCREEN@ -d -m -S s_server2 \
	@GTLSSRV@ -r --verify-client-cert --x509keyfile=cert_u.pem --x509certfile=cert_u.pem \
	--x509cafile=ca_cert.pem --echo -p 65002
@SCREEN@ -ls

echo "inetsim (as root)..."
@SUDO@ -s -- <<EOF
rm -f debug.log main.log service.log report.*.txt
@INETSIM@ --config inetsim.conf --report-dir . --log-dir .
chmod 666 debug.log main.log service.log report.*.txt
EOF

echo "shut down echo and GnuTLS servers..."
@SCREEN@ -S e_echo -X quit
@SCREEN@ -S s_server1 -X stuff $'\003'
@SCREEN@ -S s_server2 -X stuff $'\003'
