]> The Tcpdump Group git mirrors - tcpdump/commitdiff
split off SMB test list to be selective
authorMichael Richardson <[email protected]>
Tue, 17 Sep 2019 20:27:39 +0000 (16:27 -0400)
committerFrancois-Xavier Le Bail <[email protected]>
Tue, 24 Sep 2019 12:12:09 +0000 (14:12 +0200)
tests/SMBLIST [new file with mode: 0644]
tests/TESTLIST
tests/smb.sh [new file with mode: 0644]

diff --git a/tests/SMBLIST b/tests/SMBLIST
new file mode 100644 (file)
index 0000000..1f0af7e
--- /dev/null
@@ -0,0 +1,9 @@
+smb_print_trans-oobr1  smb_print_trans-oobr1.pcapng    smb_print_trans-oobr1.out       -vv -c4
+# bad packets from Philippe Antoine
+smb_print_trans-oobr2  smb_print_trans-oobr2.pcap      smb_print_trans-oobr2.out       -vv -c1
+
+# CVE-2018-10105 bad packets from Luis Rocha
+cve-2018-10105_smbprint-readofsize1      cve-2018-10105_smbprint-readofsize1.pcap cve-2018-10105_smbprint-readofsize1.out -vvv
+cve-2018-10105_smbutil_withoutasan       cve-2018-10105_smbutil_withoutasan.pcap  cve-2018-10105_smbutil_withoutasan.out -vvv
+
+
index c7c5e20220ad16e173f08cf163337334a914fb8f..f03504878b9f906120a00860d0d79fb57fdbb561 100644 (file)
@@ -602,15 +602,11 @@ babel_update_oobr babel_update_oobr.pcap  babel_update_oobr.out   -c 52
 ospf6_print_lshdr-oobr ospf6_print_lshdr-oobr.pcapng   ospf6_print_lshdr-oobr.out      -vv -c15
 rpl-dao-oobr           rpl-dao-oobr.pcapng             rpl-dao-oobr.out                -vv -c1
 hncp_prefix-oobr       hncp_prefix-oobr.pcapng         hncp_prefix-oobr.out            -vvv
-smb_print_trans-oobr1  smb_print_trans-oobr1.pcapng    smb_print_trans-oobr1.out       -vv -c4
 
 # bad packets from Ryan Ackroyd
 ieee802.11_meshhdr-oobr        ieee802.11_meshhdr-oobr.pcap    ieee802.11_meshhdr-oobr.out     -H -c1
 dccp_options-oobr      dccp_options-oobr.pcap          dccp_options-oobr.out           -vv -c8
 
-# bad packets from Philippe Antoine
-smb_print_trans-oobr2  smb_print_trans-oobr2.pcap      smb_print_trans-oobr2.out       -vv -c1
-
 # RTP tests
 # fuzzed pcap
 rtp-seg-fault-1  rtp-seg-fault-1.pcap  rtp-seg-fault-1.out  -v -T rtp
@@ -647,7 +643,5 @@ kh-tcpdump-003          kh-tcpdump-003.pcap     kh-tcpdump-003.out
 
 # CVE-2018-10105 bad packets from Luis Rocha
 cve-2018-10105-segv-sflowprint           cve-2018-10105-segv-sflowprint.pcapng    cve-2018-10105-segv-sflowprint.out -v
-cve-2018-10105_smbprint-readofsize1      cve-2018-10105_smbprint-readofsize1.pcap cve-2018-10105_smbprint-readofsize1.out -vvv
-cve-2018-10105_smbutil_withoutasan       cve-2018-10105_smbutil_withoutasan.pcap  cve-2018-10105_smbutil_withoutasan.out -vvv
 
 
diff --git a/tests/smb.sh b/tests/smb.sh
new file mode 100644 (file)
index 0000000..e82a701
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+srcdir=${1-..}
+echo smb.sh using ${srcdir} from $(pwd)
+
+testdir=${srcdir}/tests
+
+exitcode=0
+passedfile=tests/.passed
+failedfile=tests/.failed
+passed=`cat ${passedfile}`
+failed=`cat ${failedfile}`
+
+# Only attempt OpenSSL-specific tests when compiled with the library.
+
+if grep '^#define ENABLE_SMB 1$' ${srcdir}/config.h >/dev/null
+then
+    cat ${srcdir}/tests/SMBLIST | while read name input output options
+    do
+        case $name in
+            \#*) continue;;
+            '') continue;;
+        esac
+        rm -f core
+        [ "$only" != "" -a "$name" != "$only" ] && continue
+        SRCDIR=${srcdir}
+        export 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"
+         then
+             passed=`expr $passed + 1`
+             echo $passed >${passedfile}
+         else
+             failed=`expr $failed + 1`
+             echo $failed >${failedfile}
+         fi
+         if [ -d COREFILES ]; then
+             if [ -f core ]; then mv core COREFILES/$name.core; fi
+         fi)
+    done
+    # I hate shells with their stupid, useless subshells.
+    passed=`cat ${passedfile}`
+    failed=`cat ${failedfile}`
+fi
+
+exit $exitcode