summaryrefslogtreecommitdiffstats
path: root/source/script
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-06-19 17:14:39 +0200
committerMichael Adam <obnox@samba.org>2008-06-19 17:22:27 +0200
commiteb28146d40b8a8bc2c20b8d222abf191ea178d5a (patch)
tree3e200d48b384a0639ccf7c90a2aa4338b6d1e737 /source/script
parent73c17b630317b5019e5d5f2b989b8de081a73e07 (diff)
downloadsamba-eb28146d40b8a8bc2c20b8d222abf191ea178d5a.tar.gz
samba-eb28146d40b8a8bc2c20b8d222abf191ea178d5a.tar.xz
samba-eb28146d40b8a8bc2c20b8d222abf191ea178d5a.zip
testsuite: add a testparm_s3 test script.
This is a first testparm/lp_load test that runs testparm on a couple of configuration files. The main purpose for now is to test the options that have special handlers (to check whether the handlers succeed). In particular, all the Macro expansions that are available via alloc_sub_basic() are tested with the include handler. This is to catch such crashbugs as #5548 where %m expansion led to a segfault. The tests now are very simple. Just check if testparm completes successfully on the given config files. This can (and should) be elaborated in the future. Michael
Diffstat (limited to 'source/script')
-rwxr-xr-xsource/script/tests/test_testparm_s3.sh90
1 files changed, 90 insertions, 0 deletions
diff --git a/source/script/tests/test_testparm_s3.sh b/source/script/tests/test_testparm_s3.sh
new file mode 100755
index 00000000000..f1316e922c2
--- /dev/null
+++ b/source/script/tests/test_testparm_s3.sh
@@ -0,0 +1,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}
+