]> The Tcpdump Group git mirrors - tcpdump/blobdiff - tests/crypto.sh
Fix a bug in test scripts (exposed in GH #613).
[tcpdump] / tests / crypto.sh
index 3aa29caa5babf843841ea69788ce1e95fb3f9402..5e295957cb502ee70b8fb8ac3afa5c8214824115 100755 (executable)
@@ -1,12 +1,17 @@
 #!/bin/sh
 
+exitcode=0
+
 # Only attempt OpenSSL-specific tests when compiled with the library.
 
 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
        # Reading the secret(s) from a file does not work with Capsicum.
        if grep '^#define HAVE_CAPSICUM 1$' ../config.h >/dev/null
        then
@@ -18,10 +23,15 @@ then
                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
        fi
 else
        FORMAT='    %-35s: TEST SKIPPED (compiled w/o OpenSSL)\n'
@@ -34,3 +44,5 @@ else
        printf "$FORMAT" ikev2pI2
        printf "$FORMAT" isakmp4
 fi
+
+exit $exitcode