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
31 s/read prediction/;&/g
40 REGPATH
="HKLM\Software\Samba"
42 conf_roundtrip_step
() {
46 echo "RC: $RC" >> $LOG
47 test "x$RC" = "x0" ||
{
48 echo "ERROR: $@ failed (RC=$RC)" |
tee -a $LOG
54 LOGDIR_PREFIX
="conf_roundtrip"
58 local DIR
=$
(mktemp
-d ${PREFIX}/${LOGDIR_PREFIX}_XXXX
)
61 echo conf_roundtrip
$1 > $LOG
63 sed -e "$SED_INVALID_PARAMS" $1 >$DIR/conf_in
65 conf_roundtrip_step
$NET conf drop
66 test "x$?" = "x0" ||
{
70 test -z "$($NET conf list)" 2>>$LOG
71 if [ "$?" = "1" ]; then
72 echo "ERROR: conf drop failed" |
tee -a $LOG
76 conf_roundtrip_step
$NET conf import
$DIR/conf_in
77 test "x$?" = "x0" ||
{
81 conf_roundtrip_step
$NET conf list
> $DIR/conf_exp
82 test "x$?" = "x0" ||
{
86 grep "\[global\]" $DIR/conf_exp
>/dev
/null
2>>$LOG
87 if [ "$?" = "1" ]; then
88 echo "ERROR: conf import => conf export failed" |
tee -a $LOG
92 conf_roundtrip_step
$NET -d10 registry
export $REGPATH $DIR/conf_exp.reg
93 test "x$?" = "x0" ||
{
97 conf_roundtrip_step
$NET conf drop
98 test "x$?" = "x0" ||
{
102 test -z "$($NET conf list)" 2>>$LOG
103 if [ "$?" = "1" ]; then
104 echo "ERROR: conf drop failed" |
tee -a $LOG
108 conf_roundtrip_step
$NET registry import
$DIR/conf_exp.reg
109 test "x$?" = "x0" ||
{
113 conf_roundtrip_step
$NET conf list
>$DIR/conf_out
114 test "x$?" = "x0" ||
{
118 diff -q $DIR/conf_out
$DIR/conf_exp
>> $LOG
119 if [ "$?" = "1" ]; then
120 echo "ERROR: registry import => conf export failed" |
tee -a $LOG
124 conf_roundtrip_step
$NET registry
export $REGPATH $DIR/conf_out.reg
125 test "x$?" = "x0" ||
{
129 diff -q $DIR/conf_out.reg
$DIR/conf_exp.reg
>>$LOG
130 if [ "$?" = "1" ]; then
131 echo "Error: registry import => registry export failed" |
tee -a $LOG
137 CONF_FILES
=${CONF_FILES:-$(find $SRCDIR/ -name '*.conf' | grep -v examples/logon | xargs grep -l "\[global\]")}
140 for OLDDIR
in $
(find ${PREFIX} -type d
-name "${LOGDIR_PREFIX}_*") ; do
141 echo "removing old directory ${OLDDIR}"
145 for conf_file
in $CONF_FILES
147 testit
"conf_roundtrip $conf_file" \
148 conf_roundtrip
$conf_file \
149 || failed
=`expr $failed + 1`