selftest: Add test for 'dfree cache'
authorChristof Schmitt <cs@samba.org>
Wed, 23 May 2018 18:25:42 +0000 (11:25 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 25 May 2018 20:52:12 +0000 (22:52 +0200)
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>
selftest/knownfail
source3/script/tests/test_dfree_quota.sh

index f718f4520736ff5998ca8550c9ee4162c0218b56..439d3f3a00623cfae5abe6cc23022d49a3041018 100644 (file)
 # 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\)
index 6e227c4b5ad8ff191b201d9444f3f89e0cd01679..abd82b46751f9c6dd3fe0d52cea861198420f68d 100755 (executable)
@@ -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