/ Artifact Content
Login

Artifact 92b8bf8e298f1998abbbdd7be3d7a8998da3ce0752e6145e8b5dc3e1bafaa248:


# 2017 April 25
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is testing the server mode of SQLite.
#


set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix serverwal

# Check files are created and deleted as expected.
#
do_execsql_test 1.0 {
  PRAGMA journal_mode = wal;
} {wal}
do_execsql_test 1.1 {
  CREATE TABLE t1(a, b);
}
do_execsql_test 1.2 {
  SELECT * FROM t1;
} {}
do_test 1.3 {
  lsort [glob test.db*]
} {test.db test.db-hma test.db-shm test.db-wal}
do_test 1.4 {
  db close
  glob test.db*
} {test.db}

# Two concurrent transactions.
#
do_test 2.0 {
  sqlite3 db  test.db
  sqlite3 db2 test.db
  db eval {
    CREATE TABLE t2(a, b);
  }
} {}
do_test 2.1 {
  execsql {
    BEGIN;
      INSERT INTO t1 VALUES(1, 2);
  } db
  execsql {
    BEGIN;
      INSERT INTO t2 VALUES(1, 2);
  } db2
} {}
do_test 2.2 {
  execsql COMMIT db
  execsql COMMIT db2
} {}


finish_test