testing/do-tests is made from do-tests.in by inserting actual routing table
authorAndreas Steffen <andreas.steffen@strongswan.org>
Tue, 28 Aug 2007 06:40:39 +0000 (06:40 -0000)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Tue, 28 Aug 2007 06:40:39 +0000 (06:40 -0000)
testing/Makefile.am [new file with mode: 0644]
testing/Makefile.in [new file with mode: 0644]
testing/do-tests [deleted file]
testing/do-tests.in [new file with mode: 0755]

diff --git a/testing/Makefile.am b/testing/Makefile.am
new file mode 100644 (file)
index 0000000..2ce6f2c
--- /dev/null
@@ -0,0 +1,11 @@
+noinst_SCRIPTS = do-tests
+CLEANFILES = do-tests
+EXTRA_DIST = do-tests.in make-testing start-testing stop-testing \
+             testing.conf hosts images scripts tests INSTALL README
+
+do-tests : do-tests.in
+       sed \
+       -e "s:\@IPSEC_ROUTING_TABLE\@:$(IPSEC_ROUTING_TABLE):" \
+       $< > $@
+       chmod +x $@
+
diff --git a/testing/Makefile.in b/testing/Makefile.in
new file mode 100644 (file)
index 0000000..2346075
--- /dev/null
@@ -0,0 +1,358 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = testing
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       INSTALL
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+SCRIPTS = $(noinst_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GPERF = @GPERF@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+IPSEC_ROUTING_TABLE = @IPSEC_ROUTING_TABLE@
+IPSEC_ROUTING_TABLE_PRIO = @IPSEC_ROUTING_TABLE_PRIO@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LINUX_HEADERS = @LINUX_HEADERS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+backenddir = @backenddir@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+confdir = @confdir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+dbus_CFLAGS = @dbus_CFLAGS@
+dbus_LIBS = @dbus_LIBS@
+docdir = @docdir@
+dvidir = @dvidir@
+eapdir = @eapdir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+interfacedir = @interfacedir@
+ipsecdir = @ipsecdir@
+ipsecgid = @ipsecgid@
+ipsecuid = @ipsecuid@
+libdir = @libdir@
+libexecdir = @libexecdir@
+linuxdir = @linuxdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+piddir = @piddir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xml_CFLAGS = @xml_CFLAGS@
+xml_LIBS = @xml_LIBS@
+noinst_SCRIPTS = do-tests
+CLEANFILES = do-tests
+EXTRA_DIST = do-tests.in make-testing start-testing stop-testing \
+             testing.conf hosts images scripts tests INSTALL README
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  testing/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  testing/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       list='$(DISTFILES)'; \
+         dist_files=`for file in $$list; do echo $$file; done | \
+         sed -e "s|^$$srcdirstrip/||;t" \
+             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+       case $$dist_files in \
+         */*) $(MKDIR_P) `echo "$$dist_files" | \
+                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+                          sort -u` ;; \
+       esac; \
+       for file in $$dist_files; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         if test -d $$d/$$file; then \
+           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(SCRIPTS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+       distclean distclean-generic distclean-libtool distdir dvi \
+       dvi-am html html-am info info-am install install-am \
+       install-data install-data-am install-dvi install-dvi-am \
+       install-exec install-exec-am install-html install-html-am \
+       install-info install-info-am install-man install-pdf \
+       install-pdf-am install-ps install-ps-am install-strip \
+       installcheck installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-generic \
+       mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+do-tests : do-tests.in
+       sed \
+       -e "s:\@IPSEC_ROUTING_TABLE\@:$(IPSEC_ROUTING_TABLE):" \
+       $< > $@
+       chmod +x $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/testing/do-tests b/testing/do-tests
deleted file mode 100755 (executable)
index c48d64f..0000000
+++ /dev/null
@@ -1,663 +0,0 @@
-#!/bin/bash
-# Automatically execute the strongSwan test cases
-#
-# Copyright (C) 2004  Eric Marchionni, Patrik Rayo
-# Zuercher Hochschule Winterthur
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 2 of the License, or (at your
-# option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-#
-# RCSID $Id: do-tests,v 1.20 2006/02/08 21:27:59 as Exp $
-
-DIR=`dirname $0`
-
-source $DIR/scripts/function.sh
-
-[ -f $DIR/testing.conf ] || die "Configuration file 'testing.conf' not found"
-[ -d $DIR/hosts ] || die "Directory 'hosts' not found"
-[ -d $DIR/tests ] || die "Directory 'tests' not found"
-
-source $DIR/testing.conf
-
-
-##############################################################################
-# test if UMLs have been built at all
-#
-
-[ -d $BUILDDIR ] || die "Directory '$BUILDDIR' does not exist. Please run 'make-testing'first."
-
-
-##############################################################################
-# take care of new path and file variables
-#
-
-[ -d $TESTRESULTSDIR ] || mkdir $TESTRESULTSDIR
-
-TESTDATE=`date +%Y%m%d-%H%M`
-
-TODAYDIR=$TESTRESULTSDIR/$TESTDATE
-mkdir $TODAYDIR
-TESTRESULTSHTML=$TODAYDIR/all.html
-INDEX=$TODAYDIR/index.html
-DEFAULTTESTSDIR=$UMLTESTDIR/testing/tests
-
-SOURCEIP_ROUTING_TABLE=100
-
-testnumber="0"
-failed_cnt="0"
-passed_cnt="0"
-
-
-##############################################################################
-# copy default tests to $BUILDDIR
-#
-
-TESTSDIR=$BUILDDIR/tests
-[ -d $TESTSDIR ] || mkdir $TESTSDIR
-
-##############################################################################
-# assign IP for each host to hostname
-#
-
-for host in $STRONGSWANHOSTS
-do
-    eval ipv4_${host}="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`"
-    eval ipv6_${host}="`echo $HOSTNAMEIPV6 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`"
-
-    case $host in
-    moon)
-        eval ipv4_moon1="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
-        eval ipv6_moon1="`echo $HOSTNAMEIPV6 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
-        ;;
-    sun)
-        eval ipv4_sun1="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
-        eval ipv6_sun1="`echo $HOSTNAMEIPV6 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
-        ;;
-    alice)
-        eval ipv4_alice1="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
-        eval ipv6_alice1="`echo $HOSTNAMEIPV6 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
-        ;;
-    venus)
-        ;;
-    bob)
-        ;;
-    carol)
-        eval ipv4_carol1="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
-        eval ipv6_carol1="`echo $HOSTNAMEIPV6 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
-         ;;
-    dave)
-        eval ipv4_dave1="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
-        eval ipv6_dave1="`echo $HOSTNAMEIPV6 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
-        ;;
-    winnetou)
-        ;;
-    esac
-done
-
-
-##############################################################################
-# create header for the results html file
-#
-
-KERNEL_VERSION=`basename $KERNEL .tar.bz2`
-IPSEC_VERSION=`basename $STRONGSWAN .tar.bz2`
-
-cat > $INDEX <<@EOF
-<html>
-<head>
-  <title>strongSwan UML Tests</title>
-</head>
-<body>
-  <h2>strongSwan UML Tests</h2>
-  <table border="0" cellspacing="2">
-    <tr valign="top">
-      <td><b>Host:</b></td>
-      <td colspan="3">`uname -a`</td>
-    </tr>
-    <tr valign="top">
-      <td><b>UML kernel: &nbsp;</b></td>
-      <td colspan="3">$KERNEL_VERSION</td>
-    </tr>
-    <tr valign="top">
-      <td><b>IPsec:</b></td>
-      <td colspan="3">$IPSEC_VERSION</td>
-    </tr>
-    <tr valign="top">
-      <td><b>Date:</b></td>
-      <td colspan="3">$TESTDATE</td>
-    </tr>
-    <tr>
-      <td width="100">&nbsp;</td>
-      <td width="200">&nbsp;</td>
-      <td width=" 50">&nbsp;</td>
-      <td >&nbsp;</td>
-    </tr>
-@EOF
-
-cat $INDEX > $TESTRESULTSHTML
-cat >> $TESTRESULTSHTML <<@EOF
-    <tr align="left">
-      <th>Number</th>
-      <th>Test</th>
-      <th colspan="2">Result</th>
-    </tr>
-@EOF
-
-cecho "UML kernel: $KERNEL_VERSION"
-cecho "IPsec:      $IPSEC_VERSION"
-cecho "Date:       $TESTDATE"
-cecho ""
-
-
-##############################################################################
-# enter specific test directory
-#
-
-if [ $# -gt 0 ]
-then
-    TESTS=$*
-elif [ $SELECTEDTESTSONLY = "yes" ]
-then
-    # set internal field seperator
-    TESTS=$SELECTEDTESTS
-else
-    # set internal field seperator
-    TESTS="`ls $DEFAULTTESTSDIR`"
-fi
-
-for SUBDIR in $TESTS
-do
-    SUBTESTS="`basename $SUBDIR`"
-
-    if [ $SUBTESTS = $SUBDIR ]
-    then
-       SUBTESTS="`ls $DEFAULTTESTSDIR/$SUBDIR`"
-    else
-       SUBDIR="`dirname $SUBDIR`"
-    fi
-
-    if [ ! -d $TODAYDIR/$SUBDIR ]
-    then
-       mkdir $TODAYDIR/$SUBDIR
-       if [ $testnumber == 0 ]
-       then
-           FIRST="<b>Category:</b"
-       else
-           FIRST="&nbsp;"
-       fi
-       echo "    <tr>" >> $INDEX
-    echo "      <td>$FIRST</td>">> $INDEX
-    echo "      <td><a href=\"$SUBDIR/index.html\">$SUBDIR</a></td>" >> $INDEX
-    echo "      <td align=\"right\">x</td>" >> $INDEX
-    echo "      <td>&nbsp;</td>" >> $INDEX
-    echo "    </tr>" >> $INDEX
-       SUBTESTSINDEX=$TODAYDIR/$SUBDIR/index.html
-       cat > $SUBTESTSINDEX <<@EOF
-<html>
-<head>
-  <title>strongSwan $SUBDIR Tests</title>
-</head>
-<body>
-  <h2>strongSwan $SUBDIR Tests</h2>
-  <table border="0" cellspacing="2">
-    <tr valign="top">
-      <td><b>UML kernel: &nbsp;</b></td>
-      <td colspan="3">$KERNEL_VERSION</td>
-    </tr>
-    <tr valign="top">
-      <td><b>IPsec:</b></td>
-      <td colspan="3">$IPSEC_VERSION</td>
-    </tr>
-    <tr valign="top">
-      <td><b>Date:</b></td>
-      <td colspan="3">$TESTDATE</td>
-    </tr>
-    <tr>
-      <td width="100">&nbsp;</td>
-      <td width="200">&nbsp;</td>
-      <td width=" 50">&nbsp;</td>
-      <td >&nbsp;</td>
-    </tr>
-    <tr align="left">
-       <th>Number</th>
-       <th>Test</th>
-       <th colspan="2">Result</th>
-    </tr>
-@EOF
-    fi
-
-    for name in $SUBTESTS
-    do
-       let "testnumber += 1"
-       testname=$SUBDIR/$name
-       cecho-n " $testnumber $testname.."
-
-       if [ ! -d $DEFAULTTESTSDIR/${testname} ]
-       then
-           cecho "is missing..skipped"
-           continue
-       fi
-
-       [ -f $DEFAULTTESTSDIR/${testname}/description.txt ] || die "!! File 'description.txt' is missing"
-       [ -f $DEFAULTTESTSDIR/${testname}/test.conf ]       || die "!! File 'test.conf' is missing"
-       [ -f $DEFAULTTESTSDIR/${testname}/pretest.dat ]     || die "!! File 'pretest.dat' is missing"
-       [ -f $DEFAULTTESTSDIR/${testname}/posttest.dat ]    || die "!! File 'posttest.dat' is missing"
-       [ -f $DEFAULTTESTSDIR/${testname}/evaltest.dat ]    || die "!! File 'evaltest.dat' is missing"
-
-       TESTRESULTDIR=$TODAYDIR/$testname
-       mkdir -p $TESTRESULTDIR
-       CONSOLE_LOG=$TESTRESULTDIR/console.log
-       touch $CONSOLE_LOG
-
-       TESTDIR=$TESTSDIR/${testname}
-       rm -rf $TESTDIR
-       mkdir -p $TESTDIR
-       cp -rfp $DEFAULTTESTSDIR/${testname}/* $TESTDIR
-
-
-       ##############################################################################
-       # replace IP wildcards with actual IPv4 and IPv6 addresses
-       #
-
-       for host in $STRONGSWANHOSTS
-       do
-           case $host in
-           moon)
-               searchandreplace PH_IP_MOON1     $ipv4_moon1 $TESTDIR
-               searchandreplace PH_IP_MOON      $ipv4_moon  $TESTDIR
-               searchandreplace PH_IP6_MOON1    $ipv6_moon1 $TESTDIR
-               searchandreplace PH_IP6_MOON     $ipv6_moon  $TESTDIR
-               ;;
-           sun)
-               searchandreplace PH_IP_SUN1      $ipv4_sun1 $TESTDIR
-               searchandreplace PH_IP_SUN       $ipv4_sun  $TESTDIR
-               searchandreplace PH_IP6_SUN1     $ipv6_sun1 $TESTDIR
-               searchandreplace PH_IP6_SUN      $ipv6_sun  $TESTDIR
-               ;;
-           alice)
-               searchandreplace PH_IP_ALICE1    $ipv4_alice1 $TESTDIR
-               searchandreplace PH_IP_ALICE     $ipv4_alice  $TESTDIR
-               searchandreplace PH_IP6_ALICE1   $ipv6_alice1 $TESTDIR
-               searchandreplace PH_IP6_ALICE    $ipv6_alice  $TESTDIR
-               ;;
-           venus)
-               searchandreplace PH_IP_VENUS     $ipv4_venus $TESTDIR
-               searchandreplace PH_IP6_VENUS    $ipv6_venus $TESTDIR
-               ;;
-           bob)
-               searchandreplace PH_IP_BOB       $ipv4_bob $TESTDIR
-               searchandreplace PH_IPV6_BOB     $ipv6_bob $TESTDIR
-               ;;
-           carol)
-               searchandreplace PH_IP_CAROL1    $ipv4_carol1 $TESTDIR
-               searchandreplace PH_IP_CAROL     $ipv4_carol  $TESTDIR
-               searchandreplace PH_IP6_CAROL1   $ipv6_carol1 $TESTDIR
-               searchandreplace PH_IP6_CAROL    $ipv6_carol  $TESTDIR
-               ;;
-           dave)
-               searchandreplace PH_IP_DAVE1     $ipv4_dave1 $TESTDIR
-               searchandreplace PH_IP_DAVE      $ipv4_dave  $TESTDIR
-               searchandreplace PH_IP6_DAVE1    $ipv6_dave1 $TESTDIR
-               searchandreplace PH_IP6_DAVE     $ipv6_dave  $TESTDIR
-               ;;
-           winnetou)
-               searchandreplace PH_IP_WINNETOU  $ipv4_winnetou $TESTDIR
-               searchandreplace PH_IP6_WINNETOU $ipv6_winnetou $TESTDIR
-               ;;
-           esac
-       done
-
-
-       ##########################################################################
-       # copy test specific configurations to uml hosts and clear auth.log files
-       #
-
-       $DIR/scripts/load-testconfig $testname
-       source $TESTDIR/test.conf
-
-
-       ##########################################################################
-       # run tcpdump in the background
-       #
-
-       if [ "$TCPDUMPHOSTS" != "" ]
-       then
-           echo -e "TCPDUMP\n" >> $CONSOLE_LOG 2>&1
-
-           for host_iface in $TCPDUMPHOSTS
-           do
-               host=`echo $host_iface | awk -F ":" '{print $1}'`
-               iface=`echo $host_iface | awk -F ":" '{if ($2 != "") { print $2 } else { printf("eth0") }}'`
-               tcpdump_cmd="tcpdump -i $iface not port ssh and not port domain and not arp > /tmp/tcpdump.log 2>&1 &"
-               echo "${host}# $tcpdump_cmd" >> $CONSOLE_LOG
-               ssh root@`eval echo \\\$ipv4_$host '$tcpdump_cmd'`
-               eval TDUP_${host}="true"
-           done
-       fi
-
-
-       ##########################################################################
-       # execute pre-test commands
-       #
-
-       cecho-n "pre.."
-       echo -e "\nPRE-TEST\n" >> $CONSOLE_LOG 2>&1
-
-       eval `awk -F "::" '{
-           if ($2 != "")
-           {
-               printf("echo \"%s# %s\"; ", $1, $2)
-               printf("ssh root@\044ipv4_%s \"%s\"; ", $1, $2)
-               printf("echo;\n")
-           }
-       }' $TESTDIR/pretest.dat` >> $CONSOLE_LOG 2>&1
-
-
-       ##########################################################################
-       # stop tcpdump
-       #
-
-       function stop_tcpdump {
-           echo "${1}# killall tcpdump" >> $CONSOLE_LOG
-           eval ssh root@\$ipv4_${1} killall tcpdump
-           eval TDUP_${1}="false"
-           echo ""
-       }
-
-
-       ##########################################################################
-       # get and evaluate test results
-       #
-
-       cecho-n "test.."
-       echo -e "\nTEST\n" >> $CONSOLE_LOG 2>&1
-
-       STATUS="passed"
-
-       eval `awk -F "::" '{
-           host=$1
-           command=$2
-           pattern=$3
-           hit=$4
-           if (command != "")
-           {
-               if (command == "tcpdump")
-               {
-                   printf("if [ \044TDUP_%s == \"true\" ]; then stop_tcpdump %s; fi; \n", host, host)
-                   printf("echo \"%s# cat /tmp/tcpdump.log | grep \047%s\047  [%s]\"; ", host, pattern, hit)
-                   printf("ssh root@\044ipv4_%s cat /tmp/tcpdump.log | grep \"%s\"; ", host, pattern)
-               }
-               else
-               {
-                   printf("echo \"%s# %s | grep \047%s\047  [%s]\"; ", host, command, pattern, hit)
-                   printf("ssh root@\044ipv4_%s %s | grep \"%s\"; ",  host, command, pattern)
-               }
-               printf("cmd_exit=\044?; ")
-               printf("echo; ")
-               printf("if [ \044cmd_exit -eq 0 -a \"%s\" = \"NO\"  ] ", hit)
-               printf("|| [ \044cmd_exit -ne 0 -a \"%s\" = \"YES\" ] ", hit)
-               printf("; then STATUS=\"failed\"; fi; \n")
-           }
-       }' $TESTDIR/evaltest.dat` >> $CONSOLE_LOG 2>&1
-
-
-       ##########################################################################
-       # set counters
-       #
-
-       if [ $STATUS = "failed" ]
-       then
-           let "failed_cnt += 1"
-       else
-           let "passed_cnt += 1"
-       fi
-
-
-       ##########################################################################
-       # log statusall and listall output
-       # get copies of ipsec.conf, ipsec.secrets
-       # create index.html for the given test case
-
-       cat > $TESTRESULTDIR/index.html <<@EOF
-<html>
-<head>
-  <title>Test $testname</title>
-</head>
-<body>
-<table border="0" width="600">
-  <tr><td>
-    <h2>Test $testname</h2>
-    <h3>Description</h3>
-@EOF
-
-       cat $TESTDIR/description.txt >> $TESTRESULTDIR/index.html
-
-       cat >> $TESTRESULTDIR/index.html <<@EOF
-    <ul>
-      <li><a href="console.log">console.log</a></li>
-    </ul>
-    <img src="../../images/$DIAGRAM" alt="$UMLHOSTS">
-@EOF
-
-       for host in $IPSECHOSTS
-       do
-           eval HOSTLOGIN=root@\$ipv4_${host}
-
-           for command in statusall listall
-           do
-               ssh $HOSTLOGIN ipsec $command \
-                   > $TESTRESULTDIR/${host}.$command 2>/dev/null
-           done
-
-           for file in ipsec.conf ipsec.secrets
-           do
-               scp $HOSTLOGIN:/etc/$file \
-                   $TESTRESULTDIR/${host}.$file  > /dev/null 2>&1
-           done
-
-           ssh $HOSTLOGIN ip route list table $SOURCEIP_ROUTING_TABLE \
-                   > $TESTRESULTDIR/${host}.iproute 2>/dev/null
-           ssh $HOSTLOGIN iptables -v -n -L \
-                   > $TESTRESULTDIR/${host}.iptables 2>/dev/null
-           cat >> $TESTRESULTDIR/index.html <<@EOF
-    <h3>$host</h3>
-      <table border="0" cellspacing="0" width="400">
-      <tr>
-       <td>
-         <ul>
-           <li><a href="$host.ipsec.conf">ipsec.conf</a></li>
-           <li><a href="$host.ipsec.secrets">ipsec.secrets</a></li>
-           <li><a href="$host.statusall">ipsec statusall</a></li>
-           <li><a href="$host.listall">ipsec listall</a></li>
-         </ul>
-       </td>
-       <td>
-         <ul>
-           <li><a href="$host.auth.log">auth.log</a></li>
-           <li><a href="$host.daemon.log">daemon.log</a></li>
-           <li><a href="$host.iproute">ip route list table $SOURCEIP_ROUTING_TABLE</a></li>
-           <li><a href="$host.iptables">iptables -L</a></li>
-       </ul>
-      </td>
-    </tr>
-    </table>
-@EOF
-
-       done
-
-       cat >> $TESTRESULTDIR/index.html <<@EOF
-  </td></tr>
-  <tr><td align="right">
-    <b><a href="../index.html">Back</a></b>
-  </td></tr>
-</table>
-</body>
-</html>
-@EOF
-
-
-       ##########################################################################
-       # execute post-test commands
-       #
-
-       cecho-n "post.."
-       echo -e "\nPOST-TEST\n" >> $CONSOLE_LOG 2>&1
-
-       eval `awk -F "::" '{
-           if ($2 != "")
-           {
-               printf("echo \"%s# %s\"; ", $1, $2)
-               printf("ssh root@\044ipv4_%s \"%s\"; ", $1, $2)
-               printf("echo;\n")
-           }
-       }' $TESTDIR/posttest.dat` >> $CONSOLE_LOG 2>&1
-
-
-       ##########################################################################
-       # get a copy of /var/log/auth.log
-       #
-
-       for host in $IPSECHOSTS
-       do
-           eval HOSTLOGIN=root@\$ipv4_${host}
-           ssh $HOSTLOGIN grep pluto /var/log/auth.log \
-               > $TESTRESULTDIR/${host}.auth.log
-           echo >> $TESTRESULTDIR/${host}.auth.log
-           ssh $HOSTLOGIN grep charon /var/log/auth.log \
-               >> $TESTRESULTDIR/${host}.auth.log
-       done
-
-
-       ##########################################################################
-       # get a copy of /var/log/daemon.log
-       #
-
-       for host in $IPSECHOSTS
-       do
-           eval HOSTLOGIN=root@\$ipv4_${host}
-           ssh $HOSTLOGIN grep pluto /var/log/daemon.log \
-               > $TESTRESULTDIR/${host}.daemon.log
-           echo >> $TESTRESULTDIR/${host}.daemon.log
-           ssh $HOSTLOGIN grep charon /var/log/daemon.log \
-               >> $TESTRESULTDIR/${host}.daemon.log
-       done
-
-
-       ##########################################################################
-       # stop tcpdump if necessary
-       #
-
-       for host in $TCPDUMPHOSTS
-       do
-           if [ "`eval echo \\\$TDUP_${host}`" = "true" ]
-           then
-               echo "${host}# killall tcpdump" >> $CONSOLE_LOG
-               eval ssh root@\$ipv4_$host killall tcpdump
-               eval TDUP_${host}="false"
-           fi
-       done
-
-
-       ##########################################################################
-       # copy default host config back if necessary
-       #
-
-       $DIR/scripts/restore-defaults $testname
-
-
-       ##########################################################################
-       # write test status to html file
-       #
-
-       if [ $STATUS = "passed" ]
-       then
-           COLOR="green"
-           cecho "\033[1;32m$STATUS"
-       else
-           COLOR="red"
-           cecho "$STATUS"
-       fi
-
-       cat >> $TESTRESULTSHTML << @EOF
-  <tr>
-    <td>$testnumber</td>
-    <td><a href="$testname/">$testname</a></td>
-    <td><a href="$testname/console.log"><font color="$COLOR">$STATUS</font></a></td>
-    <td>&nbsp;</td>
-  </tr>
-@EOF
-       cat >> $SUBTESTSINDEX << @EOF
-  <tr>
-    <td>$testnumber</td>
-    <td><a href="$name/">$name</a></td>
-    <td><a href="$name/console.log"><font color="$COLOR">$STATUS</font></a></td>
-    <td>&nbsp;</td>
-  </tr>
-@EOF
-
-    done
-
-done
-
-
-##############################################################################
-# finish the results html file
-#
-
-cat >> $TESTRESULTSHTML << @EOF
-  </table>
-  <p>
-  <b>Passed: &nbsp; <font color="green">$passed_cnt</font></b><br>
-  <b>Failed: &nbsp; <font color="red">$failed_cnt</font></b><br>
-  <p>
-</body>
-</html>
-@EOF
-
-let "all_cnt = $passed_cnt + $failed_cnt"
-
-cat >> $INDEX << @EOF
-    <tr>
-      <td>&nbsp;</td>
-      <td><a href="all.html"><b>all</b></a></td>
-      <td align="right"><b>$all_cnt</b></td>
-      <td>&nbsp;</td>
-    </tr>
-    <tr>
-      <td><b>Failed:</b></td>
-      <td>&nbsp;</td>
-      <td align="right"><b><font color="red">$failed_cnt</font></b></td>
-      <td>&nbsp;</td>
-    </tr>
-  </table>
-</body>
-</html>
-@EOF
-
-cecho ""
-cecho "\033[1;32mPassed:   $passed_cnt"
-cecho "Failed:   $failed_cnt"
-cecho ""
-
-
-##############################################################################
-# copy the test results to the apache server
-#
-
-HTDOCS="/var/www/localhost/htdocs"
-
-cecho-n "Copying test results to winnetou.."
-ssh root@${ipv4_winnetou} mkdir -p $HTDOCS/testresults > /dev/null 2>&1
-scp -r $TODAYDIR root@${ipv4_winnetou}:$HTDOCS/testresults > /dev/null 2>&1
-ssh root@${ipv4_winnetou} ln -s $HTDOCS/images $HTDOCS/testresults/$TESTDATE/images > /dev/null 2>&1
-cgecho "done"
-cecho ""
-cecho "The results are available in $TODAYDIR"
-cecho "or via the link http://$ipv4_winnetou/testresults/$TESTDATE"
diff --git a/testing/do-tests.in b/testing/do-tests.in
new file mode 100755 (executable)
index 0000000..0ca52da
--- /dev/null
@@ -0,0 +1,663 @@
+#!/bin/bash
+# Automatically execute the strongSwan test cases
+#
+# Copyright (C) 2004  Eric Marchionni, Patrik Rayo
+# Zuercher Hochschule Winterthur
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#
+# RCSID $Id: do-tests,v 1.20 2006/02/08 21:27:59 as Exp $
+
+DIR=`dirname $0`
+
+source $DIR/scripts/function.sh
+
+[ -f $DIR/testing.conf ] || die "Configuration file 'testing.conf' not found"
+[ -d $DIR/hosts ] || die "Directory 'hosts' not found"
+[ -d $DIR/tests ] || die "Directory 'tests' not found"
+
+source $DIR/testing.conf
+
+
+##############################################################################
+# test if UMLs have been built at all
+#
+
+[ -d $BUILDDIR ] || die "Directory '$BUILDDIR' does not exist. Please run 'make-testing'first."
+
+
+##############################################################################
+# take care of new path and file variables
+#
+
+[ -d $TESTRESULTSDIR ] || mkdir $TESTRESULTSDIR
+
+TESTDATE=`date +%Y%m%d-%H%M`
+
+TODAYDIR=$TESTRESULTSDIR/$TESTDATE
+mkdir $TODAYDIR
+TESTRESULTSHTML=$TODAYDIR/all.html
+INDEX=$TODAYDIR/index.html
+DEFAULTTESTSDIR=$UMLTESTDIR/testing/tests
+
+SOURCEIP_ROUTING_TABLE=@IPSEC_ROUTING_TABLE@
+
+testnumber="0"
+failed_cnt="0"
+passed_cnt="0"
+
+
+##############################################################################
+# copy default tests to $BUILDDIR
+#
+
+TESTSDIR=$BUILDDIR/tests
+[ -d $TESTSDIR ] || mkdir $TESTSDIR
+
+##############################################################################
+# assign IP for each host to hostname
+#
+
+for host in $STRONGSWANHOSTS
+do
+    eval ipv4_${host}="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`"
+    eval ipv6_${host}="`echo $HOSTNAMEIPV6 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`"
+
+    case $host in
+    moon)
+        eval ipv4_moon1="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
+        eval ipv6_moon1="`echo $HOSTNAMEIPV6 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
+        ;;
+    sun)
+        eval ipv4_sun1="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
+        eval ipv6_sun1="`echo $HOSTNAMEIPV6 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
+        ;;
+    alice)
+        eval ipv4_alice1="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
+        eval ipv6_alice1="`echo $HOSTNAMEIPV6 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
+        ;;
+    venus)
+        ;;
+    bob)
+        ;;
+    carol)
+        eval ipv4_carol1="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
+        eval ipv6_carol1="`echo $HOSTNAMEIPV6 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
+         ;;
+    dave)
+        eval ipv4_dave1="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
+        eval ipv6_dave1="`echo $HOSTNAMEIPV6 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
+        ;;
+    winnetou)
+        ;;
+    esac
+done
+
+
+##############################################################################
+# create header for the results html file
+#
+
+KERNEL_VERSION=`basename $KERNEL .tar.bz2`
+IPSEC_VERSION=`basename $STRONGSWAN .tar.bz2`
+
+cat > $INDEX <<@EOF
+<html>
+<head>
+  <title>strongSwan UML Tests</title>
+</head>
+<body>
+  <h2>strongSwan UML Tests</h2>
+  <table border="0" cellspacing="2">
+    <tr valign="top">
+      <td><b>Host:</b></td>
+      <td colspan="3">`uname -a`</td>
+    </tr>
+    <tr valign="top">
+      <td><b>UML kernel: &nbsp;</b></td>
+      <td colspan="3">$KERNEL_VERSION</td>
+    </tr>
+    <tr valign="top">
+      <td><b>IPsec:</b></td>
+      <td colspan="3">$IPSEC_VERSION</td>
+    </tr>
+    <tr valign="top">
+      <td><b>Date:</b></td>
+      <td colspan="3">$TESTDATE</td>
+    </tr>
+    <tr>
+      <td width="100">&nbsp;</td>
+      <td width="200">&nbsp;</td>
+      <td width=" 50">&nbsp;</td>
+      <td >&nbsp;</td>
+    </tr>
+@EOF
+
+cat $INDEX > $TESTRESULTSHTML
+cat >> $TESTRESULTSHTML <<@EOF
+    <tr align="left">
+      <th>Number</th>
+      <th>Test</th>
+      <th colspan="2">Result</th>
+    </tr>
+@EOF
+
+cecho "UML kernel: $KERNEL_VERSION"
+cecho "IPsec:      $IPSEC_VERSION"
+cecho "Date:       $TESTDATE"
+cecho ""
+
+
+##############################################################################
+# enter specific test directory
+#
+
+if [ $# -gt 0 ]
+then
+    TESTS=$*
+elif [ $SELECTEDTESTSONLY = "yes" ]
+then
+    # set internal field seperator
+    TESTS=$SELECTEDTESTS
+else
+    # set internal field seperator
+    TESTS="`ls $DEFAULTTESTSDIR`"
+fi
+
+for SUBDIR in $TESTS
+do
+    SUBTESTS="`basename $SUBDIR`"
+
+    if [ $SUBTESTS = $SUBDIR ]
+    then
+       SUBTESTS="`ls $DEFAULTTESTSDIR/$SUBDIR`"
+    else
+       SUBDIR="`dirname $SUBDIR`"
+    fi
+
+    if [ ! -d $TODAYDIR/$SUBDIR ]
+    then
+       mkdir $TODAYDIR/$SUBDIR
+       if [ $testnumber == 0 ]
+       then
+           FIRST="<b>Category:</b"
+       else
+           FIRST="&nbsp;"
+       fi
+       echo "    <tr>" >> $INDEX
+    echo "      <td>$FIRST</td>">> $INDEX
+    echo "      <td><a href=\"$SUBDIR/index.html\">$SUBDIR</a></td>" >> $INDEX
+    echo "      <td align=\"right\">x</td>" >> $INDEX
+    echo "      <td>&nbsp;</td>" >> $INDEX
+    echo "    </tr>" >> $INDEX
+       SUBTESTSINDEX=$TODAYDIR/$SUBDIR/index.html
+       cat > $SUBTESTSINDEX <<@EOF
+<html>
+<head>
+  <title>strongSwan $SUBDIR Tests</title>
+</head>
+<body>
+  <h2>strongSwan $SUBDIR Tests</h2>
+  <table border="0" cellspacing="2">
+    <tr valign="top">
+      <td><b>UML kernel: &nbsp;</b></td>
+      <td colspan="3">$KERNEL_VERSION</td>
+    </tr>
+    <tr valign="top">
+      <td><b>IPsec:</b></td>
+      <td colspan="3">$IPSEC_VERSION</td>
+    </tr>
+    <tr valign="top">
+      <td><b>Date:</b></td>
+      <td colspan="3">$TESTDATE</td>
+    </tr>
+    <tr>
+      <td width="100">&nbsp;</td>
+      <td width="200">&nbsp;</td>
+      <td width=" 50">&nbsp;</td>
+      <td >&nbsp;</td>
+    </tr>
+    <tr align="left">
+       <th>Number</th>
+       <th>Test</th>
+       <th colspan="2">Result</th>
+    </tr>
+@EOF
+    fi
+
+    for name in $SUBTESTS
+    do
+       let "testnumber += 1"
+       testname=$SUBDIR/$name
+       cecho-n " $testnumber $testname.."
+
+       if [ ! -d $DEFAULTTESTSDIR/${testname} ]
+       then
+           cecho "is missing..skipped"
+           continue
+       fi
+
+       [ -f $DEFAULTTESTSDIR/${testname}/description.txt ] || die "!! File 'description.txt' is missing"
+       [ -f $DEFAULTTESTSDIR/${testname}/test.conf ]       || die "!! File 'test.conf' is missing"
+       [ -f $DEFAULTTESTSDIR/${testname}/pretest.dat ]     || die "!! File 'pretest.dat' is missing"
+       [ -f $DEFAULTTESTSDIR/${testname}/posttest.dat ]    || die "!! File 'posttest.dat' is missing"
+       [ -f $DEFAULTTESTSDIR/${testname}/evaltest.dat ]    || die "!! File 'evaltest.dat' is missing"
+
+       TESTRESULTDIR=$TODAYDIR/$testname
+       mkdir -p $TESTRESULTDIR
+       CONSOLE_LOG=$TESTRESULTDIR/console.log
+       touch $CONSOLE_LOG
+
+       TESTDIR=$TESTSDIR/${testname}
+       rm -rf $TESTDIR
+       mkdir -p $TESTDIR
+       cp -rfp $DEFAULTTESTSDIR/${testname}/* $TESTDIR
+
+
+       ##############################################################################
+       # replace IP wildcards with actual IPv4 and IPv6 addresses
+       #
+
+       for host in $STRONGSWANHOSTS
+       do
+           case $host in
+           moon)
+               searchandreplace PH_IP_MOON1     $ipv4_moon1 $TESTDIR
+               searchandreplace PH_IP_MOON      $ipv4_moon  $TESTDIR
+               searchandreplace PH_IP6_MOON1    $ipv6_moon1 $TESTDIR
+               searchandreplace PH_IP6_MOON     $ipv6_moon  $TESTDIR
+               ;;
+           sun)
+               searchandreplace PH_IP_SUN1      $ipv4_sun1 $TESTDIR
+               searchandreplace PH_IP_SUN       $ipv4_sun  $TESTDIR
+               searchandreplace PH_IP6_SUN1     $ipv6_sun1 $TESTDIR
+               searchandreplace PH_IP6_SUN      $ipv6_sun  $TESTDIR
+               ;;
+           alice)
+               searchandreplace PH_IP_ALICE1    $ipv4_alice1 $TESTDIR
+               searchandreplace PH_IP_ALICE     $ipv4_alice  $TESTDIR
+               searchandreplace PH_IP6_ALICE1   $ipv6_alice1 $TESTDIR
+               searchandreplace PH_IP6_ALICE    $ipv6_alice  $TESTDIR
+               ;;
+           venus)
+               searchandreplace PH_IP_VENUS     $ipv4_venus $TESTDIR
+               searchandreplace PH_IP6_VENUS    $ipv6_venus $TESTDIR
+               ;;
+           bob)
+               searchandreplace PH_IP_BOB       $ipv4_bob $TESTDIR
+               searchandreplace PH_IPV6_BOB     $ipv6_bob $TESTDIR
+               ;;
+           carol)
+               searchandreplace PH_IP_CAROL1    $ipv4_carol1 $TESTDIR
+               searchandreplace PH_IP_CAROL     $ipv4_carol  $TESTDIR
+               searchandreplace PH_IP6_CAROL1   $ipv6_carol1 $TESTDIR
+               searchandreplace PH_IP6_CAROL    $ipv6_carol  $TESTDIR
+               ;;
+           dave)
+               searchandreplace PH_IP_DAVE1     $ipv4_dave1 $TESTDIR
+               searchandreplace PH_IP_DAVE      $ipv4_dave  $TESTDIR
+               searchandreplace PH_IP6_DAVE1    $ipv6_dave1 $TESTDIR
+               searchandreplace PH_IP6_DAVE     $ipv6_dave  $TESTDIR
+               ;;
+           winnetou)
+               searchandreplace PH_IP_WINNETOU  $ipv4_winnetou $TESTDIR
+               searchandreplace PH_IP6_WINNETOU $ipv6_winnetou $TESTDIR
+               ;;
+           esac
+       done
+
+
+       ##########################################################################
+       # copy test specific configurations to uml hosts and clear auth.log files
+       #
+
+       $DIR/scripts/load-testconfig $testname
+       source $TESTDIR/test.conf
+
+
+       ##########################################################################
+       # run tcpdump in the background
+       #
+
+       if [ "$TCPDUMPHOSTS" != "" ]
+       then
+           echo -e "TCPDUMP\n" >> $CONSOLE_LOG 2>&1
+
+           for host_iface in $TCPDUMPHOSTS
+           do
+               host=`echo $host_iface | awk -F ":" '{print $1}'`
+               iface=`echo $host_iface | awk -F ":" '{if ($2 != "") { print $2 } else { printf("eth0") }}'`
+               tcpdump_cmd="tcpdump -i $iface not port ssh and not port domain and not arp > /tmp/tcpdump.log 2>&1 &"
+               echo "${host}# $tcpdump_cmd" >> $CONSOLE_LOG
+               ssh root@`eval echo \\\$ipv4_$host '$tcpdump_cmd'`
+               eval TDUP_${host}="true"
+           done
+       fi
+
+
+       ##########################################################################
+       # execute pre-test commands
+       #
+
+       cecho-n "pre.."
+       echo -e "\nPRE-TEST\n" >> $CONSOLE_LOG 2>&1
+
+       eval `awk -F "::" '{
+           if ($2 != "")
+           {
+               printf("echo \"%s# %s\"; ", $1, $2)
+               printf("ssh root@\044ipv4_%s \"%s\"; ", $1, $2)
+               printf("echo;\n")
+           }
+       }' $TESTDIR/pretest.dat` >> $CONSOLE_LOG 2>&1
+
+
+       ##########################################################################
+       # stop tcpdump
+       #
+
+       function stop_tcpdump {
+           echo "${1}# killall tcpdump" >> $CONSOLE_LOG
+           eval ssh root@\$ipv4_${1} killall tcpdump
+           eval TDUP_${1}="false"
+           echo ""
+       }
+
+
+       ##########################################################################
+       # get and evaluate test results
+       #
+
+       cecho-n "test.."
+       echo -e "\nTEST\n" >> $CONSOLE_LOG 2>&1
+
+       STATUS="passed"
+
+       eval `awk -F "::" '{
+           host=$1
+           command=$2
+           pattern=$3
+           hit=$4
+           if (command != "")
+           {
+               if (command == "tcpdump")
+               {
+                   printf("if [ \044TDUP_%s == \"true\" ]; then stop_tcpdump %s; fi; \n", host, host)
+                   printf("echo \"%s# cat /tmp/tcpdump.log | grep \047%s\047  [%s]\"; ", host, pattern, hit)
+                   printf("ssh root@\044ipv4_%s cat /tmp/tcpdump.log | grep \"%s\"; ", host, pattern)
+               }
+               else
+               {
+                   printf("echo \"%s# %s | grep \047%s\047  [%s]\"; ", host, command, pattern, hit)
+                   printf("ssh root@\044ipv4_%s %s | grep \"%s\"; ",  host, command, pattern)
+               }
+               printf("cmd_exit=\044?; ")
+               printf("echo; ")
+               printf("if [ \044cmd_exit -eq 0 -a \"%s\" = \"NO\"  ] ", hit)
+               printf("|| [ \044cmd_exit -ne 0 -a \"%s\" = \"YES\" ] ", hit)
+               printf("; then STATUS=\"failed\"; fi; \n")
+           }
+       }' $TESTDIR/evaltest.dat` >> $CONSOLE_LOG 2>&1
+
+
+       ##########################################################################
+       # set counters
+       #
+
+       if [ $STATUS = "failed" ]
+       then
+           let "failed_cnt += 1"
+       else
+           let "passed_cnt += 1"
+       fi
+
+
+       ##########################################################################
+       # log statusall and listall output
+       # get copies of ipsec.conf, ipsec.secrets
+       # create index.html for the given test case
+
+       cat > $TESTRESULTDIR/index.html <<@EOF
+<html>
+<head>
+  <title>Test $testname</title>
+</head>
+<body>
+<table border="0" width="600">
+  <tr><td>
+    <h2>Test $testname</h2>
+    <h3>Description</h3>
+@EOF
+
+       cat $TESTDIR/description.txt >> $TESTRESULTDIR/index.html
+
+       cat >> $TESTRESULTDIR/index.html <<@EOF
+    <ul>
+      <li><a href="console.log">console.log</a></li>
+    </ul>
+    <img src="../../images/$DIAGRAM" alt="$UMLHOSTS">
+@EOF
+
+       for host in $IPSECHOSTS
+       do
+           eval HOSTLOGIN=root@\$ipv4_${host}
+
+           for command in statusall listall
+           do
+               ssh $HOSTLOGIN ipsec $command \
+                   > $TESTRESULTDIR/${host}.$command 2>/dev/null
+           done
+
+           for file in ipsec.conf ipsec.secrets
+           do
+               scp $HOSTLOGIN:/etc/$file \
+                   $TESTRESULTDIR/${host}.$file  > /dev/null 2>&1
+           done
+
+           ssh $HOSTLOGIN ip route list table $SOURCEIP_ROUTING_TABLE \
+                   > $TESTRESULTDIR/${host}.iproute 2>/dev/null
+           ssh $HOSTLOGIN iptables -v -n -L \
+                   > $TESTRESULTDIR/${host}.iptables 2>/dev/null
+           cat >> $TESTRESULTDIR/index.html <<@EOF
+    <h3>$host</h3>
+      <table border="0" cellspacing="0" width="400">
+      <tr>
+       <td>
+         <ul>
+           <li><a href="$host.ipsec.conf">ipsec.conf</a></li>
+           <li><a href="$host.ipsec.secrets">ipsec.secrets</a></li>
+           <li><a href="$host.statusall">ipsec statusall</a></li>
+           <li><a href="$host.listall">ipsec listall</a></li>
+         </ul>
+       </td>
+       <td>
+         <ul>
+           <li><a href="$host.auth.log">auth.log</a></li>
+           <li><a href="$host.daemon.log">daemon.log</a></li>
+           <li><a href="$host.iproute">ip route list table $SOURCEIP_ROUTING_TABLE</a></li>
+           <li><a href="$host.iptables">iptables -L</a></li>
+       </ul>
+      </td>
+    </tr>
+    </table>
+@EOF
+
+       done
+
+       cat >> $TESTRESULTDIR/index.html <<@EOF
+  </td></tr>
+  <tr><td align="right">
+    <b><a href="../index.html">Back</a></b>
+  </td></tr>
+</table>
+</body>
+</html>
+@EOF
+
+
+       ##########################################################################
+       # execute post-test commands
+       #
+
+       cecho-n "post.."
+       echo -e "\nPOST-TEST\n" >> $CONSOLE_LOG 2>&1
+
+       eval `awk -F "::" '{
+           if ($2 != "")
+           {
+               printf("echo \"%s# %s\"; ", $1, $2)
+               printf("ssh root@\044ipv4_%s \"%s\"; ", $1, $2)
+               printf("echo;\n")
+           }
+       }' $TESTDIR/posttest.dat` >> $CONSOLE_LOG 2>&1
+
+
+       ##########################################################################
+       # get a copy of /var/log/auth.log
+       #
+
+       for host in $IPSECHOSTS
+       do
+           eval HOSTLOGIN=root@\$ipv4_${host}
+           ssh $HOSTLOGIN grep pluto /var/log/auth.log \
+               > $TESTRESULTDIR/${host}.auth.log
+           echo >> $TESTRESULTDIR/${host}.auth.log
+           ssh $HOSTLOGIN grep charon /var/log/auth.log \
+               >> $TESTRESULTDIR/${host}.auth.log
+       done
+
+
+       ##########################################################################
+       # get a copy of /var/log/daemon.log
+       #
+
+       for host in $IPSECHOSTS
+       do
+           eval HOSTLOGIN=root@\$ipv4_${host}
+           ssh $HOSTLOGIN grep pluto /var/log/daemon.log \
+               > $TESTRESULTDIR/${host}.daemon.log
+           echo >> $TESTRESULTDIR/${host}.daemon.log
+           ssh $HOSTLOGIN grep charon /var/log/daemon.log \
+               >> $TESTRESULTDIR/${host}.daemon.log
+       done
+
+
+       ##########################################################################
+       # stop tcpdump if necessary
+       #
+
+       for host in $TCPDUMPHOSTS
+       do
+           if [ "`eval echo \\\$TDUP_${host}`" = "true" ]
+           then
+               echo "${host}# killall tcpdump" >> $CONSOLE_LOG
+               eval ssh root@\$ipv4_$host killall tcpdump
+               eval TDUP_${host}="false"
+           fi
+       done
+
+
+       ##########################################################################
+       # copy default host config back if necessary
+       #
+
+       $DIR/scripts/restore-defaults $testname
+
+
+       ##########################################################################
+       # write test status to html file
+       #
+
+       if [ $STATUS = "passed" ]
+       then
+           COLOR="green"
+           cecho "\033[1;32m$STATUS"
+       else
+           COLOR="red"
+           cecho "$STATUS"
+       fi
+
+       cat >> $TESTRESULTSHTML << @EOF
+  <tr>
+    <td>$testnumber</td>
+    <td><a href="$testname/">$testname</a></td>
+    <td><a href="$testname/console.log"><font color="$COLOR">$STATUS</font></a></td>
+    <td>&nbsp;</td>
+  </tr>
+@EOF
+       cat >> $SUBTESTSINDEX << @EOF
+  <tr>
+    <td>$testnumber</td>
+    <td><a href="$name/">$name</a></td>
+    <td><a href="$name/console.log"><font color="$COLOR">$STATUS</font></a></td>
+    <td>&nbsp;</td>
+  </tr>
+@EOF
+
+    done
+
+done
+
+
+##############################################################################
+# finish the results html file
+#
+
+cat >> $TESTRESULTSHTML << @EOF
+  </table>
+  <p>
+  <b>Passed: &nbsp; <font color="green">$passed_cnt</font></b><br>
+  <b>Failed: &nbsp; <font color="red">$failed_cnt</font></b><br>
+  <p>
+</body>
+</html>
+@EOF
+
+let "all_cnt = $passed_cnt + $failed_cnt"
+
+cat >> $INDEX << @EOF
+    <tr>
+      <td>&nbsp;</td>
+      <td><a href="all.html"><b>all</b></a></td>
+      <td align="right"><b>$all_cnt</b></td>
+      <td>&nbsp;</td>
+    </tr>
+    <tr>
+      <td><b>Failed:</b></td>
+      <td>&nbsp;</td>
+      <td align="right"><b><font color="red">$failed_cnt</font></b></td>
+      <td>&nbsp;</td>
+    </tr>
+  </table>
+</body>
+</html>
+@EOF
+
+cecho ""
+cecho "\033[1;32mPassed:   $passed_cnt"
+cecho "Failed:   $failed_cnt"
+cecho ""
+
+
+##############################################################################
+# copy the test results to the apache server
+#
+
+HTDOCS="/var/www/localhost/htdocs"
+
+cecho-n "Copying test results to winnetou.."
+ssh root@${ipv4_winnetou} mkdir -p $HTDOCS/testresults > /dev/null 2>&1
+scp -r $TODAYDIR root@${ipv4_winnetou}:$HTDOCS/testresults > /dev/null 2>&1
+ssh root@${ipv4_winnetou} ln -s $HTDOCS/images $HTDOCS/testresults/$TESTDATE/images > /dev/null 2>&1
+cgecho "done"
+cecho ""
+cecho "The results are available in $TODAYDIR"
+cecho "or via the link http://$ipv4_winnetou/testresults/$TESTDATE"