2 samba3_stop_sig_term() {
4 kill -USR1 `cat $PIDDIR/timelimit.nmbd.pid` >/dev/null 2>&1 || \
5 kill -ALRM `cat $PIDDIR/timelimit.nmbd.pid` || RET=$?
7 kill -USR1 `cat $PIDDIR/timelimit.winbindd.pid` >/dev/null 2>&1 || \
8 kill -ALRM `cat $PIDDIR/timelimit.winbindd.pid` || RET=$?
10 kill -USR1 `cat $PIDDIR/timelimit.smbd.pid` >/dev/null 2>&1 || \
11 kill -ALRM `cat $PIDDIR/timelimit.smbd.pid` || RET=$?
16 samba3_stop_sig_kill() {
17 kill -ALRM `cat $PIDDIR/timelimit.nmbd.pid` >/dev/null 2>&1
18 kill -ALRM `cat $PIDDIR/timelimit.winbindd.pid` >/dev/null 2>&1
19 kill -ALRM `cat $PIDDIR/timelimit.smbd.pid` >/dev/null 2>&1
23 samba3_check_or_start() {
24 if [ -n "$SERVER_TEST_FIFO" ];then
26 trap samba3_stop_sig_kill INT QUIT
27 trap samba3_stop_sig_kill TERM
29 if [ -p "$SERVER_TEST_FIFO" ];then
33 if [ -n "$SOCKET_WRAPPER_DIR" ];then
34 if [ -d "$SOCKET_WRAPPER_DIR" ]; then
35 rm -f $SOCKET_WRAPPER_DIR/*
37 mkdir -p $SOCKET_WRAPPER_DIR
41 rm -f $SERVER_TEST_FIFO
42 mkfifo $SERVER_TEST_FIFO
45 printf "%s" "STARTING NMBD..."
47 if test x"$NMBD_MAXTIME" = x; then
50 MAKE_TEST_BINARY=$BINDIR/nmbd
51 export MAKE_TEST_BINARY
52 timelimit $NMBD_MAXTIME $NMBD_VALGRIND $BINDIR/nmbd -F -S --no-process-group -d0 -s $SERVERCONFFILE > $NMBD_TEST_LOG 2>&1 &
55 echo $TIMELIMIT_NMBD_PID > $PIDDIR/timelimit.nmbd.pid
56 wait $TIMELIMIT_NMBD_PID
58 rm -f $SERVER_TEST_FIFO
59 if [ -n "$SOCKET_WRAPPER_DIR" -a -d "$SOCKET_WRAPPER_DIR" ]; then
60 rm -f $SOCKET_WRAPPER_DIR/*
62 if [ x"$ret" = x"0" ];then
63 echo "nmbd exits with status $ret";
64 echo "nmbd exits with status $ret" >>$NMBD_TEST_LOG;
65 elif [ x"$ret" = x"137" ];then
66 echo "nmbd got SIGXCPU and exits with status $ret!"
67 echo "nmbd got SIGXCPU and exits with status $ret!">>$NMBD_TEST_LOG;
69 echo "nmbd failed with status $ret!"
70 echo "nmbd failed with status $ret!">>$NMBD_TEST_LOG;
73 ) || exit $? &) 2>/dev/null || exit $?
76 rm -f $WINBINDD_TEST_LOG
77 printf "%s" "STARTING WINBINDD..."
79 if test x"$WINBINDD_MAXTIME" = x; then
82 MAKE_TEST_BINARY=$BINDIR/winbindd
83 export MAKE_TEST_BINARY
84 timelimit $WINBINDD_MAXTIME $WINBINDD_VALGRIND $BINDIR/winbindd -F -S --no-process-group -d0 -s $SERVERCONFFILE > $WINBINDD_TEST_LOG 2>&1 &
85 TIMELIMIT_WINBINDD_PID=$!
87 echo $TIMELIMIT_WINBINDD_PID > $PIDDIR/timelimit.winbindd.pid
88 wait $TIMELIMIT_WINBINDD_PID
90 rm -f $SERVER_TEST_FIFO
91 if [ -n "$SOCKET_WRAPPER_DIR" -a -d "$SOCKET_WRAPPER_DIR" ]; then
92 rm -f $SOCKET_WRAPPER_DIR/*
94 if [ x"$ret" = x"0" ];then
95 echo "winbindd exits with status $ret";
96 echo "winbindd exits with status $ret" >>$WINBINDD_TEST_LOG;
97 elif [ x"$ret" = x"137" ];then
98 echo "winbindd got SIGXCPU and exits with status $ret!"
99 echo "winbindd got SIGXCPU and exits with status $ret!">>$WINBINDD_TEST_LOG;
101 echo "winbindd failed with status $ret!"
102 echo "winbindd failed with status $ret!">>$WINBINDD_TEST_LOG;
105 ) || exit $? &) 2>/dev/null || exit $?
109 printf "%s" "STARTING SMBD..."
111 if test x"$SMBD_MAXTIME" = x; then
114 MAKE_TEST_BINARY=$BINDIR/smbd
115 export MAKE_TEST_BINARY
116 timelimit $SMBD_MAXTIME $SMBD_VALGRIND $BINDIR/smbd -F -S --no-process-group -d0 -s $SERVERCONFFILE > $SMBD_TEST_LOG 2>&1 &
117 TIMELIMIT_SMBD_PID=$!
119 echo $TIMELIMIT_SMBD_PID > $PIDDIR/timelimit.smbd.pid
120 wait $TIMELIMIT_SMBD_PID
122 rm -f $SERVER_TEST_FIFO
123 if [ -n "$SOCKET_WRAPPER_DIR" -a -d "$SOCKET_WRAPPER_DIR" ]; then
124 rm -f $SOCKET_WRAPPER_DIR/*
126 if [ x"$ret" = x"0" ];then
127 echo "smbd exits with status $ret";
128 echo "smbd exits with status $ret" >>$SMBD_TEST_LOG;
129 elif [ x"$ret" = x"137" ];then
130 echo "smbd got SIGXCPU and exits with status $ret!"
131 echo "smbd got SIGXCPU and exits with status $ret!">>$SMBD_TEST_LOG;
133 echo "smbd failed with status $ret!"
134 echo "smbd failed with status $ret!">>$SMBD_TEST_LOG;
137 ) || exit $? &) 2>/dev/null || exit $?
143 samba3_nmbd_test_log() {
144 if [ -n "$NMBD_TEST_LOG" ];then
145 if [ -r "$NMBD_TEST_LOG" ];then
152 samba3_winbindd_test_log() {
153 if [ -n "$WINBINDD_TEST_LOG" ];then
154 if [ -r "$WINBINDD_TEST_LOG" ];then
161 samba3_smbd_test_log() {
162 if [ -n "$SMBD_TEST_LOG" ];then
163 if [ -r "$SMBD_TEST_LOG" ];then
170 samba3_check_only() {
171 if [ -n "$SERVER_TEST_FIFO" ];then
172 if [ -p "$SERVER_TEST_FIFO" ];then
181 if [ -z "$PREFIX" ]; then
192 shname=`echo $name | \
193 sed -e 's%[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\-]%_%g'`
195 UNIQUE_PID=`/bin/sh -c 'echo $$'`
196 TEST_LOG="$PREFIX/test_log.${UNIQUE_PID}"
197 TEST_PCAP="$PREFIX/test_${shname}_${UNIQUE_PID}.pcap"
198 trap "rm -f $TEST_LOG $TEST_PCAP" EXIT
200 if [ -z "$nmbd_log_size" ]; then
201 nmbd_log_size=`wc -l < $NMBD_TEST_LOG`;
203 if [ -z "$winbindd_log_size" ]; then
204 winbindd_log_size=`wc -l < $WINBINDD_TEST_LOG`;
206 if [ -z "$smbd_log_size" ]; then
207 smbd_log_size=`wc -l < $SMBD_TEST_LOG`;
210 if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
211 echo "--==--==--==--==--==--==--==--==--==--==--"
212 echo "Running test $name (level 0 stdout)"
213 echo "--==--==--==--==--==--==--==--==--==--==--"
217 echo "Testing $name ($failed)"
220 samba3_check_only && SERVERS_ARE_UP="yes"
221 if [ x"$SERVERS_ARE_UP" != x"yes" ];then
222 if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
223 echo "SERVERS are down! Skipping: $cmdline"
224 echo "=========================================="
225 echo "TEST SKIPPED: $name (reason SERVERS are down)"
226 echo "=========================================="
228 echo "TEST SKIPPED: $name (reason SERVERS are down)"
233 if [ x"$MAKE_TEST_ENABLE_PCAP" = x"yes" ];then
234 SOCKET_WRAPPER_PCAP_FILE=$TEST_PCAP
235 export SOCKET_WRAPPER_PCAP_FILE
238 MAKE_TEST_BINARY=$binary
239 export MAKE_TEST_BINARY
240 ( $cmdline > $TEST_LOG 2>&1 )
243 # show any additional output from smbd that has happened in this test
244 samba3_nmbd_test_log && {
245 new_log_size=`wc -l < $NMBD_TEST_LOG`;
246 test "$new_log_size" = "$nmbd_log_size" || {
248 incr_log_size=`expr $new_log_size - $nmbd_log_size`;
249 tail -$incr_log_size $NMBD_TEST_LOG;
250 nmbd_log_size=$new_log_size;
253 samba3_winbindd_test_log && {
254 new_log_size=`wc -l < $WINBINDD_TEST_LOG`;
255 test "$new_log_size" = "$winbindd_log_size" || {
256 echo "WINBINDD OUTPUT:";
257 incr_log_size=`expr $new_log_size - $winbindd_log_size`;
258 tail -$incr_log_size $WINBINDD_TEST_LOG;
259 winbindd_log_size=$new_log_size;
262 samba3_smbd_test_log && {
263 new_log_size=`wc -l < $SMBD_TEST_LOG`;
264 test "$new_log_size" = "$smbd_log_size" || {
266 incr_log_size=`expr $new_log_size - $smbd_log_size`;
267 tail -$incr_log_size $SMBD_TEST_LOG;
268 smbd_log_size=$new_log_size;
272 if [ x"$status" != x"0" ]; then
276 if [ x"$MAKE_TEST_ENABLE_PCAP" = x"yes" ];then
277 echo "TEST PCAP: $TEST_PCAP"
279 if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
280 echo "=========================================="
281 echo "TEST FAILED: $name (status $status)"
282 echo "=========================================="
284 echo "TEST FAILED: $cmdline (status $status)"
290 if [ x"$MAKE_TEST_KEEP_PCAP" = x"yes" ];then
291 echo "TEST PCAP: $TEST_PCAP"
295 if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
296 echo "ALL OK: $cmdline"
297 echo "=========================================="
298 echo "TEST PASSED: $name"
299 echo "=========================================="
309 if [ x"$failed" = x"0" ];then
312 echo "$failed TESTS FAILED or SKIPPED ($name)";
321 if [ x"$failed" = x"0" ];then
322 echo "TEST STATUS: $failed";
324 echo "TEST STATUS: $failed";
329 if [ -z "$VALGRIND" ]; then