async3.test 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # 2007 September 5
  2. #
  3. # The author disclaims copyright to this source code. In place of
  4. # a legal notice, here is a blessing:
  5. #
  6. # May you do good and not evil.
  7. # May you find forgiveness for yourself and forgive others.
  8. # May you share freely, never taking more than you give.
  9. #
  10. #***********************************************************************
  11. #
  12. # The focus of this file is testing the code in test_async.c.
  13. # Specifically, it tests that the xFullPathname() method of
  14. # of the asynchronous vfs works correctly.
  15. #
  16. # $Id: async3.test,v 1.5 2009/04/25 08:39:15 danielk1977 Exp $
  17. set testdir [file dirname $argv0]
  18. source $testdir/tester.tcl
  19. if { [info commands sqlite3async_initialize]=="" } {
  20. # The async logic is not built into this system
  21. puts "Skipping async3 tests: not compiled with required features"
  22. finish_test
  23. return
  24. }
  25. db close
  26. sqlite3async_initialize "" 1
  27. #set sqlite3async_trace 1
  28. sqlite3async_start
  29. set paths {
  30. chocolate/banana/vanilla/file.db
  31. chocolate//banana/vanilla/file.db
  32. chocolate/./banana//vanilla/file.db
  33. chocolate/banana/./vanilla/file.db
  34. chocolate/banana/../banana/vanilla/file.db
  35. chocolate/banana/./vanilla/extra_bit/../file.db
  36. }
  37. do_test async3-1.0 {
  38. file mkdir [file join chocolate banana vanilla]
  39. forcedelete chocolate/banana/vanilla/file.db
  40. forcedelete chocolate/banana/vanilla/file.db-journal
  41. } {}
  42. do_test async3-1.1 {
  43. sqlite3 db chocolate/banana/vanilla/file.db
  44. execsql {
  45. CREATE TABLE abc(a, b, c);
  46. BEGIN;
  47. INSERT INTO abc VALUES(1, 2, 3);
  48. }
  49. } {}
  50. set N 2
  51. foreach p $paths {
  52. sqlite3 db2 $p
  53. do_test async3-1.$N.1 {
  54. execsql {SELECT * FROM abc} db2
  55. } {}
  56. do_test async3-1.$N.2 {
  57. catchsql {INSERT INTO abc VALUES(4, 5, 6)} db2
  58. } {1 {database is locked}}
  59. db2 close
  60. incr N
  61. }
  62. db close
  63. sqlite3async_control halt idle
  64. sqlite3async_wait
  65. sqlite3async_control halt never
  66. sqlite3async_shutdown
  67. finish_test