summaryrefslogtreecommitdiff
path: root/source3/script/tests/test_testparm_s3.sh
blob: f1316e922c2eb61a3ecd759b40b1517eb399a4ee (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
#!/bin/sh

# Tests for lp_load() via testparm.
#
# The main purpose (for now) is to test all the special handlers
# and the macro expansions.

TEMP_CONFFILE=${LIBDIR}/smb.conf.tmp
TESTPARM="$VALGRIND ${TESTPARM:-$BINDIR/testparm} --suppress-prompt"

incdir=`dirname $0`
. $incdir/test_functions.sh

failed=0

test_include_expand_macro()
{
	MACRO=$1
	rm -f ${TEMP_CONFFILE}
	cat >${TEMP_CONFFILE}<<EOF
[global]
	include = ${TEMP_CONFFILE}.%${MACRO}
EOF
	${TESTPARM} ${TEMP_CONFFILE}
}

test_one_global_option()
{
	OPTION=$1
	rm -f ${TEMP_CONFFILE}
	cat > ${TEMP_CONFFILE}<<EOF
[global]
	${OPTION}
EOF
	${TESTPARM} ${TEMP_CONFFILE}
}

test_copy()
{
	rm -f ${TEMP_CONFFILE}
	cat > ${TEMP_CONFFILE}<<EOF
[share1]
	path = /tmp
	read only = no

[share2]
	copy = share1
EOF
	${TESTPARM} ${TEMP_CONFFILE}
}


testit "netbios name" \
	test_one_global_option "netbios name = funky" || \
	failed=`expr ${failed} + 1`

testit "netbios aliases" \
	test_one_global_option "netbios aliases = funky1 funky2 funky3" || \
	failed=`expr ${failed} + 1`

testit "netbios scope" \
	test_one_global_option "netbios scope = abc" || \
	failed=`expr ${failed} + 1`

testit "workgroup" \
	test_one_global_option "workgroup = samba" || \
	failed=`expr ${failed} + 1`

testit "display charset" \
	test_one_global_option "display charset = UTF8" || \
	failed=`expr ${failed} + 1`

testit "ldap debug level" \
	test_one_global_option "ldap debug level = 7" || \
	failed=`expr ${failed} + 1`

for LETTER in U G D I i L N M R T a d h m v w V ; do
testit "include with %${LETTER} macro expansion" \
	test_include_expand_macro "${LETTER}" || \
	failed=`expr ${failed} + 1`
done

testit "copy" \
	test_copy || \
	failed=`expr ${failed} + 1`

rm -f ${TEMP_CONFFILE}

testok $0 ${failed}