From 4b35dc53fe2530fd51427fe40dfb3c1dc2c4bc9b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 5 Oct 2006 11:46:31 +0000 Subject: r19098: with 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 | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/source4/script/tests/test_functions.sh b/source4/script/tests/test_functions.sh index 29b03faf42..b68b16edc3 100755 --- a/source4/script/tests/test_functions.sh +++ b/source4/script/tests/test_functions.sh @@ -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 "==========================================" -- cgit