SQLite

Check-in [3e1a2f6614]
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
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3e1a2f6614eacb65e1dffe64c6292c809fc5808be2d9d7d103cfc57d7b32fcd9
User & Date: dan 2018-09-18 16:06:42.548
References
2018-11-07
11:56
Partially revert [3e1a2f661], as some test scripts require separate $presql and $dbconfig variables. (check-in: cbf85284be 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: de2e3cbd08 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: 3e1a2f6614 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: d1365a5bf0 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/permutations.test.
43
44
45
46
47
48
49







50
51
52
53
54
55
56
  }
  foreach {k v} $args {
    set o [array names options ${k}*]
    if {[llength $o]>1}  { error "ambiguous option: $k" }
    if {[llength $o]==0} { error "unknown option: $k" }
    set options([lindex $o 0]) $v
  }








  set     ::testspec($name) [array get options]
  lappend ::testsuitelist $name
}

#-------------------------------------------------------------------------
# test_set ARGS...







>
>
>
>
>
>
>







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
  }
  foreach {k v} $args {
    set o [array names options ${k}*]
    if {[llength $o]>1}  { error "ambiguous option: $k" }
    if {[llength $o]==0} { error "unknown option: $k" }
    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
}

#-------------------------------------------------------------------------
# test_set ARGS...
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304

test_suite "window" -prefix "" -description {
  All window function related tests .
} -files [
  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]

