From: Guy Harris Date: Mon, 19 Aug 2019 00:11:28 +0000 (-0700) Subject: Clean up "make check". X-Git-Tag: tcpdump-4.99-bp~681 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/5edd532e932d97e6c37ffca90b59f7d3cee1b1e0 Clean up "make check". No need to make a "tests" directory under the build directory any more, so don't do so. As we're not cd'ing in the command line run from the Makefile (just in a command run for command substitution), there's no need to put it in a parenthesized subshell. Again, as we're not cd'ing to the tests directory, if SRCDIR isn't set, assume the source directory is the current directory. In the shell scripts we're running, look for TESTonce, the input files, the output files, and the -E input files from ${srcdir}/tests. Make sure we set srcdir in those shell scripts. --- diff --git a/Makefile.in b/Makefile.in index 6f4c166f..adbaa03e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -443,7 +443,7 @@ distclean: rm -rf autom4te.cache tests/DIFF tests/NEW check: tcpdump - (mkdir -p tests && export SRCDIR=`cd ${srcdir}; pwd` && $${SRCDIR}/tests/TESTrun.sh ) + export SRCDIR=`cd ${srcdir}; pwd` && $${SRCDIR}/tests/TESTrun.sh extags: $(TAGFILES) ctags $(TAGFILES) diff --git a/tests/TESTrun.sh b/tests/TESTrun.sh index 0b5ee4b2..eb145666 100755 --- a/tests/TESTrun.sh +++ b/tests/TESTrun.sh @@ -1,12 +1,12 @@ #!/bin/sh TZ=GMT0; export TZ -srcdir=${SRCDIR-..} +srcdir=${SRCDIR-.} echo RUNNING from ${srcdir} # make it absolute -srcdir=$(cd $srcdir && pwd) +srcdir=`cd $srcdir; pwd` # this should be run from the compiled build directory, # with srcdir= set to wherever the source code is. diff --git a/tests/crypto.sh b/tests/crypto.sh index b4277e4f..66d0be29 100755 --- a/tests/crypto.sh +++ b/tests/crypto.sh @@ -1,5 +1,7 @@ #!/bin/sh +srcdir=${SRCDIR-.} + exitcode=0 passed=`cat .passed` failed=`cat .failed` @@ -8,7 +10,7 @@ failed=`cat .failed` if grep '^#define HAVE_LIBCRYPTO 1$' ../config.h >/dev/null then - if ./TESTonce esp1 02-sunrise-sunset-esp.pcap esp1.out '-E "0x12345678@192.1.2.45 3des-cbc-hmac96:0x4043434545464649494a4a4c4c4f4f515152525454575758"' + 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"' then passed=`expr $passed + 1` echo $passed >.passed @@ -17,7 +19,7 @@ then echo $failed >.failed exitcode=1 fi - if ./TESTonce esp2 08-sunrise-sunset-esp2.pcap esp2.out '-E "0x12345678@192.1.2.45 3des-cbc-hmac96:0x43434545464649494a4a4c4c4f4f51515252545457575840,0xabcdabcd@192.0.1.1 3des-cbc-hmac96:0x434545464649494a4a4c4c4f4f5151525254545757584043"' + 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"' then passed=`expr $passed + 1` echo $passed >.passed @@ -26,7 +28,7 @@ then echo $failed >.failed exitcode=1 fi - if ./TESTonce esp3 02-sunrise-sunset-esp.pcap esp1.out '-E "3des-cbc-hmac96:0x4043434545464649494a4a4c4c4f4f515152525454575758"' + if ${srcdir}/tests/TESTonce esp3 ${srcdir}/tests/02-sunrise-sunset-esp.pcap ${srcdir}/tests/esp1.out '-E "3des-cbc-hmac96:0x4043434545464649494a4a4c4c4f4f515152525454575758"' then passed=`expr $passed + 1` echo $passed >.passed @@ -45,7 +47,7 @@ then printf "$FORMAT" ikev2pI2 printf "$FORMAT" isakmp4 else - if ./TESTonce esp4 08-sunrise-sunset-esp2.pcap esp2.out '-E "file esp-secrets.txt"' + if ${srcdir}/tests/TESTonce esp4 ${srcdir}/tests/08-sunrise-sunset-esp2.pcap ${srcdir}/tests/esp2.out "-E \"file ${srcdir}/tests/esp-secrets.txt\"" then passed=`expr $passed + 1` echo $passed >.passed @@ -54,7 +56,7 @@ then echo $failed >.failed exitcode=1 fi - if ./TESTonce esp5 08-sunrise-sunset-aes.pcap esp5.out '-E "file esp-secrets.txt"' + if ${srcdir}/tests/TESTonce esp5 ${srcdir}/tests/08-sunrise-sunset-aes.pcap ${srcdir}/tests/esp5.out "-E \"file ${srcdir}/tests/esp-secrets.txt\"" then passed=`expr $passed + 1` echo $passed >.passed @@ -63,7 +65,7 @@ then echo $failed >.failed exitcode=1 fi - if ./TESTonce espudp1 espudp1.pcap espudp1.out '-nnnn -E "file esp-secrets.txt"' + if ${srcdir}/tests/TESTonce espudp1 ${srcdir}/tests/espudp1.pcap ${srcdir}/tests/espudp1.out "-nnnn -E "\file ${srcdir}/tests/esp-secrets.txt\"" then passed=`expr $passed + 1` echo $passed >.passed @@ -72,7 +74,7 @@ then echo $failed >.failed exitcode=1 fi - if ./TESTonce ikev2pI2 ikev2pI2.pcap ikev2pI2.out '-E "file ikev2pI2-secrets.txt" -v -v -v -v' + if ${srcdir}/tests/TESTonce ikev2pI2 ${srcdir}/tests/ikev2pI2.pcap ${srcdir}/tests/ikev2pI2.out "-E \"file ${srcdir}/tests/ikev2pI2-secrets.txt\" -v -v -v -v" then passed=`expr $passed + 1` echo $passed >.passed @@ -81,7 +83,7 @@ then echo $failed >.failed exitcode=1 fi - if ./TESTonce isakmp4 isakmp4500.pcap isakmp4.out '-E "file esp-secrets.txt"' + if ${srcdir}/tests/TESTonce isakmp4 ${srcdir}/tests/isakmp4500.pcap ${srcdir}/tests/isakmp4.out "-E \"${srcdir}/tests/file esp-secrets.txt\"" then passed=`expr $passed + 1` echo $passed >.passed @@ -91,7 +93,7 @@ then exitcode=1 fi fi - if ./TESTonce bgp-as-path-oobr-ssl bgp-as-path-oobr.pcap bgp-as-path-oobr-ssl.out '-vvv -e' + 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' then passed=`expr $passed + 1` echo $passed >.passed @@ -100,7 +102,7 @@ then echo $failed >.failed exitcode=1 fi - if ./TESTonce bgp-aigp-oobr-ssl bgp-aigp-oobr.pcap bgp-aigp-oobr-ssl.out '-vvv -e' + if ${srcdir}/tests/TESTonce bgp-aigp-oobr-ssl ${srcdir}/tests/bgp-aigp-oobr.pcap ${srcdir}/tests/bgp-aigp-oobr-ssl.out '-vvv -e' then passed=`expr $passed + 1` echo $passed >.passed @@ -124,7 +126,7 @@ else printf "$FORMAT" isakmp4 printf "$FORMAT" bgp-as-path-oobr-ssl printf "$FORMAT" bgp-aigp-oobr-ssl - if ./TESTonce bgp-as-path-oobr-nossl bgp-as-path-oobr.pcap bgp-as-path-oobr-nossl.out '-vvv -e' + 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' then passed=`expr $passed + 1` echo $passed >.passed @@ -133,7 +135,7 @@ else echo $failed >.failed exitcode=1 fi - if ./TESTonce bgp-aigp-oobr-nossl bgp-aigp-oobr.pcap bgp-aigp-oobr-nossl.out '-vvv -e' + if ${srcdir}/tests/TESTonce bgp-aigp-oobr-nossl ${srcdir}/tests/bgp-aigp-oobr.pcap ${srcdir}/tests/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 caae98dc..31200fa8 100755 --- a/tests/isis-seg-fault-1-v.sh +++ b/tests/isis-seg-fault-1-v.sh @@ -4,6 +4,8 @@ # may produce a slightly different result if the compiler is not GCC. # Test only with GCC (similar to GitHub issue #333). +srcdir=${SRCDIR-.} + exitcode=0 test_name=isis-seg-fault-1-v @@ -14,7 +16,7 @@ elif grep '^CC = .*gcc' ../Makefile >/dev/null then passed=`cat .passed` failed=`cat .failed` - if ./TESTonce $test_name isis-seg-fault-1.pcapng isis-seg-fault-1-v.out '-v' + if ${srcdir}/tests/TESTonce $test_name ${srcdir}/tests/isis-seg-fault-1.pcapng ${srcdir}/tests/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 a8c6740e..b8058811 100755 --- a/tests/lmp-v.sh +++ b/tests/lmp-v.sh @@ -6,6 +6,8 @@ # GCC build and must reproduce correctly on any other GCC build regardless of # the architecture. +srcdir=${SRCDIR-.} + exitcode=0 # A Windows build may have no file named Makefile and also a version of grep @@ -17,7 +19,7 @@ elif grep '^CC = .*gcc' ../Makefile >/dev/null then passed=`cat .passed` failed=`cat .failed` - if ./TESTonce lmp-v lmp.pcap lmp-v.out '-T lmp -v' + if ${srcdir}/tests/TESTonce lmp-v ${srcdir}/tests/lmp.pcap ${srcdir}/tests/lmp-v.out '-T lmp -v' then passed=`expr $passed + 1` echo $passed >.passed