#!/bin/sh
+#
+# Force UTC, so time stamps are printed in a standard time zone, and
+# tests don't have to be run in the time zone in which the output
+# file was generated.
+#
TZ=GMT0; export TZ
-srcdir=${SRCDIR-.}
-echo RUNNING from ${srcdir}
+#
+# Get the tests directory from $0.
+#
+testsdir=`dirname "$0"`
-# make it absolute
-srcdir=`cd $srcdir; pwd`
+#
+# Convert it to an absolute path, so it works even after we do a cd.
+#
+testsdir=`cd ${testsdir}; pwd`
-# this should be run from the compiled build directory,
-# with srcdir= set to wherever the source code is.
-# not from the tests directory.
-echo RUNNING from ${srcdir}
+echo Running tests from ${testsdir}
passedfile=$(pwd)/tests/.passed
failedfile=$(pwd)/tests/.failed
runComplexTests()
{
- for i in ${srcdir}/tests/*.sh
+ for i in ${testsdir}/*.sh
do
case $i in
- ${srcdir}/tests/TEST*.sh) continue;;
- ${srcdir}/tests/\*.sh) continue;;
+ ${testsdir}/TEST*.sh) continue;;
+ ${testsdir}/\*.sh) continue;;
esac
echo Running $i
(cd tests && sh $i ${srcdir})
runSimpleTests()
{
only=$1
- cat ${srcdir}/tests/TESTLIST | while read name input output options
+ cat ${testsdir}/TESTLIST | while read name input output options
do
case $name in
\#*) continue;;
esac
rm -f core
[ "$only" != "" -a "$name" != "$only" ] && continue
- export SRCDIR=${srcdir}
# I hate shells with their stupid, useless subshells.
passed=`cat ${passedfile}`
failed=`cat ${failedfile}`
(cd tests # run TESTonce in tests directory
- if ${srcdir}/tests/TESTonce $name ${srcdir}/tests/$input ${srcdir}/tests/$output "$options"
+ if ${testsdir}/TESTonce $name ${testsdir}/$input ${testsdir}/$output "$options"
then
passed=`expr $passed + 1`
echo $passed >${passedfile}
#!/bin/sh
-srcdir=${SRCDIR-.}
+#
+# Get the tests directory from $0.
+#
+testsdir=`dirname "$0"`
exitcode=0
passed=`cat .passed`
if grep '^#define HAVE_LIBCRYPTO 1$' ../config.h >/dev/null
then
- if ${
srcdir}/tests/TESTonce esp1 ${srcdir}/tests/02-sunrise-sunset-esp.pcap ${srcdir}/tests/esp1.out '-E "
[email protected] 3des-cbc-hmac96:0x4043434545464649494a4a4c4c4f4f515152525454575758"'
+ if ${
testsdir}/TESTonce esp1 ${testsdir}/02-sunrise-sunset-esp.pcap ${testsdir}/esp1.out '-E "
[email protected] 3des-cbc-hmac96:0x4043434545464649494a4a4c4c4f4f515152525454575758"'
then
passed=`expr $passed + 1`
echo $passed >.passed
echo $failed >.failed
exitcode=1
fi
- if ${
srcdir}/tests/TESTonce esp2 ${srcdir}/tests/08-sunrise-sunset-esp2.pcap ${srcdir}/tests/esp2.out '-E "
[email protected] 3des-cbc-hmac96:0x43434545464649494a4a4c4c4f4f51515252545457575840,
[email protected] 3des-cbc-hmac96:0x434545464649494a4a4c4c4f4f5151525254545757584043"'
+ if ${
testsdir}/TESTonce esp2 ${testsdir}/08-sunrise-sunset-esp2.pcap ${testsdir}/esp2.out '-E "
[email protected] 3des-cbc-hmac96:0x43434545464649494a4a4c4c4f4f51515252545457575840,
[email protected] 3des-cbc-hmac96:0x434545464649494a4a4c4c4f4f5151525254545757584043"'
then
passed=`expr $passed + 1`
echo $passed >.passed
echo $failed >.failed
exitcode=1
fi
- if ${srcdir}/tests/TESTonce esp3 ${srcdir}/tests/02-sunrise-sunset-esp.pcap ${srcdir}/tests/esp1.out '-E "3des-cbc-hmac96:0x4043434545464649494a4a4c4c4f4f515152525454575758"'
+ if ${testsdir}/TESTonce esp3 ${testsdir}/02-sunrise-sunset-esp.pcap ${testsdir}/esp1.out '-E "3des-cbc-hmac96:0x4043434545464649494a4a4c4c4f4f515152525454575758"'
then
passed=`expr $passed + 1`
echo $passed >.passed
printf "$FORMAT" ikev2pI2
printf "$FORMAT" isakmp4
else
- if ${srcdir}/tests/TESTonce esp4 ${srcdir}/tests/08-sunrise-sunset-esp2.pcap ${srcdir}/tests/esp2.out "-E \"file ${srcdir}/tests/esp-secrets.txt\""
+ if ${testsdir}/TESTonce esp4 ${testsdir}/08-sunrise-sunset-esp2.pcap ${testsdir}/esp2.out "-E \"file ${testsdir}/esp-secrets.txt\""
then
passed=`expr $passed + 1`
echo $passed >.passed
echo $failed >.failed
exitcode=1
fi
- if ${srcdir}/tests/TESTonce esp5 ${srcdir}/tests/08-sunrise-sunset-aes.pcap ${srcdir}/tests/esp5.out "-E \"file ${srcdir}/tests/esp-secrets.txt\""
+ if ${testsdir}/TESTonce esp5 ${testsdir}/08-sunrise-sunset-aes.pcap ${testsdir}/esp5.out "-E \"file ${testsdir}/esp-secrets.txt\""
then
passed=`expr $passed + 1`
echo $passed >.passed
echo $failed >.failed
exitcode=1
fi
- if ${srcdir}/tests/TESTonce espudp1 ${srcdir}/tests/espudp1.pcap ${srcdir}/tests/espudp1.out "-nnnn -E \"file ${srcdir}/tests/esp-secrets.txt\""
+ if ${testsdir}/TESTonce espudp1 ${testsdir}/espudp1.pcap ${testsdir}/espudp1.out "-nnnn -E \"file ${testsdir}/esp-secrets.txt\""
then
passed=`expr $passed + 1`
echo $passed >.passed
echo $failed >.failed
exitcode=1
fi
- if ${srcdir}/tests/TESTonce ikev2pI2 ${srcdir}/tests/ikev2pI2.pcap ${srcdir}/tests/ikev2pI2.out "-E \"file ${srcdir}/tests/ikev2pI2-secrets.txt\" -v -v -v -v"
+ if ${testsdir}/TESTonce ikev2pI2 ${testsdir}/ikev2pI2.pcap ${testsdir}/ikev2pI2.out "-E \"file ${testsdir}/ikev2pI2-secrets.txt\" -v -v -v -v"
then
passed=`expr $passed + 1`
echo $passed >.passed
echo $failed >.failed
exitcode=1
fi
- if ${srcdir}/tests/TESTonce isakmp4 ${srcdir}/tests/isakmp4500.pcap ${srcdir}/tests/isakmp4.out "-E \"${srcdir}/tests/file esp-secrets.txt\""
+ if ${testsdir}/TESTonce isakmp4 ${testsdir}/isakmp4500.pcap ${testsdir}/isakmp4.out "-E \"${testsdir}/file esp-secrets.txt\""
then
passed=`expr $passed + 1`
echo $passed >.passed
exitcode=1
fi
fi
- if ${srcdir}/tests/TESTonce bgp-as-path-oobr-ssl ${srcdir}/tests/bgp-as-path-oobr.pcap ${srcdir}/tests/bgp-as-path-oobr-ssl.out '-vvv -e'
+ if ${testsdir}/TESTonce bgp-as-path-oobr-ssl ${testsdir}/bgp-as-path-oobr.pcap ${testsdir}/bgp-as-path-oobr-ssl.out '-vvv -e'
then
passed=`expr $passed + 1`
echo $passed >.passed
echo $failed >.failed
exitcode=1
fi
- if ${srcdir}/tests/TESTonce bgp-aigp-oobr-ssl ${srcdir}/tests/bgp-aigp-oobr.pcap ${srcdir}/tests/bgp-aigp-oobr-ssl.out '-vvv -e'
+ if ${testsdir}/TESTonce bgp-aigp-oobr-ssl ${testsdir}/bgp-aigp-oobr.pcap ${testsdir}/bgp-aigp-oobr-ssl.out '-vvv -e'
then
passed=`expr $passed + 1`
echo $passed >.passed
printf "$FORMAT" isakmp4
printf "$FORMAT" bgp-as-path-oobr-ssl
printf "$FORMAT" bgp-aigp-oobr-ssl
- if ${srcdir}/tests/TESTonce bgp-as-path-oobr-nossl ${srcdir}/tests/bgp-as-path-oobr.pcap ${srcdir}/tests/bgp-as-path-oobr-nossl.out '-vvv -e'
+ if ${testsdir}/TESTonce bgp-as-path-oobr-nossl ${testsdir}/bgp-as-path-oobr.pcap ${testsdir}/bgp-as-path-oobr-nossl.out '-vvv -e'
then
passed=`expr $passed + 1`
echo $passed >.passed
echo $failed >.failed
exitcode=1
fi
- if ${srcdir}/tests/TESTonce bgp-aigp-oobr-nossl ${srcdir}/tests/bgp-aigp-oobr.pcap ${srcdir}/tests/bgp-aigp-oobr-nossl.out '-vvv -e'
+ if ${testsdir}/TESTonce bgp-aigp-oobr-nossl ${testsdir}/bgp-aigp-oobr.pcap ${testsdir}/bgp-aigp-oobr-nossl.out '-vvv -e'
then
passed=`expr $passed + 1`
echo $passed >.passed