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
() {
49 local DIR
=$
(mktemp
-d --tmpdir=$PREFIX conf_roundtrip_XXXX
)
52 echo conf_roundtrip
$1 > $LOG
54 sed -e "$SED_INVALID_PARAMS" $1 >$DIR/conf_in
56 conf_roundtrip_step
$NET conf drop
57 test -z "$($NET conf list)" 2>>$LOG
58 if [ "$?" = "1" ]; then
59 echo "ERROR: conf drop failed" |
tee -a $LOG
63 conf_roundtrip_step
$NET conf import
$DIR/conf_in
64 conf_roundtrip_step
$NET conf list
> $DIR/conf_exp
66 grep "\[global\]" $DIR/conf_exp
>/dev
/null
2>>$LOG
67 if [ "$?" = "1" ]; then
68 echo "ERROR: conf import => conf export failed" |
tee -a $LOG
72 conf_roundtrip_step
$NET -d10 registry
export $REGPATH $DIR/conf_exp.reg
74 conf_roundtrip_step
$NET conf drop
75 test -z "$($NET conf list)" 2>>$LOG
76 if [ "$?" = "1" ]; then
77 echo "ERROR: conf drop failed" |
tee -a $LOG
81 conf_roundtrip_step
$NET registry import
$DIR/conf_exp.reg
83 conf_roundtrip_step
$NET conf list
>$DIR/conf_out
84 diff -q $DIR/conf_out
$DIR/conf_exp
>> $LOG
85 if [ "$?" = "1" ]; then
86 echo "ERROR: registry import => conf export failed" |
tee -a $LOG
90 conf_roundtrip_step
$NET registry
export $REGPATH $DIR/conf_out.reg
91 diff -q $DIR/conf_out.reg
$DIR/conf_exp.reg
>>$LOG
92 if [ "$?" = "1" ]; then
93 echo "Error: registry import => registry export failed" |
tee -a $LOG
99 CONF_FILES
=${CONF_FILES:-$(find $SRCDIR/ -name '*.conf' | xargs grep -l "\[global\]")}
101 for conf_file
in $CONF_FILES
103 testit
"conf_roundtrip $conf_file" \
104 conf_roundtrip
$conf_file \
105 || failed
=`expr $failed + 1`