summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGregor Beck <gbeck@sernet.de>2010-09-29 15:13:55 +0200
committerMichael Adam <obnox@samba.org>2011-01-21 10:10:03 +0100
commit64f8306e8eeda9219694a2490217b624aa004d9f (patch)
tree27b59a4ad6e83c5ebe7afc24a3340b5c1755b24b /source3
parentb5d882f5173e616dd2342f0d42f48847b6d4f2e5 (diff)
downloadsamba-64f8306e8eeda9219694a2490217b624aa004d9f.tar.gz
samba-64f8306e8eeda9219694a2490217b624aa004d9f.tar.bz2
samba-64f8306e8eeda9219694a2490217b624aa004d9f.zip
s3-net: add roundtrip tests for registry import/export
Diffstat (limited to 'source3')
-rwxr-xr-xsource3/script/tests/test_net_registry.sh88
1 files changed, 88 insertions, 0 deletions
diff --git a/source3/script/tests/test_net_registry.sh b/source3/script/tests/test_net_registry.sh
index 0d5916ebba..525e13a811 100755
--- a/source3/script/tests/test_net_registry.sh
+++ b/source3/script/tests/test_net_registry.sh
@@ -345,6 +345,93 @@ take_administrative_rights()
fi
}
+SED_INVALID_PARAMS="{
+s/lock directory/;&/g
+s/modules dir/;&/g
+s/logging/;&/g
+s/status/;&/g
+s/logdir/;&/g
+s/read prediction/;&/g
+s/mkprofile/;&/g
+s/valid chars/;&/g
+s/timesync/;&/g
+s/sambaconf/;&/g
+s/logtype/;&/g
+s/servername/;&/g
+}"
+
+REGPATH="HKLM\Software\Samba"
+
+conf_roundtrip_step() {
+ echo $* >>$LOG
+ $@ 2>>$LOG
+# echo -n .
+}
+
+conf_roundtrip()
+{
+ local DIR=$(mktemp -d --tmpdir=$PREFIX conf_roundtrip_XXXX)
+ local LOG=$DIR/log
+
+ echo conf_roundtrip $1 > $LOG
+
+ sed -e "$SED_INVALID_PARAMS" $1 >$DIR/conf_in
+
+ conf_roundtrip_step $NET conf drop
+ test -z "$($NET conf list)" 2>>$LOG
+ if [ "$?" = "1" ]; then
+ echo "ERROR: conf drop failed" | tee -a $LOG
+ return 1
+ fi
+
+ conf_roundtrip_step $NET conf import $DIR/conf_in
+ conf_roundtrip_step $NET conf list > $DIR/conf_exp
+
+ grep "\[global\]" $DIR/conf_exp >/dev/null 2>>$LOG
+ if [ "$?" = "1" ]; then
+ echo "ERROR: conf import => conf export failed" | tee -a $LOG
+ return 1
+ fi
+
+ conf_roundtrip_step $NET -d10 registry export $REGPATH $DIR/conf_exp.reg
+
+ conf_roundtrip_step $NET conf drop
+ test -z "$($NET conf list)" 2>>$LOG
+ if [ "$?" = "1" ]; then
+ echo "ERROR: conf drop failed" | tee -a $LOG
+ return 1
+ fi
+
+ conf_roundtrip_step $NET registry import $DIR/conf_exp.reg
+
+ conf_roundtrip_step $NET conf list >$DIR/conf_out
+ diff -q $DIR/conf_out $DIR/conf_exp >> $LOG
+ if [ "$?" = "1" ]; then
+ echo "ERROR: registry import => conf export failed" | tee -a $LOG
+ return 1
+ fi
+
+ conf_roundtrip_step $NET registry export $REGPATH $DIR/conf_out.reg
+ diff -q $DIR/conf_out.reg $DIR/conf_exp.reg >>$LOG
+ if [ "$?" = "1" ]; then
+ echo "Error: registry import => registry export failed" | tee -a $LOG
+ return 1
+ fi
+ rm -r $DIR
+}
+
+CONF_FILES=${CONF_FILES:-$(find $SRCDIR/.. -name *.conf | xargs grep -l "\[global\]")}
+
+for conf_file in $CONF_FILES
+do
+ conf_file=${conf_file#$SRCDIR/}
+ testit "conf_roundtrip $conf_file" \
+ conf_roundtrip $conf_file \
+ || failed=`expr $failed + 1`
+done
+
+
+
if test "x${RPC}" = "xrpc" ; then
testit "giving user ${USERNAME} administrative rights" \
give_administrative_rights
@@ -439,5 +526,6 @@ testit "taking administrative rights from user ${USERNAME}" \
failed=`expr $failed + 1`
fi
+
testok $0 $failed