1#!/bin/sh
2# This script generates a list of testsuites that should be run as part of 
3# the Samba 3 test suite.
4
5# The output of this script is parsed by selftest.pl, which then decides 
6# which of the tests to actually run. It will, for example, skip all tests 
7# listed in selftest/skip or only run a subset during "make quicktest".
8
9# The idea is that this script outputs all of the tests of Samba 3, not 
10# just those that are known to pass, and list those that should be skipped 
11# or are known to fail in selftest/skip or selftest/samba4-knownfail. This makes it 
12# very easy to see what functionality is still missing in Samba 3 and makes 
13# it possible to run the testsuite against other servers, such as Samba 4 or 
14# Windows that have a different set of features.
15
16# The syntax for a testsuite is "-- TEST --" on a single line, followed 
17# by the name of the test, the environment it needs and the command to run, all 
18# three separated by newlines. All other lines in the output are considered 
19# comments.
20
21if [ ! -n "$PERL" ]
22then
23	PERL=perl
24fi
25
26plantest() {
27	name=$1
28	env=$2
29	shift 2
30	cmdline="$*"
31	echo "-- TEST --"
32	if [ "$env" = "none" ]; then
33		echo "samba3.$name"
34	else
35		echo "samba3.$name ($env)"
36	fi
37	echo $env
38	echo $cmdline
39}
40
41normalize_testname() {
42	name=$1
43	shift 1
44	echo $name | tr "A-Z-" "a-z."
45}
46
47TEST_FUNCTIONS_SH="INCLUDED"
48testit() {
49	name=$1
50	shift 1
51	cmdline="$*"
52
53	plantest "`normalize_testname $testitprefix$name`" $testitenv $cmdline
54	return
55}
56
57testok() {
58	true
59	return
60}
61
62BINDIR=`dirname $0`/../bin
63export BINDIR
64
65SCRIPTDIR=`dirname $0`/../script/tests
66export SCRIPTDIR
67
68CONFIGURATION="--configfile \$SMB_CONF_PATH"
69export CONFIGURATION
70
71CONFFILE="\$SMB_CONF_PATH"
72export CONFFILE
73
74SERVER="\$SERVER"
75export SERVER
76
77USERNAME="\$USERNAME"
78export USERNAME
79
80PASSWORD="\$PASSWORD"
81export PASSWORD
82
83(
84	shift $#
85	testitprefix="local_s3."
86	testitenv="none"
87	. $SCRIPTDIR/test_local_s3.sh
88)
89
90(
91	shift $#
92	testitprefix="smbtorture_s3.plain."
93	testitenv="dc"
94	. $SCRIPTDIR/test_smbtorture_s3.sh //\$SERVER_IP/tmp \$USERNAME \$PASSWORD "" ""
95)
96
97(
98	shift $#
99	testitprefix="smbtorture_s3.crypt."
100	testitenv="dc"
101	. $SCRIPTDIR/test_smbtorture_s3.sh //\$SERVER_IP/tmp \$USERNAME \$PASSWORD "" "-e"
102)
103
104(
105	shift $#
106	testitprefix="wbinfo_s3."
107	testitenv="dc:local"
108	. $SCRIPTDIR/test_wbinfo_s3.sh \$WORKGROUP \$SERVER \$USERNAME \$PASSWORD
109)
110
111(
112	shift $#
113	testitprefix="ntlm_auth_s3."
114	testitenv="dc:local"
115	. $SCRIPTDIR/test_ntlm_auth_s3.sh
116)
117
118# plain
119plantest "blackbox.smbclient_s3.plain" dc BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$USERNAME \$PASSWORD
120plantest "blackbox.smbclient_s3.plain member creds" member BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$SERVER\\\\\$USERNAME \$PASSWORD
121plantest "blackbox.smbclient_s3.plain domain creds" member BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$DOMAIN\\\\\$DC_USERNAME \$DC_PASSWORD
122
123# sign, only the member server allows signing
124plantest "blackbox.smbclient_s3.sign member creds" member BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$SERVER\\\\\$USERNAME \$PASSWORD "--signing=required"
125plantest "blackbox.smbclient_s3.sign domain creds" member BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$DOMAIN\\\\\$DC_USERNAME \$DC_PASSWORD "--signing=required"
126
127# encrypted
128plantest "blackbox.smbclient_s3.crypt" dc BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$USERNAME \$PASSWORD "-e"
129
130# these don't work yet
131#plantest "blackbox.smbclient_s3.crypt member creds" member BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$SERVER\\\\\$USERNAME \$PASSWORD "-e"
132#plantest "blackbox.smbclient_s3.crypt domain creds" member BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$DOMAIN\\\\\$DC_USERNAME \$DC_PASSWORD "-e"
133
134plantest "blackbox.net_s3" dc:local BINDIR="$BINDIR" SCRIPTDIR="$SCRIPTDIR" SERVERCONFFILE="\$SMB_CONF_PATH" script/tests/test_net_s3.sh
135
136(
137	shift $#
138	testitprefix="posix_s3."
139	testitenv="dc:local"
140
141	SMBTORTURE4BINARY=$SMBTORTURE4
142	TORTURE4_OPTIONS=""
143	TORTURE4_OPTIONS="$TORTURE4_OPTIONS --configfile=\$SMB_CONF_PATH"
144	TORTURE4_OPTIONS="$TORTURE4_OPTIONS --maximum-runtime=$SELFTEST_MAXTIME"
145	TORTURE4_OPTIONS="$TORTURE4_OPTIONS --target=$SELFTEST_TARGET"
146	TORTURE4_OPTIONS="$TORTURE4_OPTIONS --basedir=$SELFTEST_PREFIX"
147	if [ -n "$SELFTEST_VERBOSE" ]; then
148		TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:progress=no"
149	fi
150	TORTURE_OPTIONS="$TORTURE4_OPTIONS --format=subunit"
151	if [ -n "$SELFTEST_QUICK" ]; then
152		TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:quick=yes"
153	fi
154
155	# This is an ugly hack...
156	TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:localdir=$SELFTEST_PREFIX/dc/share"
157
158	if [ -x "$SMBTORTURE4" ]; then
159		LIB_PATH_VAR_VAR="\$`echo $LIB_PATH_VAR`"
160		S4_LIB_PREFIX=`eval echo "$LIB_PATH_VAR=\"$SAMBA4SHAREDDIR:$LIB_PATH_VAR_VAR\""`
161		SMBTORTURE4="$S4_LIB_PREFIX $SMBTORTURE4"
162		SMBTORTURE4VERSION=`eval $SMBTORTURE4 --version`
163	fi
164	if [ -n "$SMBTORTURE4" -a -n "$SMBTORTURE4VERSION" ];then
165		echo "Using SMBTORTURE4: $SMBTORTURE4BINARY"
166		echo "Version: $SMBTORTURE4VERSION"
167		. $SCRIPTDIR/test_posix_s3.sh //\$SERVER_IP/tmp \$USERNAME \$PASSWORD "" ""
168	else
169		echo "Skip Tests with Samba4's smbtorture"
170		echo "Try to compile with --with-smbtorture4-path=PATH to enable"
171	fi
172
173)
174
175