1
TEST_FUNCTIONS_SH="INCLUDED"
3
samba3_stop_sig_term() {
5
kill -USR1 `cat $PIDDIR/timelimit.nmbd.pid` >/dev/null 2>&1 || \
6
kill -ALRM `cat $PIDDIR/timelimit.nmbd.pid` || RET=$?
8
kill -USR1 `cat $PIDDIR/timelimit.winbindd.pid` >/dev/null 2>&1 || \
9
kill -ALRM `cat $PIDDIR/timelimit.winbindd.pid` || RET=$?
11
kill -USR1 `cat $PIDDIR/timelimit.smbd.pid` >/dev/null 2>&1 || \
12
kill -ALRM `cat $PIDDIR/timelimit.smbd.pid` || RET=$?
17
samba3_stop_sig_kill() {
18
kill -ALRM `cat $PIDDIR/timelimit.nmbd.pid` >/dev/null 2>&1
19
kill -ALRM `cat $PIDDIR/timelimit.winbindd.pid` >/dev/null 2>&1
20
kill -ALRM `cat $PIDDIR/timelimit.smbd.pid` >/dev/null 2>&1
24
samba3_check_or_start() {
25
if [ -n "$SERVER_TEST_FIFO" ];then
27
trap samba3_stop_sig_kill INT QUIT
28
trap samba3_stop_sig_kill TERM
30
if [ -p "$SERVER_TEST_FIFO" ];then
34
if [ -n "$SOCKET_WRAPPER_DIR" ];then
35
if [ -d "$SOCKET_WRAPPER_DIR" ]; then
36
rm -f $SOCKET_WRAPPER_DIR/*
38
mkdir -p $SOCKET_WRAPPER_DIR
42
rm -f $SERVER_TEST_FIFO
43
mkfifo $SERVER_TEST_FIFO
46
printf "%s" "STARTING NMBD..."
48
if test x"$NMBD_MAXTIME" = x; then
51
MAKE_TEST_BINARY=$BINDIR/nmbd
52
export MAKE_TEST_BINARY
53
timelimit $NMBD_MAXTIME $NMBD_VALGRIND $BINDIR/nmbd -F -S --no-process-group -d0 -s $SERVERCONFFILE > $NMBD_TEST_LOG 2>&1 &
56
echo $TIMELIMIT_NMBD_PID > $PIDDIR/timelimit.nmbd.pid
57
wait $TIMELIMIT_NMBD_PID
59
rm -f $SERVER_TEST_FIFO
60
if [ -n "$SOCKET_WRAPPER_DIR" -a -d "$SOCKET_WRAPPER_DIR" ]; then
61
rm -f $SOCKET_WRAPPER_DIR/*
63
if [ x"$ret" = x"0" ];then
64
echo "nmbd exits with status $ret";
65
echo "nmbd exits with status $ret" >>$NMBD_TEST_LOG;
66
elif [ x"$ret" = x"137" ];then
67
echo "nmbd got SIGXCPU and exits with status $ret!"
68
echo "nmbd got SIGXCPU and exits with status $ret!">>$NMBD_TEST_LOG;
70
echo "nmbd failed with status $ret!"
71
echo "nmbd failed with status $ret!">>$NMBD_TEST_LOG;
74
) || exit $? &) 2>/dev/null || exit $?
77
rm -f $WINBINDD_TEST_LOG
78
printf "%s" "STARTING WINBINDD..."
80
if test x"$WINBINDD_MAXTIME" = x; then
83
MAKE_TEST_BINARY=$BINDIR/winbindd
84
export MAKE_TEST_BINARY
85
timelimit $WINBINDD_MAXTIME $WINBINDD_VALGRIND $BINDIR/winbindd -F -S --no-process-group -d0 -s $SERVERCONFFILE > $WINBINDD_TEST_LOG 2>&1 &
86
TIMELIMIT_WINBINDD_PID=$!
88
echo $TIMELIMIT_WINBINDD_PID > $PIDDIR/timelimit.winbindd.pid
89
wait $TIMELIMIT_WINBINDD_PID
91
rm -f $SERVER_TEST_FIFO
92
if [ -n "$SOCKET_WRAPPER_DIR" -a -d "$SOCKET_WRAPPER_DIR" ]; then
93
rm -f $SOCKET_WRAPPER_DIR/*
95
if [ x"$ret" = x"0" ];then
96
echo "winbindd exits with status $ret";
97
echo "winbindd exits with status $ret" >>$WINBINDD_TEST_LOG;
98
elif [ x"$ret" = x"137" ];then
99
echo "winbindd got SIGXCPU and exits with status $ret!"
100
echo "winbindd got SIGXCPU and exits with status $ret!">>$WINBINDD_TEST_LOG;
102
echo "winbindd failed with status $ret!"
103
echo "winbindd failed with status $ret!">>$WINBINDD_TEST_LOG;
106
) || exit $? &) 2>/dev/null || exit $?
110
printf "%s" "STARTING SMBD..."
112
if test x"$SMBD_MAXTIME" = x; then
115
MAKE_TEST_BINARY=$BINDIR/smbd
116
export MAKE_TEST_BINARY
117
timelimit $SMBD_MAXTIME $SMBD_VALGRIND $BINDIR/smbd -F -S --no-process-group -d0 -s $SERVERCONFFILE > $SMBD_TEST_LOG 2>&1 &
118
TIMELIMIT_SMBD_PID=$!
120
echo $TIMELIMIT_SMBD_PID > $PIDDIR/timelimit.smbd.pid
121
wait $TIMELIMIT_SMBD_PID
123
rm -f $SERVER_TEST_FIFO
124
if [ -n "$SOCKET_WRAPPER_DIR" -a -d "$SOCKET_WRAPPER_DIR" ]; then
125
rm -f $SOCKET_WRAPPER_DIR/*
127
if [ x"$ret" = x"0" ];then
128
echo "smbd exits with status $ret";
129
echo "smbd exits with status $ret" >>$SMBD_TEST_LOG;
130
elif [ x"$ret" = x"137" ];then
131
echo "smbd got SIGXCPU and exits with status $ret!"
132
echo "smbd got SIGXCPU and exits with status $ret!">>$SMBD_TEST_LOG;
134
echo "smbd failed with status $ret!"
135
echo "smbd failed with status $ret!">>$SMBD_TEST_LOG;
138
) || exit $? &) 2>/dev/null || exit $?
144
samba3_nmbd_test_log() {
145
if [ -n "$NMBD_TEST_LOG" ];then
146
if [ -r "$NMBD_TEST_LOG" ];then
153
samba3_winbindd_test_log() {
154
if [ -n "$WINBINDD_TEST_LOG" ];then
155
if [ -r "$WINBINDD_TEST_LOG" ];then
162
samba3_smbd_test_log() {
163
if [ -n "$SMBD_TEST_LOG" ];then
164
if [ -r "$SMBD_TEST_LOG" ];then
171
samba3_check_only() {
172
if [ -n "$SERVER_TEST_FIFO" ];then
173
if [ -p "$SERVER_TEST_FIFO" ];then
182
if [ -z "$PREFIX" ]; then
193
shname=`echo $name | \
194
sed -e 's%[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\-]%_%g'`
196
UNIQUE_PID=`/bin/sh -c 'echo $$'`
197
TEST_LOG="$PREFIX/test_log.${UNIQUE_PID}"
198
TEST_PCAP="$PREFIX/test_${shname}_${UNIQUE_PID}.pcap"
199
trap "rm -f $TEST_LOG $TEST_PCAP" EXIT
201
samba3_nmbd_test_log && if [ -z "$nmbd_log_size" ]; then
202
nmbd_log_size=`wc -l < $NMBD_TEST_LOG`;
204
samba3_winbindd_test_log && if [ -z "$winbindd_log_size" ]; then
205
winbindd_log_size=`wc -l < $WINBINDD_TEST_LOG`;
207
samba3_smbd_test_log && if [ -z "$smbd_log_size" ]; then
208
smbd_log_size=`wc -l < $SMBD_TEST_LOG`;
211
if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
212
echo "--==--==--==--==--==--==--==--==--==--==--"
213
echo "Running test $name (level 0 stdout)"
214
echo "--==--==--==--==--==--==--==--==--==--==--"
218
echo "Testing $name ($failed)"
221
samba3_check_only && SERVERS_ARE_UP="yes"
222
if [ x"$SERVERS_ARE_UP" != x"yes" ];then
223
if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
224
echo "SERVERS are down! Skipping: $cmdline"
225
echo "=========================================="
226
echo "TEST SKIPPED: $name (reason SERVERS are down)"
227
echo "=========================================="
229
echo "TEST SKIPPED: $name (reason SERVERS are down)"
234
if [ x"$MAKE_TEST_ENABLE_PCAP" = x"yes" ];then
235
SOCKET_WRAPPER_PCAP_FILE=$TEST_PCAP
236
export SOCKET_WRAPPER_PCAP_FILE
239
MAKE_TEST_BINARY=$binary
240
export MAKE_TEST_BINARY
241
( $cmdline > $TEST_LOG 2>&1 )
244
# show any additional output from smbd that has happened in this test
245
samba3_nmbd_test_log && {
246
new_log_size=`wc -l < $NMBD_TEST_LOG`;
247
test "$new_log_size" = "$nmbd_log_size" || {
249
incr_log_size=`expr $new_log_size - $nmbd_log_size`;
250
tail -$incr_log_size $NMBD_TEST_LOG;
251
nmbd_log_size=$new_log_size;
254
samba3_winbindd_test_log && {
255
new_log_size=`wc -l < $WINBINDD_TEST_LOG`;
256
test "$new_log_size" = "$winbindd_log_size" || {
257
echo "WINBINDD OUTPUT:";
258
incr_log_size=`expr $new_log_size - $winbindd_log_size`;
259
tail -$incr_log_size $WINBINDD_TEST_LOG;
260
winbindd_log_size=$new_log_size;
263
samba3_smbd_test_log && {
264
new_log_size=`wc -l < $SMBD_TEST_LOG`;
265
test "$new_log_size" = "$smbd_log_size" || {
267
incr_log_size=`expr $new_log_size - $smbd_log_size`;
268
tail -$incr_log_size $SMBD_TEST_LOG;
269
smbd_log_size=$new_log_size;
273
if [ x"$status" != x"0" ]; then
277
if [ x"$MAKE_TEST_ENABLE_PCAP" = x"yes" ];then
278
echo "TEST PCAP: $TEST_PCAP"
280
if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
281
echo "=========================================="
282
echo "TEST FAILED: $name (status $status)"
283
echo "=========================================="
285
echo "TEST FAILED: $cmdline (status $status)"
291
if [ x"$MAKE_TEST_KEEP_PCAP" = x"yes" ];then
292
echo "TEST PCAP: $TEST_PCAP"
296
if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
297
echo "ALL OK: $cmdline"
298
echo "=========================================="
299
echo "TEST PASSED: $name"
300
echo "=========================================="
310
if [ x"$failed" = x"0" ];then
313
echo "$failed TESTS FAILED or SKIPPED ($name)";
322
if [ x"$failed" = x"0" ];then
323
echo "TEST STATUS: $failed";
325
echo "TEST STATUS: $failed";
330
if [ -z "$VALGRIND" ]; then