s3/selftest: add some FIXMEs
[Samba/id10ts.git] / source3 / selftest / tests.sh
blobe53981c89ede7cbf085a4a44c2225c31dbc67241
1 #!/bin/bash
2 ### ^^^FIXME -> sh ... breaks testing on *BSD etc. ... see FIXME's below
3 # This script generates a list of testsuites that should be run as part of
4 # the Samba 3 test suite.
6 # The output of this script is parsed by selftest.pl, which then decides
7 # which of the tests to actually run. It will, for example, skip all tests
8 # listed in selftest/skip or only run a subset during "make quicktest".
10 # The idea is that this script outputs all of the tests of Samba 3, not
11 # just those that are known to pass, and list those that should be skipped
12 # or are known to fail in selftest/skip or selftest/samba4-knownfail. This makes it
13 # very easy to see what functionality is still missing in Samba 3 and makes
14 # it possible to run the testsuite against other servers, such as Samba 4 or
15 # Windows that have a different set of features.
17 # The syntax for a testsuite is "-- TEST --" on a single line, followed
18 # by the name of the test, the environment it needs and the command to run, all
19 # three separated by newlines. All other lines in the output are considered
20 # comments.
22 if [ ! -n "$PERL" ]
23 then
24 PERL=perl
27 plantest() {
28 name=$1
29 env=$2
30 shift 2
31 cmdline="$*"
32 echo "-- TEST --"
33 if [ "$env" = "none" ]; then
34 fullname="samba3.$name"
35 else
36 fullname="samba3.$name ($env)"
38 echo $fullname
39 echo $env
40 echo $cmdline "2>&1" "| ../selftest/filter-subunit --prefix \"$fullname.\""
43 normalize_testname() {
44 name=$1
45 shift 1
46 n=`echo $name | tr "A-Z-" "a-z."`
47 echo "$n $@"
50 TEST_FUNCTIONS_SH="INCLUDED"
51 testit() {
52 name=$1
53 shift 1
54 cmdline="$*"
56 plantest "`normalize_testname $testitprefix$name`" $testitenv $cmdline
57 return
60 testok() {
61 true
62 return
65 BINDIR=`dirname $0`/../bin
66 export BINDIR
68 SCRIPTDIR=`dirname $0`/../script/tests
69 export SCRIPTDIR
71 CONFIGURATION="--configfile \$SMB_CONF_PATH"
72 export CONFIGURATION
74 CONFFILE="\$SMB_CONF_PATH"
75 export CONFFILE
77 SERVER="\$SERVER"
78 export SERVER
80 USERNAME="\$USERNAME"
81 export USERNAME
83 PASSWORD="\$PASSWORD"
84 export PASSWORD
86 LOCAL_PATH="\$LOCAL_PATH"
87 export LOCAL_PATH
90 shift $#
91 testitprefix="local_s3."
92 testitenv="none"
93 . $SCRIPTDIR/test_local_s3.sh
97 shift $#
98 testitprefix="smbtorture_s3.plain."
99 testitenv="dc"
100 #FIXME: shell sourcing with ARGS is just supported by bash but bash isn't everywhere.
101 . $SCRIPTDIR/test_smbtorture_s3.sh //\$SERVER_IP/tmp \$USERNAME \$PASSWORD "" "" "-l \$LOCAL_PATH"
105 shift $#
106 testitprefix="smbtorture_s3.crypt."
107 testitenv="dc"
108 #FIXME: shell sourcing with ARGS is just supported by bash but bash isn't everywhere.
109 . $SCRIPTDIR/test_smbtorture_s3.sh //\$SERVER_IP/tmp \$USERNAME \$PASSWORD "" "-e" "-l \$LOCAL_PATH"
113 shift $#
114 testitprefix="wbinfo_s3."
115 testitenv="dc:local"
116 #FIXME: shell sourcing with ARGS is just supported by bash but bash isn't everywhere.
117 . $SCRIPTDIR/test_wbinfo_s3.sh \$DOMAIN \$SERVER \$USERNAME \$PASSWORD
121 shift $#
122 testitprefix="wbinfo_s3."
123 testitenv="dc:local"
124 #FIXME: shell sourcing with ARGS is just supported by bash but bash isn't everywhere.
125 . $SCRIPTDIR/test_wbinfo_s3.sh \$DOMAIN \$SERVER \$DOMAIN\\\\\$USERNAME \$PASSWORD
129 shift $#
130 testitprefix="wbinfo_s3."
131 testitenv="member:local"
132 #FIXME: shell sourcing with ARGS is just supported by bash but bash isn't everywhere.
133 . $SCRIPTDIR/test_wbinfo_s3.sh \$DOMAIN \$SERVER \$DOMAIN\\\\\$USERNAME \$PASSWORD
137 shift $#
138 testitprefix="ntlm_auth_s3."
139 testitenv="dc:local"
140 . $SCRIPTDIR/test_ntlm_auth_s3.sh
143 # plain
144 plantest "blackbox.smbclient_s3.plain" dc BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$USERNAME \$PASSWORD \$USERID \$LOCAL_PATH
145 plantest "blackbox.smbclient_s3.plain member creds" member BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$SERVER\\\\\$USERNAME \$PASSWORD \$USERID \$LOCAL_PATH
146 #plantest "blackbox.smbclient_s3.plain domain creds" member BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$DOMAIN\\\\\$DC_USERNAME \$DC_PASSWORD \$USERID \$LOCAL_PATH
148 # sign, only the member server allows signing
149 plantest "blackbox.smbclient_s3.sign member creds" member BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$SERVER\\\\\$USERNAME \$PASSWORD \$USERID \$LOCAL_PATH "--signing=required"
150 #plantest "blackbox.smbclient_s3.sign domain creds" member BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$DOMAIN\\\\\$DC_USERNAME \$DC_PASSWORD \$USERID \$LOCAL_PATH "--signing=required"
152 # encrypted
153 plantest "blackbox.smbclient_s3.crypt" dc BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$USERNAME \$PASSWORD \$USERID \$LOCAL_PATH "-e"
155 # these don't work yet
156 #plantest "blackbox.smbclient_s3.crypt member creds" member BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$SERVER\\\\\$USERNAME \$PASSWORD "-e"
157 #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"
159 plantest "blackbox.net_s3" dc:local BINDIR="$BINDIR" SCRIPTDIR="$SCRIPTDIR" SERVERCONFFILE="\$SMB_CONF_PATH" script/tests/test_net_s3.sh
160 plantest "blackbox.testparm_s3" dc:local LOCAL_PATH="$LOCAL_PATH" BINDIR="$BINDIR" SCRIPTDIR="$SCRIPTDIR" SERVERCONFFILE="\$SMB_CONF_PATH" script/tests/test_testparm_s3.sh
163 shift $#
164 testitprefix="posix_s3."
165 testitenv="dc"
167 SMBTORTURE4BINARY=$SMBTORTURE4
168 TORTURE4_OPTIONS=""
169 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --configfile=\$SMB_CONF_PATH"
170 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --maximum-runtime=$SELFTEST_MAXTIME"
171 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --target=$SELFTEST_TARGET"
172 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --basedir=$SELFTEST_PREFIX"
173 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=\"torture:winbindd_netbios_name=\$SERVER\""
174 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=\"torture:winbindd_netbios_domain=\$DOMAIN\""
175 if [ -n "$SELFTEST_VERBOSE" ]; then
176 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:progress=no"
178 TORTURE_OPTIONS="$TORTURE4_OPTIONS --format=subunit"
179 if [ -n "$SELFTEST_QUICK" ]; then
180 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:quick=yes"
183 # This is an ugly hack...
184 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:localdir=$SELFTEST_PREFIX/dc/share"
186 if [ -x "$SMBTORTURE4" ]; then
187 LIB_PATH_VAR_VAR="\$`echo $LIB_PATH_VAR`"
188 S4_LIB_PREFIX=`eval echo "$LIB_PATH_VAR=\"$SAMBA4SHAREDDIR:$LIB_PATH_VAR_VAR\""`
189 SMBTORTURE4="$S4_LIB_PREFIX $SMBTORTURE4"
190 SMBTORTURE4VERSION=`eval $SMBTORTURE4 --version`
192 if [ -n "$SMBTORTURE4" -a -n "$SMBTORTURE4VERSION" ];then
193 echo "Using SMBTORTURE4: $SMBTORTURE4BINARY"
194 echo "Version: $SMBTORTURE4VERSION"
195 #FIXME: shell sourcing with ARGS is just supported by bash but bash isn't everywhere.
196 . $SCRIPTDIR/test_posix_s3.sh //\$SERVER_IP/tmp \$USERNAME \$PASSWORD "" ""
197 else
198 echo "Skip Tests with Samba4's smbtorture"
199 echo "Try to compile with --with-smbtorture4-path=PATH to enable"