]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Minor improvements to the permutations.test script. Most notably, a command
authordan <dan@noemail.net>
Tue, 18 Sep 2018 16:06:42 +0000 (16:06 +0000)
committerdan <dan@noemail.net>
Tue, 18 Sep 2018 16:06:42 +0000 (16:06 +0000)
like "permutations.test alter%" now runs all test scripts with names that
match the LIKE pattern "alter%". Or, say, "permutations wal alter%" to run all
alter% tests in wal mode.

FossilOrigin-Name: 3e1a2f6614eacb65e1dffe64c6292c809fc5808be2d9d7d103cfc57d7b32fcd9

manifest
manifest.uuid
test/permutations.test

index 9c48557b544a6fd16663bff97794d10886728ff1..d0a94caab8ba6b3614bedda7cf1855617472ca77 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Further\soptimizations\sto\sthe\sUPDATE\slogic\sto\savoid\smaking\schanges\sto\spartial\nindexes\sif\snone\sof\sthe\scolumns\smentioned\sin\sthe\sWHERE\sclause\sare\smodified\sby\nthe\sUPDATE.
-D 2018-09-17T20:47:38.243
+C Minor\simprovements\sto\sthe\spermutations.test\sscript.\sMost\snotably,\sa\scommand\nlike\s"permutations.test\salter%"\snow\sruns\sall\stest\sscripts\swith\snames\sthat\nmatch\sthe\sLIKE\spattern\s"alter%".\sOr,\ssay,\s"permutations\swal\salter%"\sto\srun\sall\nalter%\stests\sin\swal\smode.
+D 2018-09-18T16:06:42.548
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F Makefile.in 01e95208a78b57d056131382c493c963518f36da4c42b12a97eb324401b3a334
@@ -1166,7 +1166,7 @@ F test/parser1.test 391b9bf9a229547a129c61ac345ed1a6f5eb1854
 F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
 F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
 F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
-F test/permutations.test fdcb2d733fc21396e0300206023795463ba0d0ee5eda2042863b044933391da3
+F test/permutations.test 8749e292c8f7e98072049543da8c0fe60e1625f0a9f49068623060984c176bbf
 F test/pg_common.tcl 301ac19c1a52fd55166d26db929b3b89165c634d52b5f8ad76ea8cb06960db30
 F test/pragma.test 7c8cfc328a1717a95663cf8edb06c52ddfeaf97bb0aee69ae7457132e8d39e7d
 F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f
@@ -1766,7 +1766,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P c6c9585f294710829ca24b64d70a36fd9f409261dd0661367c6c4198cdbc4c81
-R 17f1502e8c93c85f4f8e209b4182086e
-U drh
-Z a90b83813b6e6eb9b8886f53647a06d4
+P d1365a5bf0ee2f145427b81d2a593f539c3ad4705d579478703c1f65ae5f80bf
+R 04fce42a1b99ed4e3f6aae31501aa2b5
+U dan
+Z 31ac11585131622d50cd5cff75846297
index 881e98b3eab506ccdacfa96153e83aa71621b3c7..7315abcf7391155c3f1f77c68f3c625ffe114ab1 100644 (file)
@@ -1 +1 @@
-d1365a5bf0ee2f145427b81d2a593f539c3ad4705d579478703c1f65ae5f80bf
\ No newline at end of file
+3e1a2f6614eacb65e1dffe64c6292c809fc5808be2d9d7d103cfc57d7b32fcd9
\ No newline at end of file
index f71b0b88e2e4ae19c074bd60d653b4a307016819..4940e34899aea37606ba54a5b950e210f3975835 100644 (file)
@@ -48,6 +48,13 @@ proc test_suite {name args} {
     set options([lindex $o 0]) $v
   }
 
+  # Transform "-presql" into a "dbconfig" script
+  #
+  if {[info exists options(-presql)]} {
+    append options(-dbconfig) "\n\$::dbhandle eval { $options(-presql) }"
+    unset options(-presql)
+  }
+
   set     ::testspec($name) [array get options]
   lappend ::testsuitelist $name
 }
