1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

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>
This commit is contained in:
Christof Schmitt 2018-05-23 11:25:42 -07:00 committed by Jeremy Allison
parent 7ffcbd5ce1
commit a55b3d2fcc
2 changed files with 36 additions and 0 deletions

View File

@ -344,3 +344,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\)

View File

@ -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