summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUri Simchoni <uri@samba.org>2016-01-06 00:12:36 +0200
committerJeremy Allison <jra@samba.org>2016-01-06 03:58:59 +0100
commit3e1b26bd6d0998c3af3d77f94eaac469434389be (patch)
tree31cadc4deca9b6dae0f0e5a43ec61544bd571b2a
parent275da6c5c7e7c5dd0581e919912eb82102903a46 (diff)
downloadsamba-3e1b26bd6d0998c3af3d77f94eaac469434389be.tar.gz
selftest: more dfree command and smbclient disk usage tests
Add tests that cover disk usage printing by smbclient, as well as passing directory info to the "dfree command" script. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11662 Signed-off-by: Uri Simchoni <uri@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Jan 6 03:58:59 CET 2016 on sn-devel-144
-rwxr-xr-xselftest/target/Samba3.pm2
-rwxr-xr-xsource3/script/tests/test_dfree_command.sh17
-rwxr-xr-xtestprogs/blackbox/dfree.sh8
3 files changed, 21 insertions, 6 deletions
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index c9e57ad2069..09066203e86 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -590,6 +590,8 @@ sub setup_fileserver($$)
my $dfree_share_dir="$share_dir/dfree";
push(@dirs, $dfree_share_dir);
+ push(@dirs, "$dfree_share_dir/subdir1");
+ push(@dirs, "$dfree_share_dir/subdir2");
my $valid_users_sharedir="$share_dir/valid_users";
push(@dirs,$valid_users_sharedir);
diff --git a/source3/script/tests/test_dfree_command.sh b/source3/script/tests/test_dfree_command.sh
index c9c3aa6ca9e..a60a52de5c4 100755
--- a/source3/script/tests/test_dfree_command.sh
+++ b/source3/script/tests/test_dfree_command.sh
@@ -1,6 +1,7 @@
#!/bin/sh
#
-# Blackbox test for 'dfree command'
+# Blackbox test for 'dfree command' and smbclient "l"
+# command disk free printout.
#
if [ $# -lt 6 ]; then
@@ -26,15 +27,16 @@ test_smbclient_dfree() {
name="$1"
share="$2"
cmd="$3"
+ expected="$4"
shift
shift
+ shift
subunit_start_test "$name"
output=$($VALGRIND $smbclient //$SERVER/$share -c "$cmd" $@ 2>&1)
status=$?
if [ x$status = x0 ]; then
- echo "$output" | grep "2000 blocks of size 1024. 20 blocks available" >/dev/null
- status=$?
- if [ x$status = x0 ]; then
+ received=$(echo "$output" | awk '/blocks of size/ {print $1, $5, $6}')
+ if [ "$expected" = "$received" ]; then
subunit_pass_test "$name"
else
echo "$output" | subunit_fail_test "$name"
@@ -46,6 +48,11 @@ test_smbclient_dfree() {
}
-test_smbclient_dfree "Test dfree command" dfree "l" -U$USERNAME%$PASSWORD || failed=`expr $failed + 1`
+test_smbclient_dfree "Test dfree command share root SMB3" dfree "l" "2000 1024. 20" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`
+test_smbclient_dfree "Test dfree command share root NT1" dfree "l" "2000 1024. 20" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=NT1 || failed=`expr $failed + 1`
+test_smbclient_dfree "Test dfree command subdir1 SMB3" dfree "cd subdir1; l" "8000 1024. 80" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`
+test_smbclient_dfree "Test dfree command subdir2 SMB3" dfree "cd subdir2; l" "32000 1024. 320" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`
+#SMB1 queries disk usage stat on the share's root, regardless of working directory
+test_smbclient_dfree "Test dfree command subdir1 NT1" dfree "cd subdir1; l" "2000 1024. 20" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=NT1 || failed=`expr $failed + 1`
exit $failed
diff --git a/testprogs/blackbox/dfree.sh b/testprogs/blackbox/dfree.sh
index 2da3cbd6c5d..64845cd1784 100755
--- a/testprogs/blackbox/dfree.sh
+++ b/testprogs/blackbox/dfree.sh
@@ -1,2 +1,8 @@
#!/bin/sh
-echo "1000 10 2048"
+if [ "$1" = "." ] ; then
+ echo "1000 10 2048"
+elif [ "$1" = "subdir1" ] ; then
+ echo "2000 20 4096"
+else
+ echo "4000 40 8192"
+fi