test_suite "nofaultsim" -prefix "" -description {
  "Very" quick test suite. Runs in less than 5 minutes on a workstation. 
  This test suite is the same as the "quick" tests, except that some files







<
<
<
<
<
<







292
293
294
295
296
297
298






299
300
301
302
303
304
305

test_suite "window" -prefix "" -description {
  All window function related tests .
} -files [
  test_set [glob -nocomplain $::testdir/window*.test]
]







test_suite "lsm1" -prefix "" -description {
  All LSM1 tests.
} -files [glob -nocomplain $::testdir/../ext/lsm1/test/*.test]

test_suite "nofaultsim" -prefix "" -description {
  "Very" quick test suite. Runs in less than 5 minutes on a workstation. 
  This test suite is the same as the "quick" tests, except that some files
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
  sqlite3_initialize
  autoinstall_test_functions
}

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]
  }
} -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.
#
test_suite "multithread" -description {
  Tests run in SQLITE_CONFIG_MULTITHREAD mode
} -initialize {
  catch {db close}







<
<
<
|
<
<
<




<
<
<
|







557
558
559
560
561
562
563



564



565
566
567
568



569
570
571
572
573
574
575
576
  sqlite3_initialize
  autoinstall_test_functions
}

test_suite "nomutex" -description {
  Tests run with the SQLITE_OPEN_MULTITHREADED flag passed to sqlite3_open().
} -initialize {



  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



} 

# Run some tests in SQLITE_CONFIG_MULTITHREAD mode.
#
test_suite "multithread" -description {
  Tests run in SQLITE_CONFIG_MULTITHREAD mode
} -initialize {
  catch {db close}
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
}

# Run some tests in SQLITE_OPEN_FULLMUTEX mode.
#
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]
  }
} -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.
#
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]
  }
} -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.
#
test_suite "utf16" -description {
  Run tests using UTF-16 databases
} -presql {







<
<
<
|
<
<
<




<
<
<







<
<
<
|
<
<
<



<
<
<







591
592
593
594
595
596
597



598



599
600
601
602



603
604
605
606
607
608
609



610



611
612
613



614
615
616
617
618
619
620
}

# Run some tests in SQLITE_OPEN_FULLMUTEX mode.
#
test_suite "fullmutex" -description {
  Tests run in SQLITE_OPEN_FULLMUTEX mode
} -initialize {



  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



}

# Run some tests using the "onefile" demo.
#
test_suite "onefile" -description {
  Run some tests using the "test_onefile.c" demo
} -initialize {



  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



}

# Run some tests using UTF-16 databases.
#
test_suite "utf16" -description {
  Run tests using UTF-16 databases
} -presql {
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
#   rename crashsql {}
#   rename sa_crashsql crashsql
# } -files crash.test

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]
  }
  sqlite3_simulate_device -char safe_append
} -shutdown {
  rename sqlite3 {}
  rename sqlite3_shutdown sqlite3
} -files [
  test_set $::allquicktests shared_err.test -exclude async3.test
]

# The set of tests to run on the alternative-pcache
set perm-alt-pcache-testset {
  async.test







<
<
<
|
<
<
<

<
<
<







908
909
910
911
912
913
914



915



916



917
918
919
920
921
922
923
#   rename crashsql {}
#   rename sa_crashsql crashsql
# } -files crash.test

test_suite "safe_append" -description {
  Run some tests on a SAFE_APPEND file-system.
} -initialize {



  set ::G(perm:sqlite3_args) [list -vfs devsym]



  sqlite3_simulate_device -char safe_append



} -files [
  test_set $::allquicktests shared_err.test -exclude async3.test
]

# The set of tests to run on the alternative-pcache
set perm-alt-pcache-testset {
  async.test
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120

1121
1122





1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135


1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154


1155
1156
1157


1158


1159
1160

1161

1162
1163

1164


1165

1166
1167

1168
1169
1170
1171
1172
1173
1174
1175



1176
1177







1178












1179


1180
1181
1182
1183
1184
1185
# run_tests NAME OPTIONS
#
# where available options are:  
#
#       -description TITLE
#       -initialize  SCRIPT
#       -shutdown    SCRIPT
#       -presql      SQL
#       -files       LIST-OF-FILES
#       -prefix      NAME

#
proc run_tests {name args} {





  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)

  foreach file [lsort $options(-files)] {
    uplevel $options(-initialize)
    if {[file tail $file] == $file} { set file [file join $::testdir $file] }
    slave_test_file $file
    uplevel $options(-shutdown)


  }

  unset ::G(perm:name)
  unset ::G(perm:prefix)
  unset ::G(perm:presql)
  unset ::G(perm:dbconfig)
}

proc run_test_suite {name} {
  if {[info exists ::testspec($name)]==0} {
    error "No such test suite: $name"
  }
  uplevel run_tests $name $::testspec($name)
}

proc help {} {
  puts "Usage: $::argv0 TESTSUITE ?TESTFILE?"
  puts ""
  puts "Available test-suites are:"


  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 ""

    }
  }

  exit -1
}

if {[file tail $argv0] == "permutations.test"} {
  proc main {argv} {
    if {[llength $argv]==0} {
      help
    } else {



      set suite [file tail [lindex $argv 0]]
      if {[info exists ::testspec($suite)]==0} help







      set extra ""












      if {[llength $argv]>1} { set extra [list -files [lrange $argv 1 end]] }


      eval run_tests $suite $::testspec($suite) $extra
    }
  }
  main $argv
  finish_test
}







<


>


>
>
>
>
>




<








>
>




<














>
>

|
<
>
>
|
>
>
|
<
>
|
>
|
<
>
|
>
>
|
>


>








>
>
>

|
>
>
>
>
>
>
>

>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
|





1076
1077
1078
1079
1080
1081
1082

1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096

1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110

1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128

1129
1130
1131
1132
1133
1134

1135
1136
1137
1138

1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
# run_tests NAME OPTIONS
#
# where available options are:  
#
#       -description TITLE
#       -initialize  SCRIPT
#       -shutdown    SCRIPT

#       -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(isquick)           1
  set ::G(perm:dbconfig)     $options(-dbconfig)

  foreach file [lsort $options(-files)] {
    uplevel $options(-initialize)
    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:dbconfig)
}

proc run_test_suite {name} {
  if {[info exists ::testspec($name)]==0} {
    error "No such test suite: $name"
  }
  uplevel run_tests $name $::testspec($name)
}

proc help {} {
  puts "Usage: $::argv0 TESTSUITE ?TESTFILE?"
  puts ""
  puts "Available test-suites are:"

  set iPos 0
  foreach k $::testsuitelist {
    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
}

if {[file tail $argv0] == "permutations.test"} {
  proc main {argv} {
    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)]} {
        set S $::testspec($suite)
        set i 1
      } else {
        set S [list]
        set i 0
      }

      set 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
  finish_test
}