3 # Blackbox tests for the rpcclient srvsvc commands
5 # Copyright (C) 2015 Christof Schmitt
9 Usage: test_rpcclientsrvsvc.sh USERNAME PASSWORD SERVER RPCCLIENT SHARE1
20 RPCCLIENTCMD
="$RPCCLIENT $SERVER -U$USERNAME%$PASSWORD"
24 COMMENT
="share for RPC SRVSVC testing"
26 incdir
=$
(dirname $0)/..
/..
/..
/testprogs
/blackbox
31 # Query path from existing share
33 $RPCCLIENTCMD -c "netsharegetinfo $SHARE1"
35 testit
"getinfo on S$SHARE1" test $RC = 0 || failed
=$
(expr $failed + 1)
37 SHAREPATH
=$
($RPCCLIENTCMD -c "netsharegetinfo '$SHARE1'" |
38 grep path
: |
sed -e 's/.*path:\t//')
39 testit
"verifying $SHARE1 path" test -n "$SHAREPATH" ||
40 failed
=$
(expr $failed + 1)
44 $RPCCLIENTCMD -c "netshareadd '$SHAREPATH' '$SHARENAME' '$MAX_USERS' '$COMMENT'"
46 testit
"netshareadd" test $RC = 0 || failed
=$
(expr $failed + 1)
48 # Verify comment for new share
50 COMMENT_RET
=$
($RPCCLIENTCMD -c "netsharegetinfo '$SHARENAME'" |
51 grep remark
: |
sed -e 's/.*remark:\t//')
53 test "$COMMENT" = "$COMMENT_RET"
55 testit
"verifying comment" test $RC -eq 0 || failed
=$
(expr $failed + 1)
57 # Verify share path for new share
59 SHAREPATH_RET
=$
($RPCCLIENTCMD -c "netsharegetinfo '$SHARENAME'" |
60 grep path
: |
sed -e 's/.*path:\t//')
61 test "$SHAREPATH" = "$SHAREPATH_RET"
63 testit
"verifying share path" test $RC -eq 0 || failed
=$
(expr $failed + 1)
67 $RPCCLIENTCMD -c "netsharesetdfsflags '$SHARENAME' 0x30"
69 testit
"set csc policy" test $RC -eq 0 || failed
=$
(expr $failed + 1)
73 CSC_CACHING_RET
=$
($RPCCLIENTCMD -c "netsharegetinfo '$SHARENAME' 1005" |
74 grep 'csc caching' |
sed -e 's/.*csc caching: //')
75 testit
"verifying csc policy" test $CSC_CACHING_RET -eq 3 ||
76 failed
=$
(expr $failed + 1)
80 $RPCCLIENTCMD -c "netsharedel '$SHARENAME'"
82 testit
"deleting share" test $RC -eq 0 || failed
=$
(expr $failed + 1)
84 # Verify that query to deleted share fails
86 $RPCCLIENTCMD -c "netsharegetinfo '$SHARENAME' 1005"
88 testit
"querying deleted share" test $RC -eq 1 || failed
=$
(expr $failed + 1)