SQLite

Check-in [ddb8d3e80d]
Login

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
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ddb8d3e80df868bda0704feed31171fa055432b5
User & Date: drh 2011-08-25 03:38:31.807
Context
2011-08-25
13:46
Fix the SQLITE_DISABLE_DIRSYNC compile time option. (check-in: 6deb3ea1f0 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: ddb8d3e80d 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: 67ff8d27f6 user: drh tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/test_quota.c.
811
812
813
814
815
816
817
818
819


820
821
822
823
824
825
826
811
812
813
814
815
816
817


818
819
820
821
822
823
824
825
826







-
-
+
+







  rc = gQuota.pOrigVfs->xFullPathname(gQuota.pOrigVfs, zFilename,
                                      gQuota.sThisVfs.mxPathname+1, zFull);
  if( rc==SQLITE_OK ){
    rc = quotaOpen(&gQuota.sThisVfs, zFull, fd, 
                   SQLITE_OPEN_READONLY | SQLITE_OPEN_MAIN_DB, &outFlags);
  }
  if( rc==SQLITE_OK ){
    quotaFileSize(fd, &iSize);
    quotaClose(fd);
    fd->pMethods->xFileSize(fd, &iSize);
    fd->pMethods->xClose(fd);
  }else if( rc==SQLITE_CANTOPEN ){
    quotaGroup *pGroup;
    quotaFile *pFile;
    quotaEnter();
    pGroup = quotaGroupFind(zFull);
    if( pGroup ){
      pFile = quotaFindFile(pGroup, zFull);
Changes to test/quota.test.
332
333
334
335
336
337
338









339
340
341

342
343
344
345
346
347
348
349

350
351
352
353
354
355
356
357
358
359
360
361

362
363
364
365
366
367

368
369
370
371

372
373
374

375
376
377
378

379
380




381
382
383
384
385
386








387
388
389
390

391
392
393
394
395
396
397
398
399
400
401

402
403
404
405
406

407
408
409
410
411

412
413
414
415
416

417
418
419
420
421

422
423
424
425
426

427
428
429
430


431
432
433
434
435
436
437
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349

350
351
352
353
354
355
356
357

358
359
360
361
362
363
364
365
366
367
368
369

370
371
372
373
374
375

376
377
378
379

380
381
382

383
384
385
386

387
388
389
390
391
392
393






394
395
396
397
398
399
400
401
402
403
404

405
406
407
408
409
410
411
412
413
414
415

416
417
418
419
420

421
422
423
424
425

426
427
428
429
430

431
432
433
434
435

436
437
438
439
440

441
442
443


444
445
446
447
448
449
450
451
452







+
+
+
+
+
+
+
+
+


-
+







-
+











-
+





-
+



-
+


-
+



-
+


+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+



-
+










-
+




-
+




-
+




-
+




-
+




-
+


-
-
+
+







  sqlite3_quota_set A 1000 quota_callback
  sqlite3 db A
  sqlite3_quota_set A 0 quota_callback
  db close
  quota_list
} {}

unset -nocomplain quotagroup
if {$tcl_platform(platform)=="windows"} {
  set quotagroup *\\quota-test-A?.db
} else {
  set quotagroup */quota-test-A?.db
} 
foreach file [glob -nocomplain quota-test-A*] {
  forcedelete $file
}
do_test quota-4.4.1 {
  set ::quota {}
  sqlite3_quota_set */quota-test-A?.db 10000 quota_callback
  sqlite3_quota_set $::quotagroup 10000 quota_callback
  file delete -force ./quota-test-A1.db ./quota-test-A2.db
  sqlite3 db ./quota-test-A1.db
  db eval {
     CREATE TABLE t1(x);
     INSERT INTO t1 VALUES(randomblob(5000));
  }
  quota_list
} {*/quota-test-A?.db}
} [list $quotagroup]
do_test quota-4.4.2 {
  expr {$::quota==""}
} {1}
do_test quota-4.4.3 {
  db close
  sqlite3 db ./quota-test-A2.db
  db eval {
     CREATE TABLE t1(x);
     INSERT INTO t1 VALUES(randomblob(5000));
  }
  quota_list
} {*/quota-test-A?.db}
} [list $quotagroup]
do_test quota-4.4.4 {
  expr {$::quota!=""}
} {1}
do_test quota-4.4.5 {
  db close
  sqlite3_quota_set */quota-test-A?.db 0 {}
  sqlite3_quota_set $::quotagroup 0 {}
  sqlite3_quota_dump
} {}
do_test quota-4.4.6 {
  sqlite3_quota_set */quota-test-A?.db 10000 quota_callback
  sqlite3_quota_set $quotagroup 10000 quota_callback
  sqlite3 db quota-test-A1.db
  db eval {SELECT count(*) FROM sqlite_master}
  quota_size */quota-test-A?.db
  quota_size $quotagroup
} [file size quota-test-A1.db]
do_test quota-4.4.7 {
  sqlite3_quota_file quota-test-A2.db
  quota_size */quota-test-A?.db
  quota_size $::quotagroup
} [expr {[file size quota-test-A1.db]+[file size quota-test-A2.db]}]

