summaryrefslogtreecommitdiff
path: root/source3/selftest/tests.sh
blob: 7603602c2f65051ea3801bce2e6515cd68217bd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#!/bin/bash
###   ^^^FIXME -> sh ... breaks testing on *BSD etc. ... see FIXME's below
# This script generates a list of testsuites that should be run as part of 
# the Samba 3 test suite.

# The output of this script is parsed by selftest.pl, which then decides 
# which of the tests to actually run. It will, for example, skip all tests 
# listed in selftest/skip or only run a subset during "make quicktest".

# The idea is that this script outputs all of the tests of Samba 3, not 
# just those that are known to pass, and list those that should be skipped 
# or are known to fail in selftest/skip or selftest/samba4-knownfail. This makes it 
# very easy to see what functionality is still missing in Samba 3 and makes 
# it possible to run the testsuite against other servers, such as Samba 4 or 
# Windows that have a different set of features.

# The syntax for a testsuite is "-- TEST --" on a single line, followed 
# by the name of the test, the environment it needs and the command to run, all 
# three separated by newlines. All other lines in the output are considered 
# comments.

if [ ! -n "$PERL" ]
then
	PERL=perl
fi

plantest() {
	name=$1
	env=$2
	shift 2
	cmdline="$*"
	echo "-- TEST --"
	if [ "$env" = "none" ]; then
		fullname="samba3.$name"
	else
		fullname="samba3.$name ($env)"
	fi
	echo $fullname
	echo $env
	echo $cmdline "2>&1" "| ../selftest/filter-subunit --prefix \"$fullname.\""
}

TEST_FUNCTIONS_SH="INCLUDED"
testit() {
	name=$1
	shift 1
	cmdline="$*"

	plantest "$testitprefix$name" $testitenv $cmdline
	return
}

testok() {
	true
	return
}

BINDIR=`dirname $0`/../bin
export BINDIR

SCRIPTDIR=`dirname $0`/../script/tests
export SCRIPTDIR

CONFIGURATION="--configfile \$SMB_CONF_PATH"
export CONFIGURATION

CONFFILE="\$SMB_CONF_PATH"
export CONFFILE

SERVER="\$SERVER"
export SERVER

USERNAME="\$USERNAME"
export USERNAME

PASSWORD="\$PASSWORD"
export PASSWORD

LOCAL_PATH="\$LOCAL_PATH"
export LOCAL_PATH

plantest "blackbox.success" dc:local LOCAL_PATH="$LOCAL_PATH" BINDIR="$BINDIR" SCRIPTDIR="$SCRIPTDIR" SERVERCONFFILE="\$SMB_CONF_PATH" script/tests/test_success.sh
plantest "blackbox.failure" dc:local LOCAL_PATH="$LOCAL_PATH" BINDIR="$BINDIR" SCRIPTDIR="$SCRIPTDIR" SERVERCONFFILE="\$SMB_CONF_PATH" script/tests/test_failure.sh

(
	shift $#
	testitprefix="local_s3."
	testitenv="none"
	. $SCRIPTDIR/test_local_s3.sh
)

(
	shift $#
	testitprefix="smbtorture_s3.plain."
	testitenv="dc"
#FIXME: shell sourcing with ARGS is just supported by bash but bash isn't everywhere.
	. $SCRIPTDIR/test_smbtorture_s3.sh //\$SERVER_IP/tmp \$USERNAME \$PASSWORD "" "" "-l \$LOCAL_PATH"
)

(
	shift $#
	testitprefix="smbtorture_s3.crypt."
	testitenv="dc"
#FIXME: shell sourcing with ARGS is just supported by bash but bash isn't everywhere.
	. $SCRIPTDIR/test_smbtorture_s3.sh //\$SERVER_IP/tmp \$USERNAME \$PASSWORD "" "-e" "-l \$LOCAL_PATH"
)

(
	shift $#
	testitprefix="wbinfo_s3."
	testitenv="dc:local"
#FIXME: shell sourcing with ARGS is just supported by bash but bash isn't everywhere.
	. $SCRIPTDIR/test_wbinfo_s3.sh \$DOMAIN \$SERVER \$USERNAME \$PASSWORD
)

(
	shift $#
	testitprefix="wbinfo_s3."
	testitenv="dc:local"
#FIXME: shell sourcing with ARGS is just supported by bash but bash isn't everywhere.
	. $SCRIPTDIR/test_wbinfo_s3.sh \$DOMAIN \$SERVER \$DOMAIN\\\\\$USERNAME \$PASSWORD
)

