diff options
author | Christof Schmitt <cs@samba.org> | 2018-05-23 11:25:42 -0700 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2018-06-07 09:39:14 +0200 |
commit | 88d19df48977fecc874f246798364c2ef5ccc013 (patch) | |
tree | 854f64e1bd8429b85005552e332539cefe3cfaa9 | |
parent | 2e5bc85b3c67e8ccf81648e9d1260448369d5cf2 (diff) | |
download | samba-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)
-rw-r--r-- | selftest/knownfail | 1 | ||||
-rwxr-xr-x | source3/script/tests/test_dfree_quota.sh | 35 |
2 files changed, 36 insertions, 0 deletions
diff --git a/selftest/knownfail b/selftest/knownfail index 710fd33894e..0709b2dc616 100644 --- a/selftest/knownfail +++ b/selftest/knownfail @@ -343,3 +343,4 @@ # Disabling NTLM means you can't use samr to change the password ^samba.tests.ntlmdisabled.python\(ktest\).ntlmdisabled.NtlmDisabledTests.test_samr_change_password\(ktest\) ^samba.tests.ntlmdisabled.python\(ad_dc_no_ntlm\).ntlmdisabled.NtlmDisabledTests.test_ntlm_connection\(ad_dc_no_ntlm\) +^samba3.blackbox.dfree_quota \(fileserver\).Test dfree cache\(fileserver\) 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 |