summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in2
-rwxr-xr-xtests/TESTrun.sh33
-rwxr-xr-xtests/crypto.sh29
-rwxr-xr-xtests/isis-seg-fault-1-v.sh7
-rwxr-xr-xtests/lmp-v.sh7
5 files changed, 46 insertions, 32 deletions
diff --git a/Makefile.in b/Makefile.in
index adbaa03e..a7aa1764 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -443,7 +443,7 @@ distclean:
rm -rf autom4te.cache tests/DIFF tests/NEW
check: tcpdump
- export SRCDIR=`cd ${srcdir}; pwd` && $${SRCDIR}/tests/TESTrun.sh
+ $(srcdir)/tests/TESTrun.sh
extags: $(TAGFILES)
ctags $(TAGFILES)
diff --git a/tests/TESTrun.sh b/tests/TESTrun.sh
index eb145666..cf28fd4d 100755
--- a/tests/TESTrun.sh
+++ b/tests/TESTrun.sh
@@ -1,17 +1,23 @@
#!/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
@@ -22,11 +28,11 @@ cat /dev/null > ${failureoutput}
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})
@@ -38,7 +44,7 @@ runComplexTests()
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;;
@@ -46,12 +52,11 @@ runSimpleTests()
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}
diff --git a/tests/crypto.sh b/tests/crypto.sh
index 7be49a93..a32f5b87 100755
--- a/tests/crypto.sh
+++ b/tests/crypto.sh
@@ -1,6 +1,9 @@
#!/bin/sh
-srcdir=${SRCDIR-.}
+#
+# Get the tests directory from $0.
+#
+testsdir=`dirname "$0"`
exitcode=0
passed=`cat .passed`
@@ -10,7 +13,7 @@ failed=`cat .failed`
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 "0x12345678@192.1.2.45 3des-cbc-hmac96:0x4043434545464649494a4a4c4c4f4f515152525454575758"'
+ if ${testsdir}/TESTonce esp1 ${testsdir}/02-sunrise-sunset-esp.pcap ${testsdir}/esp1.out '-E "0x12345678@192.1.2.45 3des-cbc-hmac96:0x4043434545464649494a4a4c4c4f4f515152525454575758"'
then
passed=`expr $passed + 1`
echo $passed >.passed
@@ -19,7 +22,7 @@ then
echo $failed >.failed
exitcode=1
fi
- if ${srcdir}/tests/TESTonce esp2 ${srcdir}/tests/08-sunrise-sunset-esp2.pcap ${srcdir}/tests/esp2.out '-E "0x12345678@192.1.2.45 3des-cbc-hmac96:0x43434545464649494a4a4c4c4f4f51515252545457575840,0xabcdabcd@192.0.1.1 3des-cbc-hmac96:0x434545464649494a4a4c4c4f4f5151525254545757584043"'
+ if ${testsdir}/TESTonce esp2 ${testsdir}/08-sunrise-sunset-esp2.pcap ${testsdir}/esp2.out '-E "0x12345678@192.1.2.45 3des-cbc-hmac96:0x43434545464649494a4a4c4c4f4f51515252545457575840,0xabcdabcd@192.0.1.1 3des-cbc-hmac96:0x434545464649494a4a4c4c4f4f5151525254545757584043"'
then
passed=`expr $passed + 1`
echo $passed >.passed
@@ -28,7 +31,7 @@ then
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
@@ -47,7 +50,7 @@ then
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
@@ -56,7 +59,7 @@ then
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
@@ -65,7 +68,7 @@ then
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
@@ -74,7 +77,7 @@ then
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
@@ -83,7 +86,7 @@ then
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
@@ -93,7 +96,7 @@ then
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
@@ -102,7 +105,7 @@ then
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
@@ -126,7 +129,7 @@ else
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
@@ -135,7 +138,7 @@ else
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
diff --git a/tests/isis-seg-fault-1-v.sh b/tests/isis-seg-fault-1-v.sh
index 31200fa8..da544064 100755
--- a/tests/isis-seg-fault-1-v.sh
+++ b/tests/isis-seg-fault-1-v.sh
@@ -4,7 +4,10 @@
# may produce a slightly different result if the compiler is not GCC.
# Test only with GCC (similar to GitHub issue #333).
-srcdir=${SRCDIR-.}
+#
+# Get the tests directory from $0.
+#
+testsdir=`dirname "$0"`
exitcode=0
test_name=isis-seg-fault-1-v
@@ -16,7 +19,7 @@ elif grep '^CC = .*gcc' ../Makefile >/dev/null
then
passed=`cat .passed`
failed=`cat .failed`
- if ${srcdir}/tests/TESTonce $test_name ${srcdir}/tests/isis-seg-fault-1.pcapng ${srcdir}/tests/isis-seg-fault-1-v.out '-v'
+ if ${testsdir}/TESTonce $test_name ${testsdir}/isis-seg-fault-1.pcapng ${testsdir}/isis-seg-fault-1-v.out '-v'
then
passed=`expr $passed + 1`
echo $passed >.passed
diff --git a/tests/lmp-v.sh b/tests/lmp-v.sh
index b8058811..1fc1f05c 100755
--- a/tests/lmp-v.sh
+++ b/tests/lmp-v.sh
@@ -6,7 +6,10 @@
# GCC build and must reproduce correctly on any other GCC build regardless of
# the architecture.
-srcdir=${SRCDIR-.}
+#
+# Get the tests directory from $0.
+#
+testsdir=`dirname "$0"`
exitcode=0
@@ -19,7 +22,7 @@ elif grep '^CC = .*gcc' ../Makefile >/dev/null
then
passed=`cat .passed`
failed=`cat .failed`
- if ${srcdir}/tests/TESTonce lmp-v ${srcdir}/tests/lmp.pcap ${srcdir}/tests/lmp-v.out '-T lmp -v'
+ if ${testsdir}/TESTonce lmp-v ${testsdir}/lmp.pcap ${testsdir}/lmp-v.out '-T lmp -v'
then
passed=`expr $passed + 1`
echo $passed >.passed