📄 permutations.test
字号:
# 2008 June 21## 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.##***********************************************************************## $Id: permutations.test,v 1.27 2008/08/30 16:07:04 drh Exp $set testdir [file dirname $argv0]source $testdir/tester.tcl# Argument processing.##puts "PERM-DEBUG: argv=$argv"namespace eval ::perm { variable testmode [lindex $::argv 0] variable testfile [lindex $::argv 1]}set argv [lrange $argv 2 end]#puts "PERM-DEBUG: testmode=$::perm::testmode tstfile=$::perm::testfile"set ::permutations_presql ""set ::permutations_test_prefix ""if {$::perm::testmode eq "veryquick"} { set ::perm::testmode [list persistent_journal no_journal] set ISQUICK 1}if {$::perm::testmode eq "quick"} { set ::perm::testmode [list persistent_journal no_journal autovacuum_ioerr] set ISQUICK 1}if {$::perm::testmode eq "all" || $::perm::testmode eq ""} { set ::perm::testmode { memsubsys1 memsubsys2 singlethread multithread onefile utf16 exclusive persistent_journal persistent_journal_error no_journal no_journal_error autovacuum_ioerr no_mutex_try }}if {$::perm::testmode eq "targets"} { puts "" puts -nonewline "veryquick " puts "Same as persistent_journal and no_journal" puts -nonewline "quick " puts "Same as persistent_journal, no_journal and autovacuum_ioerr" puts -nonewline "all " puts "Everything except autovacuum_crash"}#puts "PERM-DEBUG: testmode=$::perm::testmode"set EXCLUDE { all.test in2.test onefile.test async2.test incrvacuum_ioerr.test permutations.test async.test jrnlmode2.test quick.test autovacuum_crash.test jrnlmode3.test shared_err.test autovacuum_ioerr.test jrnlmode4.test soak.test btree8.test loadext.test speed1p.test corrupt.test malloc2.test speed1.test crash2.test malloc3.test speed2.test crash3.test malloc4.test speed3.test crash4.test mallocAll.test speed4p.test crash6.test malloc.test speed4.test crash7.test memleak.test sqllimits1.test crash.test memsubsys1.test thread001.test exclusive3.test memsubsys2.test thread002.test fts3.test misc7.test utf16.test fuzz_malloc.test misuse.test veryquick.test fuzz.test mutex2.test vtab_err.test lookaside.test}set ALLTESTS [list]foreach filename [glob $testdir/*.test] { set filename [file tail $filename] if {[lsearch $EXCLUDE $filename] < 0} { lappend ALLTESTS $filename }}set ALLTESTS [lsort $ALLTESTS]rename finish_test really_finish_test2proc finish_test {} {}rename do_test really_do_testproc do_test {name args} { eval really_do_test [list "perm-$::permutations_test_prefix.$name"] $args}# Overload the [sqlite3] commandrename sqlite3 really_sqlite3proc sqlite3 {args} { set r [eval really_sqlite3 $args] if { [llength $args] == 2 && $::permutations_presql ne "" } { [lindex $args 0] eval $::permutations_presql } set r}# run_tests OPTIONS## where available options are: ## -initialize SCRIPT (default "")# -shutdown SCRIPT (default "")# -include LIST-OF-FILES (default $::ALLTESTS)# -exclude LIST-OF-FILES (default "")# -presql SQL (default "")# -description TITLE (default "")#proc run_tests {name args} { set ::permutations_test_prefix $name set options(-shutdown) "" set options(-initialize) "" set options(-exclude) "" set options(-include) $::ALLTESTS set options(-presql) "" set options(-description) "no description supplied (fixme)" array set options $args #puts "PERM-DEBUG: name=$name testfile=$::perm::testfile" #puts "PERM-DEBUG: [array get options]" if {$::perm::testmode eq "targets"} { puts [format "% -20s %s" $name [string trim $options(-description)]] return } if {$::perm::testmode ne "" && [lsearch $::perm::testmode $name]<0} { puts "skipping permutation test $name..." return } uplevel $options(-initialize) set ::permutations_presql $options(-presql) foreach file [lsort $options(-include)] { if {[lsearch $options(-exclude) $file] < 0 && ( $::perm::testfile eq "" || $::perm::testfile eq $file || "$::perm::testfile.test" eq $file ) } { set ::perm::shared_cache_setting [shared_cache_setting] uplevel source $::testdir/$file if {$::perm::shared_cache_setting ne [shared_cache_setting]} { error "File $::testdir/$file changed the shared cache setting from $::perm::shared_cache_setting to [shared_cache_setting]" } } else { # puts "skipping file $file" } } uplevel $options(-shutdown)}proc shared_cache_setting {} { set ret 0 catch { set ret [sqlite3_enable_shared_cache] } return $ret}############################################################################## Start of tests# Run some tests using pre-allocated page and scratch blocks.#run_tests "memsubsys1" -description { Tests using pre-allocated page and scratch blocks} -exclude { ioerr5.test malloc5.test} -initialize { catch {db close} sqlite3_shutdown sqlite3_config_pagecache 4096 24 sqlite3_config_scratch 25000 1 sqlite3_initialize} -shutdown { catch {db close} sqlite3_shutdown sqlite3_config_pagecache 0 0 sqlite3_config_scratch 0 0 sqlite3_initialize}# Run some tests using pre-allocated page and scratch blocks. This time# the allocations are too small to use in most cases.## Both ioerr5.test and malloc5.test are excluded because they test the# sqlite3_soft_heap_limit() and sqlite3_release_memory() functionality.# This functionality is disabled if a pre-allocated page block is provided.#run_tests "memsubsys2" -description { Tests using small pre-allocated page and scratch blocks} -exclude { ioerr5.test malloc5.test} -initialize { catch {db close} sqlite3_shutdown sqlite3_config_pagecache 512 5 sqlite3_config_scratch 1000 1 sqlite3_initialize} -shutdown { catch {db close} sqlite3_shutdown sqlite3_config_pagecache 0 0 sqlite3_config_scratch 0 0 sqlite3_initialize}# Run all tests with the lookaside allocator disabled.#run_tests "memsubsys3" -description { OOM tests with lookaside disabled} -include { malloc.test malloc3.test malloc4.test malloc5.test malloc6.test malloc7.test malloc8.test malloc9.test mallocA.test mallocB.test mallocC.test mallocD.test mallocE.test mallocF.test mallocG.test} -initialize { catch {db close} sqlite3_shutdown sqlite3_config_lookaside 0 0 sqlite3_initialize} -shutdown { catch {db close} sqlite3_shutdown sqlite3_config_lookaside 100 500 sqlite3_initialize}# Run some tests in SQLITE_CONFIG_SINGLETHREAD mode.#run_tests "singlethread" -description { Tests run in SQLITE_CONFIG_SINGLETHREAD mode} -initialize { do_test mutex2-singlethread.0 { catch {db close} sqlite3_shutdown sqlite3_config singlethread } SQLITE_OK} -include { 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 { do_test mutex2-X { catch {db close} sqlite3_shutdown sqlite3_config serialized } SQLITE_OK}run_tests "nomutex" -description { Tests run with the SQLITE_OPEN_SINGLETHREADED flag passed to sqlite3_open().} -initialize { rename sqlite3 sqlite3_nomutex proc sqlite3 {args} { if {[string range [lindex $args 0] 0 0] ne "-"} { lappend args -nomutex 1 } uplevel [concat sqlite3_nomutex $args] }} -include { 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.#run_tests "multithread" -description { Tests run in SQLITE_CONFIG_MULTITHREAD mode} -initialize { do_test mutex2-multithread.0 { catch {db close}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -