r19100: merge from samba4:
authorStefan Metzmacher <metze@samba.org>
Thu, 5 Oct 2006 11:52:23 +0000 (11:52 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:15:12 +0000 (12:15 -0500)
export MAKE_TEST_ENABLE_PCAP=yes enables
SOCKET_WRAPPER_PCAP_FILE support
in make test

metze

source/script/tests/test_functions.sh

index 06c77c89d533d8d1b4e34bf2c5dfa7db134a62ec..badbdd5b8e276190276950c6f70970c544e846a8 100644 (file)
@@ -133,11 +133,18 @@ testit() {
        fi
        name=$1
        shift 1
-       SERVERS_ARE_UP="no"
-       TEST_LOG="$PREFIX/test_log.$$"
-       trap "rm -f $TEST_LOG" EXIT
        cmdline="$*"
 
+       SERVERS_ARE_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 [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
                echo "--==--==--==--==--==--==--==--==--==--==--"
                echo "Running test $name (level 0 stdout)"
@@ -160,7 +167,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=$?
        if [ x"$status" != x"0" ]; then
@@ -171,6 +183,9 @@ testit() {
                samba3_smbd_test_log && echo "SMBD OUTPUT:";
                samba3_smbd_test_log && cat $SMBD_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)"
@@ -180,7 +195,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 "=========================================="