summaryrefslogtreecommitdiff
path: root/source3/script
diff options
context:
space:
mode:
authorChristof Schmitt <cs@samba.org>2018-05-23 11:25:42 -0700
committerKarolin Seeger <kseeger@samba.org>2018-06-07 09:39:14 +0200
commit88d19df48977fecc874f246798364c2ef5ccc013 (patch)
tree854f64e1bd8429b85005552e332539cefe3cfaa9 /source3/script
parent2e5bc85b3c67e8ccf81648e9d1260448369d5cf2 (diff)
downloadsamba-88d19df48977fecc874f246798364c2ef5ccc013.tar.gz
selftest: Add test for 'dfree cache'
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13446 Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit a55b3d2fcc2f7737a2702bf908dcf1f80969bf21)
Diffstat (limited to 'source3/script')
-rwxr-xr-xsource3/script/tests/test_dfree_quota.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/source3/script/tests/test_dfree_quota.sh b/source3/script/tests/test_dfree_quota.sh
index 6e227c4b5ad..abd82b46751 100755
--- a/source3/script/tests/test_dfree_quota.sh
+++ b/source3/script/tests/test_dfree_quota.sh
@@ -130,6 +130,35 @@ test_smbclient_dfree() {
return $status
}
+# Issue two queries to different directories in one session to test
+# caching effects
+test_smbclient_dfree_2() {
+ name="$1"
+ share="$2"
+ dir1="$3"
+ dir2="$4"
+ confs="$5"
+ expected="$6"
+ subunit_start_test "$name"
+ setup_conf $confs
+ output=$($VALGRIND $smbclient //$SERVER/$share \
+ -c "cd $dir1; du; cd ..; cd $dir2 ; du" $@ 2>&1)
+ status=$?
+ if [ "$status" = "0" ]; then
+ received=$(echo "$output" | \
+ awk '/blocks of size/ {print $1, $5, $6}' | \
+ tr '\n' ' ')
+ if [ "$expected" = "$received" ]; then
+ subunit_pass_test "$name"
+ else
+ echo "$output" | subunit_fail_test "$name"
+ fi
+ else
+ echo "$output" | subunit_fail_test "$name"
+ fi
+ return $status
+}
+
test_smbcquotas() {
name="$1"
conf="$2"
@@ -164,6 +193,12 @@ test_smbclient_dfree "Test large disk" dfq "." "conf3 ." "1125899906842624 1024.
#basic quota test (SMB1 only)
test_smbcquotas "Test user quota" confq1 $USERNAME "40960/4096000/3072000" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=NT1 || failed=`expr $failed + 1`
+# Test dfree cache through queries in two different directories
+test_smbclient_dfree_2 "Test dfree cache" dfq_cache "." "subdir1" \
+ "conf1 . conf2 subdir1" "10 1024. 5 20 1024. 10 " \
+ -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 \
+ || failed=`expr $failed + 1`
+
#quota limit > disk size, remaining quota > disk free
test_smbclient_dfree "Test dfree share root df vs quota case 1" dfq "." "confdfq1 ." "80 1024. 40" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`
#quota limit > disk size, remaining quota < disk free