3 # Blackbox test for net [rpc] conf.
5 # Copyright (C) 2011 Vicentiu Ciorbaru <cvicentiu@gmail.com>
9 Usage: test_net_conf.sh SCRIPTDIR SERVERCONFFILE NET CONFIGURATION [rpc]
20 LOGDIR_PREFIX
="conf_test"
23 for OLDDIR
in $
(find ${PREFIX} -type d
-name "${LOGDIR_PREFIX}_*") ; do
24 echo "removing old directory ${OLDDIR}"
29 NET
="$VALGRIND ${NET:-$BINDIR/net} $CONFIGURATION"
30 DIR
=$
(mktemp
-d ${PREFIX}/${LOGDIR_PREFIX}_XXXXXX
)
34 if test "x${RPC}" = "xrpc" ; then
35 NETCMD
="${NET} -U${USERNAME}%${PASSWORD} -I ${SERVER_IP} rpc"
40 incdir
=`dirname $0`/..
/..
/..
/testprogs
/blackbox
48 echo "RC: $RC" >> $LOG
55 echo '\nTesting conf addshare' >> $LOG
56 echo ------------------------- >> $LOG
57 echo '\nDropping existing configuration' >> $LOG
60 log_print
$NETCMD conf drop
61 test "x$?" = "x0" ||
{
62 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
66 #create a lot of shares
67 for i
in $
(seq 1 100); do
68 if [ $
(($i % 2)) -eq 0 ]; then
69 $NETCMD conf addshare share
$i /tmp
"writeable=y" "guest_ok=n" \
70 "test comment" >>$DIR/addshare_exp \
72 log_print
$NETCMD conf addshare share
$i /tmp
"writeable=y" "guest_ok=n" \
75 $NETCMD conf addshare share
$i /tmp
"writeable=n" "guest_ok=y" \
76 "test comment" >>$DIR/addshare_exp \
78 log_print
$NETCMD conf addshare share
$i /tmp
"writeable=n" "guest_ok=y" \
81 test "x$?" = "x0" ||
{
82 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
87 $NETCMD conf listshares
> $DIR/listshares_out
88 log_print
$NETCMD conf listshares
89 test "x$?" = "x0" ||
{
90 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
94 for i
in $
(seq 1 100); do
95 grep "share$i" $DIR/listshares_out
>/dev
/null
2>>$LOG
96 if [ "$?" = "1" ]; then
97 echo "ERROR: share not found" |
tee -a $LOG
102 #check the integrity of the shares
103 #if it fails, it can also point to an error in showshare
104 for i
in $
(seq 1 100); do
105 $NETCMD conf showshare share
$i > $DIR/showshare_out
106 test "x$?" = "x0" ||
{
107 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
111 grep "path" $DIR/showshare_out
>/dev
/null
2>>$LOG
112 if [ "$?" = "1" ]; then
113 echo "ERROR: share not found" |
tee -a $LOG
117 if [ $
(($i % 2)) -eq 0 ]; then
118 grep "read only *= *no" $DIR/showshare_out
>/dev
/null
2>>$LOG
119 if [ "$?" = "1" ]; then
120 echo "ERROR: share not set correctly" |
tee -a $LOG
124 grep "read only *= *yes" $DIR/showshare_out
>/dev
/null
2>>$LOG
125 if [ "$?" = "1" ]; then
126 echo "ERROR: share not set correctly" |
tee -a $LOG
131 if [ $
(($i % 2)) -eq 0 ]; then
132 grep "guest ok *= *no" $DIR/showshare_out
>/dev
/null
2>>$LOG
133 if [ "$?" = "1" ]; then
134 echo "ERROR: share not set correctly" |
tee -a $LOG
138 grep "guest ok *= *yes" $DIR/showshare_out
>/dev
/null
2>>$LOG
139 if [ "$?" = "1" ]; then
140 echo "ERROR: share not set correctly" |
tee -a $LOG
145 grep "comment *= *test comment" $DIR/showshare_out
>/dev
/null
2>>$LOG
146 if [ "$?" = "1" ]; then
147 echo "ERROR: share not set correctly" |
tee -a $LOG
152 echo '\nTaking a conf snapshot for later use' >> $LOG
153 $NETCMD conf list
> $DIR/conf_import_in
154 log_print
$NETCMD conf list
155 test "x$?" = "x0" ||
{
156 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
161 test_conf_addshare_existing
()
163 #try adding an already existing share
164 echo '\nAdding an already existing share' >>$LOG
165 $NETCMD conf addshare share1
/tmp
"writeable=n" "guest_ok=y" \
166 "test comment" >>$DIR/addshare_exp \
168 log_print
$NETCMD conf addshare share1
/tmp
"writeable=n" "guest_ok=y" \
170 test "x$?" = "x255" ||
{
171 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
175 test -z `cat $DIR/addshare_exp` && {
176 echo "ERROR: addshare output does not match" >> $LOG
183 test_conf_addshare_usage
()
185 #check to see if command prints usage
186 echo '\nChecking usage' >>$LOG
187 $NETCMD conf addshare
> $DIR/addshare_usage_exp
188 log_print
$NETCMD conf addshare
189 test "x$?" = "x255" ||
{
190 echo 'ERROR: RC does not match, expected: 255' |
tee -a $LOG
194 grep "$RPC *conf addshare" $DIR/addshare_usage_exp
>/dev
/null
2>>$LOG
195 if [ "$?" = "1" ]; then
196 echo "ERROR: no/wrong usage message printed" |
tee -a $LOG
203 echo '\nTesting conf delshare' >>$LOG
204 echo ------------------------- >> $LOG
207 $NETCMD conf delshare share1
208 log_print
$NETCMD conf delshare share1
209 test "x$?" = "x0" ||
{
210 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
214 $NETCMD conf listshares
> $DIR/listshares_out
215 log_print
$NETCMD conf listshares
216 test "x$?" = "x0" ||
{
217 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
221 grep "share1$" $DIR/listshares_out
>/dev
/null
2>>$LOG
222 if [ "$?" = "0" ]; then
223 echo "ERROR: delshare did not delete 'share1'" |
tee -a $LOG
228 test_conf_delshare_empty
()
230 echo '\nAttempting to delete non_existing share'
231 $NETCMD conf delshare share1
232 log_print
$NETCMD conf delshare share1
233 test "x$?" = "x255" ||
{
234 echo 'ERROR: RC does not match, expected: 255' |
tee -a $LOG
240 test_conf_delshare_usage
()
242 echo '\nChecking usage' >>$LOG
243 $NETCMD conf delshare
> $DIR/delshare_usage_exp
244 log_print
$NETCMD conf delshare
245 test "x$?" = "x255" ||
{
246 echo 'ERROR: RC does not match, expected: 255' |
tee -a $LOG
250 grep "$RPC *conf delshare" $DIR/delshare_usage_exp
>/dev
/null
2>>$LOG
251 if [ "$?" = "1" ]; then
252 echo "ERROR: no/wrong usage message printed" |
tee -a $LOG
260 echo '\nTesting conf drop' >> $LOG
261 echo ------------------------- >> $LOG
262 echo '\nDropping existing configuration' >> $LOG
265 log_print
$NETCMD conf drop
266 test "x$?" = "x0" ||
{
267 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
271 #check to see if listing the configuration yields a blank file
272 $NETCMD conf list
1>>$DIR/list_out
273 log_print
$NETCMD conf list
274 test "x$?" = "x0" ||
{
275 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
279 test -z "`cat $DIR/list_out`" ||
{
280 echo "ERROR: Expected list output did not match" |
tee -a $LOG
285 test_conf_drop_empty
()
287 #Drop an empty config, see if conf drop fails
288 echo '\nAttempting to drop an empty configuration' >>$LOG
291 log_print
$NETCMD conf drop
292 test "x$?" = "x0" ||
{
293 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
297 #check to see if listing the configuration yields a blank file
298 $NETCMD conf list
1>>$DIR/list_out
299 log_print
$NETCMD conf list
300 test "x$?" = "x0" ||
{
301 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
305 test -z "`cat $DIR/list_out`" ||
{
306 echo ERROR
:Expected list output did not match
>> $LOG
311 test_conf_drop_usage
()
313 #check to see if command prints usage
314 echo '\nChecking usage' >>$LOG
315 $NETCMD conf drop extra_arg
> $DIR/drop_usage_exp
316 log_print
$NETCMD conf drop extra_arg
317 test "x$?" = "x255" ||
{
318 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
322 grep "$RPC *conf drop" $DIR/drop_usage_exp
>/dev
/null
2>>$LOG
323 if [ "$?" = "1" ]; then
324 echo "ERROR: no/wrong usage message printed" |
tee -a $LOG
331 echo '\nTesting conf setparm' >> $LOG
332 echo ------------------------- >> $LOG
334 echo '\nDropping existing configuration' >> $LOG
336 log_print
$NETCMD conf drop
337 test "x$?" = "x0" ||
{
338 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
342 $NETCMD conf setparm share1
"read only" yes
343 log_print
$NETCMD conf setparm share1
"read only" yes
344 test "x$?" = "x0" ||
{
345 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
349 $NETCMD conf setparm share1
"path" /tmp
/test_path
350 log_print
$NETCMD conf setparm share1
"path" /tmp
/test_path
351 test "x$?" = "x0" ||
{
352 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
356 $NETCMD conf showshare share1
> $DIR/setparm_showshare_out
357 test "x$?" = "x0" ||
{
358 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
362 grep "read only *= *yes" $DIR/setparm_showshare_out
>/dev
/null
2>>$LOG
363 if [ "$?" = "1" ]; then
364 echo "ERROR: setparm did not set correctly" |
tee -a $LOG
368 grep "path *= */tmp/test_path" $DIR/setparm_showshare_out
>/dev
/null
2>>$LOG
369 if [ "$?" = "1" ]; then
370 echo "ERROR: setparm did not set correctly" |
tee -a $LOG
375 test_conf_setparm_existing
()
378 echo '\nSetting already existing param with the same value'
379 $NETCMD conf setparm share1
"read only" yes
380 log_print
$NETCMD conf setparm share1
"read only" yes
381 test "x$?" = "x0" ||
{
382 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
386 $NETCMD conf setparm share1
"read only" yes
387 log_print
$NETCMD conf setparm share1
"read only" yes
388 test "x$?" = "x0" ||
{
389 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
393 $NETCMD conf showshare share1
> $DIR/setparm_existing_showshare_out
394 test "x$?" = "x0" ||
{
395 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
399 grep "read only *= *yes" $DIR/setparm_existing_showshare_out
>/dev
/null
2>>$LOG
400 if [ "$?" = "1" ]; then
401 echo "ERROR: setparm did not set correctly" |
tee -a $LOG
405 $NETCMD conf setparm share1
"read only" no
406 log_print
$NETCMD conf setparm share1
"read only" no
407 test "x$?" = "x0" ||
{
408 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
412 $NETCMD conf showshare share1
> $DIR/setparm_existing_showshare_out
413 test "x$?" = "x0" ||
{
414 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
418 grep "read only *= *no" $DIR/setparm_existing_showshare_out
>/dev
/null
2>>$LOG
419 if [ "$?" = "1" ]; then
420 echo "ERROR: setparm did not set correctly" |
tee -a $LOG
425 test_conf_setparm_forbidden
()
427 FORBIDDEN_PARAMS
="state directory
433 echo '\nTrying to set forbidden parameters' >> $LOG
435 echo '\nDropping existing configuration' >> $LOG
437 log_print
$NETCMD conf drop
438 test "x$?" = "x0" ||
{
439 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
446 for PARAM
in $FORBIDDEN_PARAMS ; do
448 echo "Trying to set parameter '$PARAM'" |
tee -a $LOG
449 $NETCMD conf setparm global
"$PARAM" "value" > $DIR/setparm_forbidden_out
2>&1
450 log_print
$NETCMD conf setparm global
\""$PARAM"\" "value"
451 test "x$?" = "x0" && {
452 echo "ERROR: setting forbidden parameter '$PARAM' succeeded" |
tee -a $LOG
456 echo "output of net command: " |
tee -a $LOG
457 cat $DIR/setparm_forbidden_out |
tee -a $LOG
459 SEARCH
="Parameter '$PARAM' not allowed in registry."
460 grep "$SEARCH" $DIR/setparm_forbidden_out
>/dev
/null
2>>$LOG
461 test "x$?" = "x0" ||
{
462 echo "ERROR: expected '$SEARCH'" |
tee -a $LOG
471 test_conf_setparm_usage
()
473 echo '\nChecking usage' >>$LOG
474 $NETCMD conf setparm
> $DIR/setparm_usage_exp
475 log_print
$NETCMD conf setparm
476 test "x$?" = "x255" ||
{
477 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
481 grep "$RPC *conf setparm" $DIR/setparm_usage_exp
>/dev
/null
2>>$LOG
482 if [ "$?" = "1" ]; then
483 echo "ERROR: setparm no/wrong usage message printed" |
tee -a $LOG
488 test_conf_delparm_delete_existing
()
490 echo '\nTesting conf delparm' >> $LOG
491 echo ------------------------- >> $LOG
495 log_print
$NETCMD conf drop
496 test "x$?" = "x0" ||
{
497 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
501 $NETCMD conf addshare share1
/tmp
"writeable=y" "guest_ok=n" \
503 log_print
$NETCMD conf addshare share
$i /tmp
"writeable=y" "guest_ok=n" \
506 $NETCMD conf delparm share1
"path"
507 log_print
$NETCMD conf delparm share1
"path"
508 test "x$?" = "x0" ||
{
509 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
513 $NETCMD conf showshare share1
> $DIR/delparm_showshare_out
514 test "x$?" = "x0" ||
{
515 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
519 #test to see what delparm did delete and how
520 grep "read only *= *no" $DIR/delparm_showshare_out
>/dev
/null
2>>$LOG
521 if [ "$?" = "1" ]; then
522 echo "ERROR: delparm did not delete correctly" |
tee -a $LOG
526 grep "path *= */tmp" $DIR/delparm_showshare_out
>/dev
/null
2>>$LOG
527 if [ "$?" = "0" ]; then
528 echo "ERROR: delparm did not delete correctly" |
tee -a $LOG
533 test_conf_delparm_delete_non_existing
()
535 echo '\nDelete non existing share' >> $LOG
538 log_print
$NETCMD conf drop
539 test "x$?" = "x0" ||
{
540 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
544 $NETCMD conf delparm share1
"path"
545 log_print
$NETCMD conf delparm share1
"path"
546 test "x$?" = "x255" ||
{
547 echo 'ERROR: RC does not match, expected: 255' |
tee -a $LOG
552 test_conf_delparm_usage
()
555 echo '\nChecking usage' >>$LOG
556 $NETCMD conf delparm
> $DIR/delparm_usage_exp
557 log_print
$NETCMD conf delparm
558 test "x$?" = "x255" ||
{
559 echo 'ERROR: RC does not match, expected: 255' |
tee -a $LOG
563 grep "$RPC *conf delparm" $DIR/delparm_usage_exp
>/dev
/null
2>>$LOG
564 if [ "$?" = "1" ]; then
565 echo "ERROR: delparm no/wrong usage message printed" |
tee -a $LOG
574 echo '\nTesting conf getparm' >> $LOG
575 echo ------------------------- >> $LOG
579 log_print
$NETCMD conf drop
580 test "x$?" = "x0" ||
{
584 $NETCMD conf addshare share1
/tmp
/path_test
"writeable=n" "guest_ok=n" \
586 log_print
$NETCMD conf addshare share
$i /tmp
/path_test
"writeable=n" "guest_ok=n" \
588 test "x$?" = "x0" ||
{
589 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
593 $NETCMD conf getparm share1
"read only" >$DIR/getparm_out
594 log_print
$NETCMD conf getparm share1
"read only"
595 test "x$?" = "x0" ||
{
596 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
600 $NETCMD conf getparm share1
"read only" >$DIR/getparm_out
601 log_print
$NETCMD conf getparm share1
"read only"
602 test "x$?" = "x0" ||
{
603 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
607 echo yes >$DIR/getparm_exp
608 diff -q $DIR/getparm_out
$DIR/getparm_exp
>> $LOG
609 if [ "$?" = "1" ]; then
610 echo "ERROR: getparm did not print correctly" |
tee -a $LOG
614 $NETCMD conf getparm share1
"path" >$DIR/getparm_out
615 log_print
$NETCMD conf getparm share1
"path"
616 test "x$?" = "x0" ||
{
617 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
621 echo /tmp
/path_test
>$DIR/getparm_exp
622 diff -q $DIR/getparm_out
$DIR/getparm_exp
>> $LOG
623 if [ "$?" = "1" ]; then
624 echo "ERROR: getparm did not print correctly" |
tee -a $LOG
629 test_conf_getparm_usage
()
631 echo '\nChecking usage' >>$LOG
632 $NETCMD conf getparm
> $DIR/getparm_usage_exp
633 log_print
$NETCMD conf getparm
634 test "x$?" = "x255" ||
{
635 echo 'ERROR: RC does not match, expected: 255' |
tee -a $LOG
639 grep "$RPC *conf getparm" $DIR/getparm_usage_exp
>/dev
/null
2>>$LOG
640 if [ "$?" = "1" ]; then
641 echo "ERROR: getparm no/wrong usage message printed" |
tee -a $LOG
647 test_conf_getparm_non_existing
()
649 echo '\nTesting getparm non existing' >>$LOG
650 $NETCMD conf getparm fictional_share fictional_param
651 log_print
$NETCMD conf getparm fictional_share fictional_param
652 test "x$?" = "x255" ||
{
653 echo 'ERROR: RC does not match, expected: 255' |
tee -a $LOG
657 $NETCMD conf getparm share1 fictional_param
658 log_print
$NETCMD conf getparm share1 fictional_param
659 test "x$?" = "x255" ||
{
660 echo 'ERROR: RC does not match, expected: 255' |
tee -a $LOG
665 test_conf_setincludes
()
667 echo '\nTesting conf setincludes' >> $LOG
668 echo ------------------------- >> $LOG
669 echo '\nDropping existing configuration' >> $LOG
672 log_print
$NETCMD conf drop
673 test "x$?" = "x0" ||
{
674 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
678 $NETCMD conf addshare tmp_share
/tmp
679 log_print
$NETCMD conf addshare tmp_share
/tmp
680 test "x$?" = "x0" ||
{
681 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
685 $NETCMD conf setincludes tmp_share
/tmp
/include1
/tmp
/include2
/tmp
/include3
686 log_print
$NETCMD conf setincludes tmp_share
/tmp
/include1
/tmp
/include2
/tmp
/include3
687 test "x$?" = "x0" ||
{
688 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
692 $NETCMD conf list
> $DIR/setincludes_list_out
693 log_print
$NETCMD conf list
694 test "x$?" = "x0" ||
{
695 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
699 grep "include *= */tmp/include1$" $DIR/setincludes_list_out
>/dev
/null
2>>$LOG
700 if [ "$?" = "1" ]; then
701 echo "ERROR: setincludes did not set correctly" |
tee -a $LOG
705 grep "include *= */tmp/include2$" $DIR/setincludes_list_out
>/dev
/null
2>>$LOG
706 if [ "$?" = "1" ]; then
707 echo "ERROR: setincludes did not set correctly" |
tee -a $LOG
711 grep "include *= */tmp/include3$" $DIR/setincludes_list_out
>/dev
/null
2>>$LOG
712 if [ "$?" = "1" ]; then
713 echo "ERROR: setincludes did not set correctly" |
tee -a $LOG
719 test_conf_setincludes_usage
()
721 echo '\nChecking usage' >>$LOG
722 $NETCMD conf setincludes
> $DIR/setincludes_usage_exp
723 log_print
$NETCMD conf setincludes
724 test "x$?" = "x255" ||
{
725 echo 'ERROR: RC does not match, expected: 255' |
tee -a $LOG
729 grep "$RPC *conf setincludes" $DIR/setincludes_usage_exp
>/dev
/null
2>>$LOG
730 if [ "$?" = "1" ]; then
731 echo "ERROR: no/wrong usage message printed" |
tee -a $LOG
736 test_conf_getincludes
()
738 $NETCMD conf getincludes tmp_share
> $DIR/getincludes_out
739 log_print
$NETCMD conf getincludes tmp_share
740 test "x$?" = "x0" ||
{
741 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
745 grep "include *= */tmp/include1$" $DIR/getincludes_out
>/dev
/null
2>>$LOG
746 if [ "$?" = "1" ]; then
747 echo "ERROR: getincludes did not print correctly" |
tee -a $LOG
751 grep "include *= */tmp/include2$" $DIR/getincludes_out
>/dev
/null
2>>$LOG
752 if [ "$?" = "1" ]; then
753 echo "ERROR: getincludes did not print correctly" |
tee -a $LOG
756 grep "include *= */tmp/include3$" $DIR/getincludes_out
>/dev
/null
2>>$LOG
757 if [ "$?" = "1" ]; then
758 echo "ERROR: getincludes did not print correctly" |
tee -a $LOG
763 test_conf_getincludes_usage
()
765 $NETCMD conf getincludes
> $DIR/getincludes_usage_exp
766 log_print
$NETCMD conf getincludes
768 grep "$RPC *conf getincludes" $DIR/getincludes_usage_exp
>/dev
/null
2>>$LOG
769 if [ "$?" = "1" ]; then
770 echo "ERROR: no/wrong usage message printed" |
tee -a $LOG
775 test_conf_delincludes
()
777 echo '\nTesting conf delincludes' >> $LOG
778 echo ------------------------- >> $LOG
780 $NETCMD conf delincludes tmp_share
781 log_print
$NETCMD conf delincludes tmp_share
782 test "x$?" = "x0" ||
{
783 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
787 $NETCMD conf list
> $DIR/delincludes_list_out
788 log_print
$NETCMD conf list
789 test "x$?" = "x0" ||
{
790 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
794 grep "include" $DIR/delincludes_list_out
>/dev
/null
2>>$LOG
795 if [ "$?" = "0" ]; then
796 echo "ERROR: delincludes did not delete correctly" |
tee -a $LOG
801 test_conf_delincludes_empty
()
803 $NETCMD conf delincludes tmp_share
804 log_print
$NETCMD conf delincludes tmp_share
805 test "x$?" = "x0" ||
{
806 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
810 $NETCMD conf delincludes fictional_share
811 log_print
$NETCMD conf delincludes fictional_share
812 test "x$?" = "x255" ||
{
813 echo 'ERROR: RC does not match, expected: 255' |
tee -a $LOG
819 test_conf_delincludes_usage
()
821 echo '\nChecking usage' >>$LOG
822 $NETCMD conf delincludes
> $DIR/delincludes_usage_exp
823 log_print
$NETCMD conf delincludes
824 test "x$?" = "x255" ||
{
825 echo 'ERROR: RC does not match, expected: 255' |
tee -a $LOG
829 grep "$RPC *conf delincludes" $DIR/delincludes_usage_exp
>/dev
/null
2>>$LOG
830 if [ "$?" = "1" ]; then
831 echo "ERROR: no/wrong usage message printed" |
tee -a $LOG
838 echo '\nTesting conf import' >> $LOG
839 echo ------------------------- >> $LOG
840 echo '\nDropping existing configuration' >> $LOG
843 log_print
$NETCMD conf drop
844 test "x$?" = "x0" ||
{
845 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
849 $NETCMD conf import
$DIR/conf_import_in
850 log_print
$NETCMD conf drop
851 test "x$?" = "x0" ||
{
852 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
856 $NETCMD conf list
> $DIR/conf_import_out
857 log_print
$NETCMD conf list
858 test "x$?" = "x0" ||
{
859 echo 'ERROR: RC does not match, expected: 0' |
tee -a $LOG
863 diff -q $DIR/conf_import_in
$DIR/conf_import_out
>> $LOG
864 if [ "$?" = "1" ]; then
865 echo "ERROR: import failed" |
tee -a $LOG
870 test_conf_import_usage
()
872 echo '\nChecking usage' >>$LOG
873 $NETCMD conf import
> $DIR/import_usage_exp
874 log_print
$NETCMD conf import
875 test "x$?" = "x255" ||
{
876 echo 'ERROR: RC does not match, expected: 255' |
tee -a $LOG
880 grep "$RPC *conf import" $DIR/import_usage_exp
>/dev
/null
2>>$LOG
881 if [ "$?" = "1" ]; then
882 echo "ERROR: conf import no/wrong usage message printed" |
tee -a $LOG
887 CONF_FILES
=$SERVERCONFFILE
891 || failed
=`expr $failed + 1`
893 testit
"conf_drop_empty" \
894 test_conf_drop_empty \
895 || failed
=`expr $failed + 1`
897 testit
"conf_drop_usage" \
898 test_conf_drop_usage \
899 || failed
=`expr $failed + 1`
901 testit
"conf_addshare" \
903 || failed
=`expr $failed + 1`
905 testit
"conf_addshare_existing" \
906 test_conf_addshare_existing \
907 || failed
=`expr $failed + 1`
909 testit
"conf_addshare_usage" \
910 test_conf_addshare_usage \
911 || failed
=`expr $failed + 1`
913 testit
"conf_delshare" \
915 || failed
=`expr $failed + 1`
917 testit
"conf_delshare_empty" \
918 test_conf_delshare_empty \
919 || failed
=`expr $failed + 1`
921 testit
"conf_delshare_usage" \
922 test_conf_delshare_usage \
923 || failed
=`expr $failed + 1`
925 testit
"conf_setparm" \
927 || failed
=`expr $failed + 1`
929 testit
"conf_setparm_existing" \
930 test_conf_setparm_existing \
931 || failed
=`expr $failed + 1`
933 testit
"conf_setparm_forbidden" \
934 test_conf_setparm_forbidden \
935 || failed
=`expr $failed + 1`
937 testit
"conf_setparm_usage" \
938 test_conf_setparm_usage \
939 || failed
=`expr $failed + 1`
941 testit
"conf_delparm_delete_existing" \
942 test_conf_delparm_delete_existing \
943 || failed
=`expr $failed + 1`
945 testit
"conf_delparm_delete_non_existing" \
946 test_conf_delparm_delete_non_existing \
947 || failed
=`expr $failed + 1`
949 testit
"conf_delparm_delete_usage" \
950 test_conf_delparm_usage \
951 || failed
=`expr $failed + 1`
953 testit
"conf_getparm" \
955 || failed
=`expr $failed + 1`
957 testit
"conf_getparm_usage" \
958 test_conf_getparm_usage \
959 || failed
=`expr $failed + 1`
961 testit
"conf_setincludes" \
962 test_conf_setincludes \
963 || failed
=`expr $failed + 1`
965 testit
"conf_setincludes_usage" \
966 test_conf_setincludes_usage \
967 || failed
=`expr $failed + 1`
969 testit
"conf_getincludes" \
970 test_conf_getincludes \
971 || failed
=`expr $failed + 1`
973 testit
"conf_getincludes_usage" \
974 test_conf_getincludes_usage \
975 || failed
=`expr $failed + 1`
977 testit
"conf_delincludes" \
978 test_conf_delincludes \
979 || failed
=`expr $failed + 1`
981 testit
"conf_delincludes_empty" \
982 test_conf_delincludes_usage \
983 || failed
=`expr $failed + 1`
985 testit
"conf_delincludes_usage" \
986 test_conf_delincludes_empty \
987 || failed
=`expr $failed + 1`
989 testit
"conf_import" \
991 || failed
=`expr $failed + 1`
993 testit
"conf_import_usage" \
994 test_conf_import_usage \
995 || failed
=`expr $failed + 1`
997 if [ $failed -eq 0 ]; then