/ Check-in [ddb8d3e8]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix an file separator character issue with test_quota.c that was causing it to fail on windows.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ddb8d3e80df868bda0704feed31171fa055432b5
User & Date: drh 2011-08-25 03:38:31
Context
2011-08-25
13:46
Fix the SQLITE_DISABLE_DIRSYNC compile time option. check-in: 6deb3ea1 user: dan tags: trunk
03:38
Fix an file separator character issue with test_quota.c that was causing it to fail on windows. check-in: ddb8d3e8 user: drh tags: trunk
01:58
Cherrypick the [d4f6437f8d] change so that SQLITE_FCNTL_SIZE_HINT is always honored and never undone by memory pressure on windows. check-in: 67ff8d27 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test_quota.c.

   811    811     rc = gQuota.pOrigVfs->xFullPathname(gQuota.pOrigVfs, zFilename,
   812    812                                         gQuota.sThisVfs.mxPathname+1, zFull);
   813    813     if( rc==SQLITE_OK ){
   814    814       rc = quotaOpen(&gQuota.sThisVfs, zFull, fd, 
   815    815                      SQLITE_OPEN_READONLY | SQLITE_OPEN_MAIN_DB, &outFlags);
   816    816     }
   817    817     if( rc==SQLITE_OK ){
   818         -    quotaFileSize(fd, &iSize);
   819         -    quotaClose(fd);
          818  +    fd->pMethods->xFileSize(fd, &iSize);
          819  +    fd->pMethods->xClose(fd);
   820    820     }else if( rc==SQLITE_CANTOPEN ){
   821    821       quotaGroup *pGroup;
   822    822       quotaFile *pFile;
   823    823       quotaEnter();
   824    824       pGroup = quotaGroupFind(zFull);
   825    825       if( pGroup ){
   826    826         pFile = quotaFindFile(pGroup, zFull);

Changes to test/quota.test.

   332    332     sqlite3_quota_set A 1000 quota_callback
   333    333     sqlite3 db A
   334    334     sqlite3_quota_set A 0 quota_callback
   335    335     db close
   336    336     quota_list
   337    337   } {}
   338    338   
          339  +unset -nocomplain quotagroup
          340  +if {$tcl_platform(platform)=="windows"} {
          341  +  set quotagroup *\\quota-test-A?.db
          342  +} else {
          343  +  set quotagroup */quota-test-A?.db
          344  +} 
          345  +foreach file [glob -nocomplain quota-test-A*] {
          346  +  forcedelete $file
          347  +}
   339    348   do_test quota-4.4.1 {
   340    349     set ::quota {}
   341         -  sqlite3_quota_set */quota-test-A?.db 10000 quota_callback
          350  +  sqlite3_quota_set $::quotagroup 10000 quota_callback
   342    351     file delete -force ./quota-test-A1.db ./quota-test-A2.db
   343    352     sqlite3 db ./quota-test-A1.db
   344    353     db eval {
   345    354        CREATE TABLE t1(x);
   346    355        INSERT INTO t1 VALUES(randomblob(5000));
   347    356     }
   348    357     quota_list
   349         -} {*/quota-test-A?.db}
          358  +} [list $quotagroup]
   350    359   do_test quota-4.4.2 {
   351    360     expr {$::quota==""}
   352    361   } {1}
   353    362   do_test quota-4.4.3 {
   354    363     db close
   355    364     sqlite3 db ./quota-test-A2.db
   356    365     db eval {
   357    366        CREATE TABLE t1(x);
   358    367        INSERT INTO t1 VALUES(randomblob(5000));
   359    368     }
   360    369     quota_list
   361         -} {*/quota-test-A?.db}
          370  +} [list $quotagroup]
   362    371   do_test quota-4.4.4 {
   363    372     expr {$::quota!=""}
   364    373   } {1}
   365    374   do_test quota-4.4.5 {
   366    375     db close
   367         -  sqlite3_quota_set */quota-test-A?.db 0 {}
          376  +  sqlite3_quota_set $::quotagroup 0 {}
   368    377     sqlite3_quota_dump
   369    378   } {}
   370    379   do_test quota-4.4.6 {
   371         -  sqlite3_quota_set */quota-test-A?.db 10000 quota_callback
          380  +  sqlite3_quota_set $quotagroup 10000 quota_callback
   372    381     sqlite3 db quota-test-A1.db
   373    382     db eval {SELECT count(*) FROM sqlite_master}
   374         -  quota_size */quota-test-A?.db
          383  +  quota_size $quotagroup
   375    384   } [file size quota-test-A1.db]
   376    385   do_test quota-4.4.7 {
   377    386     sqlite3_quota_file quota-test-A2.db
   378         -  quota_size */quota-test-A?.db
          387  +  quota_size $::quotagroup
   379    388   } [expr {[file size quota-test-A1.db]+[file size quota-test-A2.db]}]
   380    389   
          390  +unset -nocomplain quotagroup
          391  +if {$tcl_platform(platform)=="windows"} {
          392  +  set quotagroup *\\quota-test-B*
          393  +} else {
          394  +  set quotagroup */quota-test-B*
          395  +} 
          396  +foreach file [glob -nocomplain quota-test-B*] {
          397  +  forcedelete $file
          398  +}
   381    399   do_test quota-4.5.1 {
   382         -  foreach file [glob -nocomplain quota-test-B*] {
   383         -    forcedelete $file
   384         -  }
   385         -  sqlite3_quota_set */quota-test-B* 100000 quota_callback
   386         -  quota_size */quota-test-B*
          400  +  sqlite3_quota_set $::quotagroup 100000 quota_callback
          401  +  quota_size $::quotagroup
   387    402   } {0}
   388    403   do_test quota-4.5.2 {
   389    404     sqlite3_quota_file quota-test-B1.txt
   390         -  quota_size */quota-test-B*
          405  +  quota_size $::quotagroup
   391    406   } {0}
   392    407   proc add_to_file {name n} {
   393    408     set out [open $name a]
   394    409     fconfigure $out -translation binary
   395    410     puts -nonewline $out [string repeat x $n]
   396    411     close $out
   397    412   }
   398    413   do_test quota-4.5.3 {
   399    414     add_to_file quota-test-B1.txt 123
   400    415     sqlite3_quota_file quota-test-B1.txt
   401         -  quota_size */quota-test-B*
          416  +  quota_size $::quotagroup
   402    417   } {123}
   403    418   do_test quota-4.5.4 {
   404    419     add_to_file quota-test-B2.txt 234
   405    420     sqlite3_quota_file quota-test-B2.txt
   406         -  quota_size */quota-test-B*
          421  +  quota_size $::quotagroup
   407    422   } {357}
   408    423   do_test quota-4.5.5 {
   409    424     add_to_file quota-test-B1.txt 2000
   410    425     sqlite3_quota_file quota-test-B1.txt
   411         -  quota_size */quota-test-B*
          426  +  quota_size $::quotagroup
   412    427   } {2357}
   413    428   do_test quota-4.5.6 {
   414    429     forcedelete quota-test-B1.txt
   415    430     sqlite3_quota_file quota-test-B1.txt
   416         -  quota_size */quota-test-B*
          431  +  quota_size $::quotagroup
   417    432   } {234}
   418    433   do_test quota-4.5.7 {
   419    434     forcedelete quota-test-B2.txt
   420    435     sqlite3_quota_file quota-test-B2.txt
   421         -  quota_size */quota-test-B*
          436  +  quota_size $::quotagroup
   422    437   } {0}
   423    438   do_test quota-4.5.8 {
   424    439     add_to_file quota-test-B3.txt 1234
   425    440     sqlite3_quota_file quota-test-B3.txt
   426         -  quota_size */quota-test-B*
          441  +  quota_size $::quotagroup
   427    442   } {1234}
   428    443   do_test quota-4.5.9 {
   429         -  sqlite3_quota_set */quota-test-B* 0 {}
   430         -  quota_size */quota-test-B*
          444  +  sqlite3_quota_set $quotagroup 0 {}
          445  +  quota_size $::quotagroup
   431    446   } {0}
   432    447   
   433    448   do_test quota-4.9.1 {
   434    449     db close
   435    450     sqlite3_quota_set A 1000 quota_callback
   436    451     sqlite3_quota_shutdown
   437    452   } {SQLITE_OK}