/ Check-in [3e1a2f66]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Minor improvements to the permutations.test script. Most notably, a command 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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3e1a2f6614eacb65e1dffe64c6292c809fc5808be2d9d7d103cfc57d7b32fcd9
User & Date: dan 2018-09-18 16:06:42
References
2018-11-07
11:56
Partially revert [3e1a2f661], as some test scripts require separate $presql and $dbconfig variables. check-in: cbf85284 user: dan tags: trunk
Context
2018-09-18
17:00
Enhance tester.tcl so that when "--malloctrace=1" is specified, the test generates self-contained Tcl scripts that present GUIs instead of *.sql files that require a separate program to interpret. check-in: de2e3cbd user: dan tags: trunk
16:06
Minor improvements to the permutations.test script. Most notably, a command 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. check-in: 3e1a2f66 user: dan tags: trunk
2018-09-17
20:47
Further optimizations to the UPDATE logic to avoid making changes to partial indexes if none of the columns mentioned in the WHERE clause are modified by the UPDATE. check-in: d1365a5b user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/permutations.test.

    43     43     }
    44     44     foreach {k v} $args {
    45     45       set o [array names options ${k}*]
    46     46       if {[llength $o]>1}  { error "ambiguous option: $k" }
    47     47       if {[llength $o]==0} { error "unknown option: $k" }
    48     48       set options([lindex $o 0]) $v
    49     49     }
           50  +
           51  +  # Transform "-presql" into a "dbconfig" script
           52  +  #
           53  +  if {[info exists options(-presql)]} {
           54  +    append options(-dbconfig) "\n\$::dbhandle eval { $options(-presql) }"
           55  +    unset options(-presql)
           56  +  }
    50     57   
    51     58     set     ::testspec($name) [array get options]
    52     59     lappend ::testsuitelist $name
    53     60   }
    54     61   
    55     62   #-------------------------------------------------------------------------
    56     63   # test_set ARGS...
