Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1028)

Unified Diff: third_party/sqlite/src/test/multiplex4.test

Issue 949043002: Add //third_party/sqlite to dirs_to_snapshot, remove net_sql.patch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/test/multiplex3.test ('k') | third_party/sqlite/src/test/nan.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/multiplex4.test
diff --git a/third_party/sqlite/src/test/multiplex4.test b/third_party/sqlite/src/test/multiplex4.test
new file mode 100644
index 0000000000000000000000000000000000000000..9c304c314dc77ab49ae2cab46dec35deb8ecbe6c
--- /dev/null
+++ b/third_party/sqlite/src/test/multiplex4.test
@@ -0,0 +1,114 @@
+# 2014-09-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 contains tests for the "truncate" option in the multiplexor.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+set ::testprefix multiplex4
+
+db close
+sqlite3_shutdown
+sqlite3_multiplex_initialize {} 0
+
+# delete all filesl with the base name of $basename
+#
+proc multiplex_delete_db {basename} {
+ foreach file [glob -nocomplain $basename.*] {
+ forcedelete $file
+ }
+}
+
+# Return a sorted list of all files with the base name of $basename.
+# Except, delete all text from the end of $basename through the NNN
+# suffix on the end of the filename.
+#
+proc multiplex_file_list {basename} {
+ set x {}
+ foreach file [glob -nocomplain $basename.*] {
+ regsub "^$basename\\..*(\\d\\d\\d)\$" $file $basename.\\1 file
+ lappend x $file
+ }
+ return [lsort $x]
+}
+
+do_test multiplex4-1.0 {
+ multiplex_delete_db mx4test
+ sqlite3 db {file:mx4test.db?chunksize=10&truncate=1} -uri 1 -vfs multiplex
+ db eval {
+ CREATE TABLE t1(x);
+ INSERT INTO t1(x) VALUES(randomblob(250000));
+ }
+ multiplex_file_list mx4test
+} {mx4test.001 mx4test.db}
+
+do_test multiplex4-1.1 {
+ db eval {
+ DELETE FROM t1;
+ VACUUM;
+ }
+ multiplex_file_list mx4test
+} {mx4test.db}
+
+do_test multiplex4-1.2 {
+ db eval {PRAGMA multiplex_truncate}
+} {on}
+do_test multiplex4-1.3 {
+ db eval {PRAGMA multiplex_truncate=off}
+} {off}
+do_test multiplex4-1.4 {
+ db eval {PRAGMA multiplex_truncate}
+} {off}
+do_test multiplex4-1.5 {
+ db eval {PRAGMA multiplex_truncate=on}
+} {on}
+do_test multiplex4-1.6 {
+ db eval {PRAGMA multiplex_truncate}
+} {on}
+do_test multiplex4-1.7 {
+ db eval {PRAGMA multiplex_truncate=0}
+} {off}
+do_test multiplex4-1.8 {
+ db eval {PRAGMA multiplex_truncate=1}
+} {on}
+do_test multiplex4-1.9 {
+ db eval {PRAGMA multiplex_truncate=0}
+} {off}
+
+do_test multiplex4-1.10 {
+ db eval {
+ INSERT INTO t1(x) VALUES(randomblob(250000));
+ }
+ multiplex_file_list mx4test
+} {mx4test.001 mx4test.db}
+
+do_test multiplex4-1.11 {
+ db eval {
+ DELETE FROM t1;
+ VACUUM;
+ }
+ multiplex_file_list mx4test
+} {mx4test.001 mx4test.db}
+
+do_test multiplex4-1.12 {
+ db eval {
+ PRAGMA multiplex_truncate=ON;
+ DROP TABLE t1;
+ VACUUM;
+ }
+ multiplex_file_list mx4test
+} {mx4test.db}
+
+catch { db close }
+forcedelete mx4test.db
+sqlite3_multiplex_shutdown
+finish_test
« no previous file with comments | « third_party/sqlite/src/test/multiplex3.test ('k') | third_party/sqlite/src/test/nan.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698