]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Count the complex tests correctly, and pick up the counts correctly.
authorGuy Harris <[email protected]>
Thu, 31 Aug 2017 04:36:24 +0000 (21:36 -0700)
committerGuy Harris <[email protected]>
Thu, 31 Aug 2017 04:36:24 +0000 (21:36 -0700)
tests/TESTrun.sh
tests/crypto.sh
tests/isis-seg-fault-1-v.sh
tests/lmp-v.sh
tests/nflog-e.sh

index 68af391217f84b09ac3762f982cf0c783a8438b6..6449082448d17988ccef57c597030ba27101f00c 100755 (executable)
@@ -11,22 +11,15 @@ runComplexTests()
   for i in *.sh
   do
     case $i in TEST*.sh) continue;; esac
-    if sh ./$i
-    then
-      passed=`expr $passed + 1`
-      echo $passed >.passed
-    else
-      failed=`expr $failed + 1`
-      echo $failed >.failed
-    fi
+    sh ./$i
   done
 }
 
 runSimpleTests()
 {
+  passed=`cat .passed`
+  failed=`cat .failed`
   only=$1
-  echo $passed >.passed
-  echo $failed >.failed
   cat TESTLIST | while read name input output options
   do
     case $name in
@@ -50,6 +43,8 @@ runSimpleTests()
   failed=`cat .failed`
 }
 