@@ -289,12 +296,6 @@ test_suite "window" -prefix "" -description {
   test_set [glob -nocomplain $::testdir/window*.test]
 ]
 
-test_suite "alter" -prefix "" -description {
-  All ALTER function related tests .
-} -files [
-  test_set [glob -nocomplain $::testdir/alter*.test]
-]
-
 test_suite "lsm1" -prefix "" -description {
   All LSM1 tests.
 } -files [glob -nocomplain $::testdir/../ext/lsm1/test/*.test]
@@ -560,21 +561,12 @@ test_suite "singlethread" -description {
 test_suite "nomutex" -description {
   Tests run with the SQLITE_OPEN_MULTITHREADED flag passed to sqlite3_open().
 } -initialize {
-  rename sqlite3 sqlite3_nomutex
-  proc sqlite3 {args} {
-    if {[string range [lindex $args 0] 0 0] ne "-"} {
-      lappend args -fullmutex 0 -nomutex 1
-    }
-    uplevel [concat sqlite3_nomutex $args]
-  }
+  set ::G(perm:sqlite3_args) [list -fullmutex 0 -nomutex 1]
 } -files {
   delete.test   delete2.test  insert.test  rollback.test  select1.test
   select2.test  trans.test    update.test  vacuum.test    types.test
   types2.test   types3.test
-} -shutdown {
-  rename sqlite3 {}
-  rename sqlite3_nomutex sqlite3
-}
+} 
 
 # Run some tests in SQLITE_CONFIG_MULTITHREAD mode.
 #
@@ -603,20 +595,11 @@ test_suite "multithread" -description {
 test_suite "fullmutex" -description {
   Tests run in SQLITE_OPEN_FULLMUTEX mode
 } -initialize {
-  rename sqlite3 sqlite3_fullmutex
-  proc sqlite3 {args} {
-    if {[string range [lindex $args 0] 0 0] ne "-"} {
-      lappend args -nomutex 0 -fullmutex 1
-    }
-    uplevel [concat sqlite3_fullmutex $args]
-  }
+  set ::G(perm:sqlite3_args) [list -nomutex 0 -fullmutex 1]
 } -files {
   delete.test   delete2.test  insert.test  rollback.test  select1.test
   select2.test  trans.test    update.test  vacuum.test    types.test
   types2.test   types3.test
-} -shutdown {
-  rename sqlite3 {}
-  rename sqlite3_fullmutex sqlite3
 }
 
 # Run some tests using the "onefile" demo.
@@ -624,19 +607,10 @@ test_suite "fullmutex" -description {
 test_suite "onefile" -description {
   Run some tests using the "test_onefile.c" demo
 } -initialize {
-  rename sqlite3 sqlite3_onefile
-  proc sqlite3 {args} {
-    if {[string range [lindex $args 0] 0 0] ne "-"} {
-      lappend args -vfs fs
-    }
-    uplevel [concat sqlite3_onefile $args]
-  }
+  set ::G(perm:sqlite3_args) [list -vfs fs]
 } -files {
   conflict.test  insert.test   insert2.test  insert3.test
   rollback.test  select1.test  select2.test  select3.test
-} -shutdown {
-  rename sqlite3 {}
-  rename sqlite3_onefile sqlite3
 }
 
 # Run some tests using UTF-16 databases.
@@ -938,17 +912,8 @@ ifcapable threadsafe {
 test_suite "safe_append" -description {
   Run some tests on a SAFE_APPEND file-system.
 } -initialize {
-  rename sqlite3 sqlite3_safeappend
-  proc sqlite3 {args} {
-    if {[string range [lindex $args 0] 0 0] ne "-"} {
-      lappend args -vfs devsym
-    }
-    uplevel [concat sqlite3_safeappend $args]
-  }
+  set ::G(perm:sqlite3_args) [list -vfs devsym]
   sqlite3_simulate_device -char safe_append
-} -shutdown {
-  rename sqlite3 {}
-  rename sqlite3_shutdown sqlite3
 } -files [
   test_set $::allquicktests shared_err.test -exclude async3.test
 ]
@@ -1115,16 +1080,20 @@ test_suite "sorterref" -prefix "" -description {
 #       -description TITLE
 #       -initialize  SCRIPT
 #       -shutdown    SCRIPT
-#       -presql      SQL
 #       -files       LIST-OF-FILES
 #       -prefix      NAME
+#       -dbconfig    SCRIPT
 #
 proc run_tests {name args} {
+  set options(-initialize) ""
+  set options(-shutdown) ""
+  set options(-prefix) ""
+  set options(-dbconfig) ""
+
   array set options $args
 
   set ::G(perm:name)         $name
   set ::G(perm:prefix)       $options(-prefix)
-  set ::G(perm:presql)       $options(-presql)
   set ::G(isquick)           1
   set ::G(perm:dbconfig)     $options(-dbconfig)
 
@@ -1133,11 +1102,12 @@ proc run_tests {name args} {
     if {[file tail $file] == $file} { set file [file join $::testdir $file] }
     slave_test_file $file
     uplevel $options(-shutdown)
+
+    unset -nocomplain ::G(perm:sqlite3_args)
   }
 
   unset ::G(perm:name)
   unset ::G(perm:prefix)
-  unset ::G(perm:presql)
   unset ::G(perm:dbconfig)
 }
 
@@ -1152,19 +1122,29 @@ proc help {} {
   puts "Usage: $::argv0 TESTSUITE ?TESTFILE?"
   puts ""
   puts "Available test-suites are:"
+
+  set iPos 0
   foreach k $::testsuitelist {
-    if {[info exists ::testspec($k)]==0} {
-      puts "         ----------------------------------------"
-      puts ""
-    } else {
-      array set o $::testspec($k)
-      puts "Test suite: \"$k\""
-      set d [string trim $o(-description)]
-      set d [regsub {\n *} $d "\n  "]
-      puts "  $d"
-      puts ""
+    if {[info exists ::testspec($k)]} {
+      switch $iPos {
+        0 {
+          puts ""
+          puts -nonewline "  [format %-30s $k]"
+        }
+
+        1 {
+          puts -nonewline [format %-30s $k]
+        }
+
+        2 {
+          puts -nonewline $k
+        }
+      }
+
+      set iPos [expr (($iPos+1) % 3)]
     }
   }
+  puts ""
   exit -1
 }
 
@@ -1173,11 +1153,35 @@ if {[file tail $argv0] == "permutations.test"} {
     if {[llength $argv]==0} {
       help
     } else {
+
+      # See if the first argument is a named test-suite.
+      #
       set suite [file tail [lindex $argv 0]]
-      if {[info exists ::testspec($suite)]==0} help
+      if {[info exists ::testspec($suite)]} {
+        set S $::testspec($suite)
+        set i 1
+      } else {
+        set S [list]
+        set i 0
+      }
+
       set extra ""
-      if {[llength $argv]>1} { set extra [list -files [lrange $argv 1 end]] }
-      eval run_tests $suite $::testspec($suite) $extra
+      if {$i < [llength $argv] && [string range [lindex $argv $i] 0 0]!="-" } {
+        set files [list]
+        for {} {$i < [llength $argv]} {incr i} {
+          set pattern [string map {% *} [lindex $argv $i]]
+          if {[string range $pattern 0 0]=="-"} break
+          foreach f $::alltests {
+            set tail [file tail $f]
+            if {[lsearch $files $f]<0 && [string match $pattern $tail]} {
+              lappend files $f
+            }
+          }
+        }
+        set extra [list -files $files]
+      }
+
+      eval run_tests $suite $S $extra
     }
   }
   main $argv