(
	shift $#
	testitprefix="wbinfo_s3."
	testitenv="member:local"
#FIXME: shell sourcing with ARGS is just supported by bash but bash isn't everywhere.
	. $SCRIPTDIR/test_wbinfo_s3.sh \$DOMAIN \$SERVER \$DOMAIN\\\\\$USERNAME \$PASSWORD
)

(
	shift $#
	testitprefix="ntlm_auth_s3."
	testitenv="dc:local"
	. $SCRIPTDIR/test_ntlm_auth_s3.sh
)

# plain
plantest "blackbox.smbclient_s3.plain" dc BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$USERNAME \$PASSWORD \$USERID \$LOCAL_PATH
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
#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

# sign, only the member server allows signing
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"
#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"

# encrypted
plantest "blackbox.smbclient_s3.crypt" dc BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$USERNAME \$PASSWORD \$USERID \$LOCAL_PATH "-e"

# these don't work yet
#plantest "blackbox.smbclient_s3.crypt member creds" member BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$SERVER\\\\\$USERNAME \$PASSWORD "-e"
#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"

plantest "blackbox.net.misc" dc:local BINDIR="$BINDIR" SCRIPTDIR="$SCRIPTDIR" SERVERCONFFILE="\$SMB_CONF_PATH" script/tests/test_net_misc.sh
plantest "blackbox.net.local.registry" dc:local BINDIR="$BINDIR" SCRIPTDIR="$SCRIPTDIR" SERVERCONFFILE="\$SMB_CONF_PATH" script/tests/test_net_registry.sh
plantest "blackbox.net.rpc.registry" dc BINDIR="$BINDIR" SCRIPTDIR="$SCRIPTDIR" SERVERCONFFILE="\$SMB_CONF_PATH" script/tests/test_net_registry.sh rpc
plantest "blackbox.net.local.registry.roundtrip" dc:local BINDIR="$BINDIR" SCRIPTDIR="$SCRIPTDIR" SERVERCONFFILE="\$SMB_CONF_PATH" script/tests/test_net_registry_roundtrip.sh
plantest "blackbox.testparm" dc:local LOCAL_PATH="$LOCAL_PATH" BINDIR="$BINDIR" SCRIPTDIR="$SCRIPTDIR" SERVERCONFFILE="\$SMB_CONF_PATH" script/tests/test_testparm_s3.sh

(
	shift $#
	testitprefix="posix_s3."
	testitenv="dc"

	SMBTORTURE4BINARY=$SMBTORTURE4
	TORTURE4_OPTIONS=""
	TORTURE4_OPTIONS="$TORTURE4_OPTIONS --configfile=\$SMB_CONF_PATH"
	TORTURE4_OPTIONS="$TORTURE4_OPTIONS --maximum-runtime=$SELFTEST_MAXTIME"
	TORTURE4_OPTIONS="$TORTURE4_OPTIONS --target=$SELFTEST_TARGET"
	TORTURE4_OPTIONS="$TORTURE4_OPTIONS --basedir=$SELFTEST_PREFIX"
	TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=\"torture:winbindd_netbios_name=\$SERVER\""
	TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=\"torture:winbindd_netbios_domain=\$DOMAIN\""
	if [ -n "$SELFTEST_VERBOSE" ]; then
		TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:progress=no"
	fi
	TORTURE_OPTIONS="$TORTURE4_OPTIONS --format=subunit"
	if [ -n "$SELFTEST_QUICK" ]; then
		TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:quick=yes"
	fi

	# This is an ugly hack...
	TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:localdir=$SELFTEST_PREFIX/dc/share"

	if [ -x "$SMBTORTURE4" ]; then
		LIB_PATH_VAR_VAR="\$`echo $LIB_PATH_VAR`"
		S4_LIB_PREFIX=`eval echo "$LIB_PATH_VAR=\"$SAMBA4SHAREDDIR:$LIB_PATH_VAR_VAR\""`
		SMBTORTURE4="$S4_LIB_PREFIX $SMBTORTURE4"
		SMBTORTURE4VERSION=`eval $SMBTORTURE4 --version`
	fi
	if [ -n "$SMBTORTURE4" -a -n "$SMBTORTURE4VERSION" ];then
		echo "Using SMBTORTURE4: $SMBTORTURE4BINARY"
		echo "Version: $SMBTORTURE4VERSION"
#FIXME: shell sourcing with ARGS is just supported by bash but bash isn't everywhere.
		. $SCRIPTDIR/test_posix_s3.sh //\$SERVER_IP/tmp \$USERNAME \$PASSWORD "" ""
	else
		echo "Skip Tests with Samba4's smbtorture"
		echo "Try to compile with --with-smbtorture4-path=PATH to enable"
	fi

)