unset -nocomplain quotagroup
if {$tcl_platform(platform)=="windows"} {
  set quotagroup *\\quota-test-B*
} else {
do_test quota-4.5.1 {
  foreach file [glob -nocomplain quota-test-B*] {
    forcedelete $file
  }
  sqlite3_quota_set */quota-test-B* 100000 quota_callback
  quota_size */quota-test-B*
  set quotagroup */quota-test-B*
} 
foreach file [glob -nocomplain quota-test-B*] {
  forcedelete $file
}
do_test quota-4.5.1 {
  sqlite3_quota_set $::quotagroup 100000 quota_callback
  quota_size $::quotagroup
} {0}
do_test quota-4.5.2 {
  sqlite3_quota_file quota-test-B1.txt
  quota_size */quota-test-B*
  quota_size $::quotagroup
} {0}
proc add_to_file {name n} {
  set out [open $name a]
  fconfigure $out -translation binary
  puts -nonewline $out [string repeat x $n]
  close $out
}
do_test quota-4.5.3 {
  add_to_file quota-test-B1.txt 123
  sqlite3_quota_file quota-test-B1.txt
  quota_size */quota-test-B*
  quota_size $::quotagroup
} {123}
do_test quota-4.5.4 {
  add_to_file quota-test-B2.txt 234
  sqlite3_quota_file quota-test-B2.txt
  quota_size */quota-test-B*
  quota_size $::quotagroup
} {357}
do_test quota-4.5.5 {
  add_to_file quota-test-B1.txt 2000
  sqlite3_quota_file quota-test-B1.txt
  quota_size */quota-test-B*
  quota_size $::quotagroup
} {2357}
do_test quota-4.5.6 {
  forcedelete quota-test-B1.txt
  sqlite3_quota_file quota-test-B1.txt
  quota_size */quota-test-B*
  quota_size $::quotagroup
} {234}
do_test quota-4.5.7 {
  forcedelete quota-test-B2.txt
  sqlite3_quota_file quota-test-B2.txt
  quota_size */quota-test-B*
  quota_size $::quotagroup
} {0}
do_test quota-4.5.8 {
  add_to_file quota-test-B3.txt 1234
  sqlite3_quota_file quota-test-B3.txt
  quota_size */quota-test-B*
  quota_size $::quotagroup
} {1234}
do_test quota-4.5.9 {
  sqlite3_quota_set */quota-test-B* 0 {}
  quota_size */quota-test-B*
  sqlite3_quota_set $quotagroup 0 {}
  quota_size $::quotagroup
} {0}

do_test quota-4.9.1 {
  db close
  sqlite3_quota_set A 1000 quota_callback
  sqlite3_quota_shutdown
} {SQLITE_OK}