r19098: with
authorStefan Metzmacher <metze@samba.org>
Thu, 5 Oct 2006 11:46:31 +0000 (11:46 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:20:35 +0000 (14:20 -0500)
export MAKE_TEST_ENABLE_PCAP=yes

make test will use SOCKET_WRAPPER_PCAP_FILE support
and will run each test with a different file

the capture will be removed unless the test fails.

the TEST PCAP: line will show the location of the file

metze
(This used to be commit 5095783cdf01db9d28392ba0d88186c1a4df654b)

source4/script/tests/test_functions.sh

index 29b03faf4253734cba66dec6d2d0be27d59cafda..b68b16edc39fa07e47db98405da9f31c9924e776 100755 (executable)
@@ -84,11 +84,18 @@ testit() {
        fi
        name=$1
        shift 1
-       SMBD_IS_UP="no"
-       TEST_LOG="$PREFIX/test_log.$$"
-       trap "rm -f $TEST_LOG" EXIT
        cmdline="$*"
 
+       SMBD_IS_UP="no"
+
+       shname=`echo $name | \
+       sed -e 's%[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\-]%_%g'`
+
+       UNIQUE_PID=`/bin/sh -c 'echo $$'`
+       TEST_LOG="$PREFIX/test_log.${UNIQUE_PID}"
+       TEST_PCAP="$PREFIX/test_${shname}_${UNIQUE_PID}.pcap"
+       trap "rm -f $TEST_LOG $TEST_PCAP" EXIT
+
         if [ -z "$smbd_log_size" ]; then
            smbd_log_size=`wc -l < $SMBD_TEST_LOG`;
        fi
@@ -120,7 +127,12 @@ testit() {
                fi
                return 1
        fi
-       
+
+       if [ x"$MAKE_TEST_ENABLE_PCAP" = x"yes" ];then
+               SOCKET_WRAPPER_PCAP_FILE=$TEST_PCAP
+               export SOCKET_WRAPPER_PCAP_FILE
+       fi
+
        ( $cmdline > $TEST_LOG 2>&1 )
        status=$?
        # show any additional output from smbd that has happened in this test
@@ -137,6 +149,9 @@ testit() {
                echo "TEST OUTPUT:"
                cat $TEST_LOG;
                rm -f $TEST_LOG;
+               if [ x"$MAKE_TEST_ENABLE_PCAP" = x"yes" ];then
+                       echo "TEST PCAP: $TEST_PCAP"
+               fi
                if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
                        echo "=========================================="
                        echo "TEST FAILED: $name (status $status)"
@@ -146,7 +161,7 @@ testit() {
                fi
                return 1;
        fi
-       rm -f $TEST_LOG;
+       rm -f $TEST_LOG $TEST_PCAP;
        if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
                echo "ALL OK: $cmdline"
                echo "=========================================="