+echo $passed >.passed
+echo $failed >.failed
 if [ $# -eq 0 ]
 then
   runComplexTests
index 5e295957cb502ee70b8fb8ac3afa5c8214824115..dd852bab5547f2f12d4f158851fa8d7455bde3ca 100755 (executable)
@@ -6,12 +6,35 @@ exitcode=0
 
 if grep '^#define HAVE_LIBCRYPTO 1$' ../config.h >/dev/null
 then
-       ./TESTonce esp1 02-sunrise-sunset-esp.pcap esp1.out '-E "[email protected] 3des-cbc-hmac96:0x4043434545464649494a4a4c4c4f4f515152525454575758"'
-       [ $? -eq 0 ] || exitcode=1
-       ./TESTonce esp2 08-sunrise-sunset-esp2.pcap esp2.out '-E "[email protected] 3des-cbc-hmac96:0x43434545464649494a4a4c4c4f4f51515252545457575840,[email protected] 3des-cbc-hmac96:0x434545464649494a4a4c4c4f4f5151525254545757584043"'
-       [ $? -eq 0 ] || exitcode=1
-       ./TESTonce esp3 02-sunrise-sunset-esp.pcap esp1.out '-E "3des-cbc-hmac96:0x4043434545464649494a4a4c4c4f4f515152525454575758"'
-       [ $? -eq 0 ] || exitcode=1
+       passed=`cat .passed`
+       failed=`cat .failed`
+       if ./TESTonce esp1 02-sunrise-sunset-esp.pcap esp1.out '-E "[email protected] 3des-cbc-hmac96:0x4043434545464649494a4a4c4c4f4f515152525454575758"'
+       then
+               passed=`expr $passed + 1`
+               echo $passed >.passed
+       else
+               failed=`expr $failed + 1`
+               echo $failed >.failed
+               exitcode=1
+       fi
+       if ./TESTonce esp2 08-sunrise-sunset-esp2.pcap esp2.out '-E "[email protected] 3des-cbc-hmac96:0x43434545464649494a4a4c4c4f4f51515252545457575840,[email protected] 3des-cbc-hmac96:0x434545464649494a4a4c4c4f4f5151525254545757584043"'
+       then
+               passed=`expr $passed + 1`
+               echo $passed >.passed
+       else
+               failed=`expr $failed + 1`
+               echo $failed >.failed
+               exitcode=1
+       fi
+       if ./TESTonce esp3 02-sunrise-sunset-esp.pcap esp1.out '-E "3des-cbc-hmac96:0x4043434545464649494a4a4c4c4f4f515152525454575758"'
+       then
+               passed=`expr $passed + 1`
+               echo $passed >.passed
+       else
+               failed=`expr $failed + 1`
+               echo $failed >.failed
+               exitcode=1
+       fi
        # Reading the secret(s) from a file does not work with Capsicum.
        if grep '^#define HAVE_CAPSICUM 1$' ../config.h >/dev/null
        then
@@ -22,16 +45,51 @@ then
                printf "$FORMAT" ikev2pI2
                printf "$FORMAT" isakmp4
        else
-               ./TESTonce esp4 08-sunrise-sunset-esp2.pcap esp2.out '-E "file esp-secrets.txt"'
-               [ $? -eq 0 ] || exitcode=1
-               ./TESTonce esp5 08-sunrise-sunset-aes.pcap esp5.out '-E "file esp-secrets.txt"'
-               [ $? -eq 0 ] || exitcode=1
-               ./TESTonce espudp1 espudp1.pcap espudp1.out '-nnnn -E "file esp-secrets.txt"'
-               [ $? -eq 0 ] || exitcode=1
-               ./TESTonce ikev2pI2 ikev2pI2.pcap ikev2pI2.out '-E "file ikev2pI2-secrets.txt" -v -v -v -v'
-               [ $? -eq 0 ] || exitcode=1
-               ./TESTonce isakmp4 isakmp4500.pcap isakmp4.out '-E "file esp-secrets.txt"'
-               [ $? -eq 0 ] || exitcode=1
+               if ./TESTonce esp4 08-sunrise-sunset-esp2.pcap esp2.out '-E "file esp-secrets.txt"'
+               then
+                       passed=`expr $passed + 1`
+                       echo $passed >.passed
+               else
+                       failed=`expr $failed + 1`
+                       echo $failed >.failed
+                       exitcode=1
+               fi
+               if ./TESTonce esp5 08-sunrise-sunset-aes.pcap esp5.out '-E "file esp-secrets.txt"'
+               then
+                       passed=`expr $passed + 1`
+                       echo $passed >.passed
+               else
+                       failed=`expr $failed + 1`
+                       echo $failed >.failed
+                       exitcode=1
+               fi
+               if ./TESTonce espudp1 espudp1.pcap espudp1.out '-nnnn -E "file esp-secrets.txt"'
+               then
+                       passed=`expr $passed + 1`
+                       echo $passed >.passed
+               else
+                       failed=`expr $failed + 1`
+                       echo $failed >.failed
+                       exitcode=1
+               fi
+               if ./TESTonce ikev2pI2 ikev2pI2.pcap ikev2pI2.out '-E "file ikev2pI2-secrets.txt" -v -v -v -v'
+               then
+                       passed=`expr $passed + 1`
+                       echo $passed >.passed
+               else
+                       failed=`expr $failed + 1`
+                       echo $failed >.failed
+                       exitcode=1
+               fi
+               if ./TESTonce isakmp4 isakmp4500.pcap isakmp4.out '-E "file esp-secrets.txt"'
+               then
+                       passed=`expr $passed + 1`
+                       echo $passed >.passed
+               else
+                       failed=`expr $failed + 1`
+                       echo $failed >.failed
+                       exitcode=1
+               fi
        fi
 else
        FORMAT='    %-35s: TEST SKIPPED (compiled w/o OpenSSL)\n'
index 57965e8e87520dcaa18e7a3a52044442c15f5eed..d19b4a87e694bece27161d7bc120b5601756eabd 100755 (executable)
@@ -12,8 +12,17 @@ then
        printf '    %-35s: TEST SKIPPED (no Makefile)\n' $test_name
 elif grep '^CC = .*gcc' ../Makefile >/dev/null
 then
-       ./TESTonce $test_name isis-seg-fault-1.pcap isis-seg-fault-1-v.out '-v'
-       [ $? -eq 0 ] || exitcode=1
+       passed=`cat .passed`
+       failed=`cat .failed`
+       if ./TESTonce $test_name isis-seg-fault-1.pcap isis-seg-fault-1-v.out '-v'
+       then
+               passed=`expr $passed + 1`
+               echo $passed >.passed
+       else
+               failed=`expr $failed + 1`
+               echo $failed >.failed
+               exitcode=1
+       fi
 else
        printf '    %-35s: TEST SKIPPED (compiler is not GCC)\n' $test_name
 fi
index 2d0188642910c617f912069622cbb46a19327227..a8c6740e500f2d0cc6c0447f01a56fa77fa27de2 100755 (executable)
@@ -15,8 +15,17 @@ then
        printf '    %-35s: TEST SKIPPED (no Makefile)\n' 'lmp-v'
 elif grep '^CC = .*gcc' ../Makefile >/dev/null
 then
-       ./TESTonce lmp-v lmp.pcap lmp-v.out '-T lmp -v'
-       [ $? -eq 0 ] || exitcode=1
+       passed=`cat .passed`
+       failed=`cat .failed`
+       if ./TESTonce lmp-v lmp.pcap lmp-v.out '-T lmp -v'
+       then
+               passed=`expr $passed + 1`
+               echo $passed >.passed
+       else
+               failed=`expr $failed + 1`
+               echo $failed >.failed
+               exitcode=1
+       fi
 else
        printf '    %-35s: TEST SKIPPED (compiler is not GCC)\n' 'lmp-v'
 fi
index 5b002bf1484bed624a9fd7821e99704c2d7db5d0..5b5b66cefdfc3c6ea9172e54cd315e2389c384de 100755 (executable)
@@ -6,8 +6,17 @@ exitcode=0
 
 if grep '^#define HAVE_PCAP_NFLOG_H 1$' ../config.h >/dev/null
 then
-       ./TESTonce nflog-e nflog.pcap nflog-e.out '-e'
-       [ $? -eq 0 ] || exitcode=1
+       passed=`cat .passed`
+       failed=`cat .failed`
+       if ./TESTonce nflog-e nflog.pcap nflog-e.out '-e'
+       then
+               passed=`expr $passed + 1`
+               echo $passed >.passed
+       else
+               failed=`expr $failed + 1`
+               echo $failed >.failed
+               exitcode=1
+       fi
 else
        printf '    %-35s: TEST SKIPPED (compiled w/o NFLOG)\n' 'nflog-e'
 fi