3 # Blackbox test for net conf/registry roundtrips.
5 # Copyright (C) 2010 Gregor Beck <gbeck@sernet.de>
6 # Copyright (C) 2011 Michael Adam <obnox@samba.org>
8 NET
="$VALGRIND ${NET:-$BINDIR/net} $CONFIGURATION"
11 if test "x${RPC}" = "xrpc" ; then
12 NETREG
="${NET} -U${USERNAME}%${PASSWORD} -I ${SERVER_IP} rpc registry"
14 NETREG
="${NET} registry"
17 test x
"$TEST_FUNCTIONS_SH" != x
"INCLUDED" && {
18 incdir
=`dirname $0`/..
/..
/..
/testprogs
/blackbox
30 s/read prediction/;&/g
39 REGPATH
="HKLM\Software\Samba"
41 conf_roundtrip_step
() {
47 LOGDIR_PREFIX
="conf_roundtrip"
51 local DIR
=$
(mktemp
-d ${PREFIX}/${LOGDIR_PREFIX}_XXXX
)
54 echo conf_roundtrip
$1 > $LOG
56 sed -e "$SED_INVALID_PARAMS" $1 >$DIR/conf_in
58 conf_roundtrip_step
$NET conf drop
59 test -z "$($NET conf list)" 2>>$LOG
60 if [ "$?" = "1" ]; then
61 echo "ERROR: conf drop failed" |
tee -a $LOG
65 conf_roundtrip_step
$NET conf import
$DIR/conf_in
66 conf_roundtrip_step
$NET conf list
> $DIR/conf_exp
68 grep "\[global\]" $DIR/conf_exp
>/dev
/null
2>>$LOG
69 if [ "$?" = "1" ]; then
70 echo "ERROR: conf import => conf export failed" |
tee -a $LOG
74 conf_roundtrip_step
$NET -d10 registry
export $REGPATH $DIR/conf_exp.reg
76 conf_roundtrip_step
$NET conf drop
77 test -z "$($NET conf list)" 2>>$LOG
78 if [ "$?" = "1" ]; then
79 echo "ERROR: conf drop failed" |
tee -a $LOG
83 conf_roundtrip_step
$NET registry import
$DIR/conf_exp.reg
85 conf_roundtrip_step
$NET conf list
>$DIR/conf_out
86 diff -q $DIR/conf_out
$DIR/conf_exp
>> $LOG
87 if [ "$?" = "1" ]; then
88 echo "ERROR: registry import => conf export failed" |
tee -a $LOG
92 conf_roundtrip_step
$NET registry
export $REGPATH $DIR/conf_out.reg
93 diff -q $DIR/conf_out.reg
$DIR/conf_exp.reg
>>$LOG
94 if [ "$?" = "1" ]; then
95 echo "Error: registry import => registry export failed" |
tee -a $LOG
101 CONF_FILES
=${CONF_FILES:-$(find $SRCDIR/ -name '*.conf' | xargs grep -l "\[global\]")}
104 for OLDDIR
in $
(find ${PREFIX} -type d
-name "${LOGDIR_PREFIX}_*") ; do
105 echo "removing old directory ${OLDDIR}"
109 for conf_file
in $CONF_FILES
111 testit
"conf_roundtrip $conf_file" \
112 conf_roundtrip
$conf_file \
113 || failed
=`expr $failed + 1`