................................................................................
   285    292   
   286    293   test_suite "window" -prefix "" -description {
   287    294     All window function related tests .
   288    295   } -files [
   289    296     test_set [glob -nocomplain $::testdir/window*.test]
   290    297   ]
   291    298   
   292         -test_suite "alter" -prefix "" -description {
   293         -  All ALTER function related tests .
   294         -} -files [
   295         -  test_set [glob -nocomplain $::testdir/alter*.test]
   296         -]
   297         -
   298    299   test_suite "lsm1" -prefix "" -description {
   299    300     All LSM1 tests.
   300    301   } -files [glob -nocomplain $::testdir/../ext/lsm1/test/*.test]
   301    302   
   302    303   test_suite "nofaultsim" -prefix "" -description {
   303    304     "Very" quick test suite. Runs in less than 5 minutes on a workstation. 
   304    305     This test suite is the same as the "quick" tests, except that some files
................................................................................
   556    557     sqlite3_initialize
   557    558     autoinstall_test_functions
   558    559   }
   559    560   
   560    561   test_suite "nomutex" -description {
   561    562     Tests run with the SQLITE_OPEN_MULTITHREADED flag passed to sqlite3_open().
   562    563   } -initialize {
   563         -  rename sqlite3 sqlite3_nomutex
   564         -  proc sqlite3 {args} {
   565         -    if {[string range [lindex $args 0] 0 0] ne "-"} {
   566         -      lappend args -fullmutex 0 -nomutex 1
   567         -    }
   568         -    uplevel [concat sqlite3_nomutex $args]
   569         -  }
          564  +  set ::G(perm:sqlite3_args) [list -fullmutex 0 -nomutex 1]
   570    565   } -files {
   571    566     delete.test   delete2.test  insert.test  rollback.test  select1.test
   572    567     select2.test  trans.test    update.test  vacuum.test    types.test
   573    568     types2.test   types3.test
   574         -} -shutdown {
   575         -  rename sqlite3 {}
   576         -  rename sqlite3_nomutex sqlite3
   577         -}
          569  +} 
   578    570   
   579    571   # Run some tests in SQLITE_CONFIG_MULTITHREAD mode.
   580    572   #
   581    573   test_suite "multithread" -description {
   582    574     Tests run in SQLITE_CONFIG_MULTITHREAD mode
   583    575   } -initialize {
   584    576     catch {db close}
................................................................................
   599    591   }
   600    592   
   601    593   # Run some tests in SQLITE_OPEN_FULLMUTEX mode.
   602    594   #
   603    595   test_suite "fullmutex" -description {
   604    596     Tests run in SQLITE_OPEN_FULLMUTEX mode
   605    597   } -initialize {
   606         -  rename sqlite3 sqlite3_fullmutex
   607         -  proc sqlite3 {args} {
   608         -    if {[string range [lindex $args 0] 0 0] ne "-"} {
   609         -      lappend args -nomutex 0 -fullmutex 1
   610         -    }
   611         -    uplevel [concat sqlite3_fullmutex $args]
   612         -  }
          598  +  set ::G(perm:sqlite3_args) [list -nomutex 0 -fullmutex 1]
   613    599   } -files {
   614    600     delete.test   delete2.test  insert.test  rollback.test  select1.test
   615    601     select2.test  trans.test    update.test  vacuum.test    types.test
   616    602     types2.test   types3.test
   617         -} -shutdown {
   618         -  rename sqlite3 {}
   619         -  rename sqlite3_fullmutex sqlite3
   620    603   }
   621    604   
   622    605   # Run some tests using the "onefile" demo.
   623    606   #
   624    607   test_suite "onefile" -description {
   625    608     Run some tests using the "test_onefile.c" demo
   626    609   } -initialize {
   627         -  rename sqlite3 sqlite3_onefile
   628         -  proc sqlite3 {args} {
   629         -    if {[string range [lindex $args 0] 0 0] ne "-"} {
   630         -      lappend args -vfs fs
   631         -    }
   632         -    uplevel [concat sqlite3_onefile $args]
   633         -  }
          610  +  set ::G(perm:sqlite3_args) [list -vfs fs]
   634    611   } -files {
   635    612     conflict.test  insert.test   insert2.test  insert3.test
   636    613     rollback.test  select1.test  select2.test  select3.test
   637         -} -shutdown {
   638         -  rename sqlite3 {}
   639         -  rename sqlite3_onefile sqlite3
   640    614   }
   641    615   
   642    616   # Run some tests using UTF-16 databases.
   643    617   #
   644    618   test_suite "utf16" -description {
   645    619     Run tests using UTF-16 databases
   646    620   } -presql {
................................................................................
   934    908   #   rename crashsql {}
   935    909   #   rename sa_crashsql crashsql
   936    910   # } -files crash.test
   937    911   
   938    912   test_suite "safe_append" -description {
   939    913     Run some tests on a SAFE_APPEND file-system.
   940    914   } -initialize {
   941         -  rename sqlite3 sqlite3_safeappend
   942         -  proc sqlite3 {args} {
   943         -    if {[string range [lindex $args 0] 0 0] ne "-"} {
   944         -      lappend args -vfs devsym
   945         -    }
   946         -    uplevel [concat sqlite3_safeappend $args]
   947         -  }
          915  +  set ::G(perm:sqlite3_args) [list -vfs devsym]
   948    916     sqlite3_simulate_device -char safe_append
   949         -} -shutdown {
   950         -  rename sqlite3 {}
   951         -  rename sqlite3_shutdown sqlite3
   952    917   } -files [
   953    918     test_set $::allquicktests shared_err.test -exclude async3.test
   954    919   ]
   955    920   
   956    921   # The set of tests to run on the alternative-pcache
   957    922   set perm-alt-pcache-testset {
   958    923     async.test
................................................................................
  1111   1076   # run_tests NAME OPTIONS
  1112   1077   #
  1113   1078   # where available options are:  
  1114   1079   #
  1115   1080   #       -description TITLE
  1116   1081   #       -initialize  SCRIPT
  1117   1082   #       -shutdown    SCRIPT
  1118         -#       -presql      SQL
  1119   1083   #       -files       LIST-OF-FILES
  1120   1084   #       -prefix      NAME
         1085  +#       -dbconfig    SCRIPT
  1121   1086   #
  1122   1087   proc run_tests {name args} {
         1088  +  set options(-initialize) ""
         1089  +  set options(-shutdown) ""
         1090  +  set options(-prefix) ""
         1091  +  set options(-dbconfig) ""
         1092  +
  1123   1093     array set options $args
  1124   1094   
  1125   1095     set ::G(perm:name)         $name
  1126   1096     set ::G(perm:prefix)       $options(-prefix)
  1127         -  set ::G(perm:presql)       $options(-presql)
  1128   1097     set ::G(isquick)           1
  1129   1098     set ::G(perm:dbconfig)     $options(-dbconfig)
  1130   1099   
  1131   1100     foreach file [lsort $options(-files)] {
  1132   1101       uplevel $options(-initialize)
  1133   1102       if {[file tail $file] == $file} { set file [file join $::testdir $file] }
  1134   1103       slave_test_file $file
  1135   1104       uplevel $options(-shutdown)
         1105  +
         1106  +    unset -nocomplain ::G(perm:sqlite3_args)
  1136   1107     }
  1137   1108   
  1138   1109     unset ::G(perm:name)
  1139   1110     unset ::G(perm:prefix)
  1140         -  unset ::G(perm:presql)
  1141   1111     unset ::G(perm:dbconfig)
  1142   1112   }
  1143   1113   
  1144   1114   proc run_test_suite {name} {
  1145   1115     if {[info exists ::testspec($name)]==0} {
  1146   1116       error "No such test suite: $name"
  1147   1117     }
................................................................................
  1148   1118     uplevel run_tests $name $::testspec($name)
  1149   1119   }
  1150   1120   
  1151   1121   proc help {} {
  1152   1122     puts "Usage: $::argv0 TESTSUITE ?TESTFILE?"
  1153   1123     puts ""
  1154   1124     puts "Available test-suites are:"
         1125  +
         1126  +  set iPos 0
  1155   1127     foreach k $::testsuitelist {
  1156         -    if {[info exists ::testspec($k)]==0} {
  1157         -      puts "         ----------------------------------------"
  1158         -      puts ""
  1159         -    } else {
  1160         -      array set o $::testspec($k)
  1161         -      puts "Test suite: \"$k\""
  1162         -      set d [string trim $o(-description)]
  1163         -      set d [regsub {\n *} $d "\n  "]
  1164         -      puts "  $d"
  1165         -      puts ""
         1128  +    if {[info exists ::testspec($k)]} {
         1129  +      switch $iPos {
         1130  +        0 {
         1131  +          puts ""
         1132  +          puts -nonewline "  [format %-30s $k]"
         1133  +        }
         1134  +
         1135  +        1 {
         1136  +          puts -nonewline [format %-30s $k]
         1137  +        }
         1138  +
         1139  +        2 {
         1140  +          puts -nonewline $k
         1141  +        }
         1142  +      }
         1143  +
         1144  +      set iPos [expr (($iPos+1) % 3)]
  1166   1145       }
  1167   1146     }
         1147  +  puts ""
  1168   1148     exit -1
  1169   1149   }
  1170   1150   
  1171   1151   if {[file tail $argv0] == "permutations.test"} {
  1172   1152     proc main {argv} {
  1173   1153       if {[llength $argv]==0} {
  1174   1154         help
  1175   1155       } else {
         1156  +
         1157  +      # See if the first argument is a named test-suite.
         1158  +      #
  1176   1159         set suite [file tail [lindex $argv 0]]
  1177         -      if {[info exists ::testspec($suite)]==0} help
         1160  +      if {[info exists ::testspec($suite)]} {
         1161  +        set S $::testspec($suite)
         1162  +        set i 1
         1163  +      } else {
         1164  +        set S [list]
         1165  +        set i 0
         1166  +      }
         1167  +
  1178   1168         set extra ""
  1179         -      if {[llength $argv]>1} { set extra [list -files [lrange $argv 1 end]] }
  1180         -      eval run_tests $suite $::testspec($suite) $extra
         1169  +      if {$i < [llength $argv] && [string range [lindex $argv $i] 0 0]!="-" } {
         1170  +        set files [list]
         1171  +        for {} {$i < [llength $argv]} {incr i} {
         1172  +          set pattern [string map {% *} [lindex $argv $i]]
         1173  +          if {[string range $pattern 0 0]=="-"} break
         1174  +          foreach f $::alltests {
         1175  +            set tail [file tail $f]
         1176  +            if {[lsearch $files $f]<0 && [string match $pattern $tail]} {
         1177  +              lappend files $f
         1178  +            }
         1179  +          }
         1180  +        }
         1181  +        set extra [list -files $files]
         1182  +      }
         1183  +
         1184  +      eval run_tests $suite $S $extra
  1181   1185       }
  1182   1186     }
  1183   1187     main $argv
  1184   1188     finish_test
  1185   1189   }