github.com/jdgcs/sqlite3@v1.12.1-0.20210908114423-bc5f96e4dd51/testdata/tcl/releasetest_data.tcl (about) 1 # 2019 August 01 2 # 3 # The author disclaims copyright to this source code. In place of 4 # a legal notice, here is a blessing: 5 # 6 # May you do good and not evil. 7 # May you find forgiveness for yourself and forgive others. 8 # May you share freely, never taking more than you give. 9 # 10 #*********************************************************************** 11 # 12 # This file implements a program that produces scripts (either shell scripts 13 # or batch files) to implement a particular test that is part of the SQLite 14 # release testing procedure. For example, to run veryquick.test with a 15 # specified set of -D compiler switches. 16 # 17 # A "configuration" is a set of options passed to [./configure] and [make] 18 # to build the SQLite library in a particular fashion. A "platform" is a 19 # list of tests; most platforms are named after the hardware/OS platform 20 # that the tests will be run on as part of the release procedure. Each 21 # "test" is a combination of a configuration and a makefile target (e.g. 22 # "fulltest"). The program may be invoked as follows: 23 # 24 set USAGE { 25 $argv0 platforms 26 List available platforms. 27 28 $argv0 tests ?-nodebug? PLATFORM 29 List tests in a specified platform. If the -nodebug switch is 30 specified, synthetic debug/ndebug configurations are omitted. Each 31 test is a combination of a configuration and a makefile target. 32 33 $argv0 script ?-msvc? CONFIGURATION TARGET 34 Given a configuration and make target, return a bash (or, if -msvc 35 is specified, batch) script to execute the test. The first argument 36 passed to the script must be a directory containing SQLite source code. 37 38 $argv0 configurations 39 List available configurations. 40 } 41 42 # Omit comments (text between # and \n) in a long multi-line string. 43 # 44 proc strip_comments {in} { 45 regsub -all {#[^\n]*\n} $in {} out 46 return $out 47 } 48 49 array set ::Configs [strip_comments { 50 "Default" { 51 -O2 52 --disable-amalgamation --disable-shared 53 --enable-session 54 } 55 "Sanitize" { 56 CC=clang -fsanitize=address,undefined 57 -DSQLITE_ENABLE_STAT4 58 -DCONFIG_SLOWDOWN_FACTOR=5.0 59 --enable-debug 60 --enable-all 61 } 62 "Stdcall" { 63 -DUSE_STDCALL=1 64 -O2 65 } 66 "Have-Not" { 67 # The "Have-Not" configuration sets all possible -UHAVE_feature options 68 # in order to verify that the code works even on platforms that lack 69 # these support services. 70 -DHAVE_FDATASYNC=0 71 -DHAVE_GMTIME_R=0 72 -DHAVE_ISNAN=0 73 -DHAVE_LOCALTIME_R=0 74 -DHAVE_LOCALTIME_S=0 75 -DHAVE_MALLOC_USABLE_SIZE=0 76 -DHAVE_STRCHRNUL=0 77 -DHAVE_USLEEP=0 78 -DHAVE_UTIME=0 79 } 80 "Unlock-Notify" { 81 -O2 82 -DSQLITE_ENABLE_UNLOCK_NOTIFY 83 -DSQLITE_THREADSAFE 84 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1 85 } 86 "User-Auth" { 87 -O2 88 -DSQLITE_USER_AUTHENTICATION=1 89 } 90 "Secure-Delete" { 91 -O2 92 -DSQLITE_SECURE_DELETE=1 93 -DSQLITE_SOUNDEX=1 94 } 95 "Update-Delete-Limit" { 96 -O2 97 -DSQLITE_DEFAULT_FILE_FORMAT=4 98 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 99 -DSQLITE_ENABLE_STMT_SCANSTATUS 100 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS 101 -DSQLITE_ENABLE_CURSOR_HINTS 102 --enable-json1 103 } 104 "Check-Symbols" { 105 -DSQLITE_MEMDEBUG=1 106 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 107 -DSQLITE_ENABLE_FTS3=1 108 -DSQLITE_ENABLE_RTREE=1 109 -DSQLITE_ENABLE_MEMSYS5=1 110 -DSQLITE_ENABLE_MEMSYS3=1 111 -DSQLITE_ENABLE_COLUMN_METADATA=1 112 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 113 -DSQLITE_SECURE_DELETE=1 114 -DSQLITE_SOUNDEX=1 115 -DSQLITE_ENABLE_ATOMIC_WRITE=1 116 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 117 -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1 118 -DSQLITE_ENABLE_STAT4 119 -DSQLITE_ENABLE_STMT_SCANSTATUS 120 --enable-json1 --enable-fts5 --enable-session 121 } 122 "Debug-One" { 123 --disable-shared 124 -O2 -funsigned-char 125 -DSQLITE_DEBUG=1 126 -DSQLITE_MEMDEBUG=1 127 -DSQLITE_MUTEX_NOOP=1 128 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1 129 -DSQLITE_ENABLE_FTS3=1 130 -DSQLITE_ENABLE_RTREE=1 131 -DSQLITE_ENABLE_MEMSYS5=1 132 -DSQLITE_ENABLE_COLUMN_METADATA=1 133 -DSQLITE_ENABLE_STAT4 134 -DSQLITE_ENABLE_HIDDEN_COLUMNS 135 -DSQLITE_MAX_ATTACHED=125 136 -DSQLITE_MUTATION_TEST 137 --enable-fts5 --enable-json1 138 } 139 "Debug-Two" { 140 -DSQLITE_DEFAULT_MEMSTATUS=0 141 -DSQLITE_MAX_EXPR_DEPTH=0 142 --enable-debug 143 } 144 "Fast-One" { 145 -O6 146 -DSQLITE_ENABLE_FTS4=1 147 -DSQLITE_ENABLE_RTREE=1 148 -DSQLITE_ENABLE_STAT4 149 -DSQLITE_ENABLE_RBU 150 -DSQLITE_MAX_ATTACHED=125 151 -DSQLITE_MAX_MMAP_SIZE=12884901888 152 -DLONGDOUBLE_TYPE=double 153 --enable-session 154 } 155 "Device-One" { 156 -O2 157 -DSQLITE_DEBUG=1 158 -DSQLITE_DEFAULT_AUTOVACUUM=1 159 -DSQLITE_DEFAULT_CACHE_SIZE=64 160 -DSQLITE_DEFAULT_PAGE_SIZE=1024 161 -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=32 162 -DSQLITE_DISABLE_LFS=1 163 -DSQLITE_ENABLE_ATOMIC_WRITE=1 164 -DSQLITE_ENABLE_IOTRACE=1 165 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 166 -DSQLITE_MAX_PAGE_SIZE=4096 167 -DSQLITE_OMIT_LOAD_EXTENSION=1 168 -DSQLITE_OMIT_PROGRESS_CALLBACK=1 169 -DSQLITE_OMIT_VIRTUALTABLE=1 170 -DSQLITE_ENABLE_HIDDEN_COLUMNS 171 -DSQLITE_TEMP_STORE=3 172 --enable-json1 173 } 174 "Device-Two" { 175 -DSQLITE_4_BYTE_ALIGNED_MALLOC=1 176 -DSQLITE_DEFAULT_AUTOVACUUM=1 177 -DSQLITE_DEFAULT_CACHE_SIZE=1000 178 -DSQLITE_DEFAULT_LOCKING_MODE=0 179 -DSQLITE_DEFAULT_PAGE_SIZE=1024 180 -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=1000 181 -DSQLITE_DISABLE_LFS=1 182 -DSQLITE_ENABLE_FTS3=1 183 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 184 -DSQLITE_ENABLE_RTREE=1 185 -DSQLITE_MAX_COMPOUND_SELECT=50 186 -DSQLITE_MAX_PAGE_SIZE=32768 187 -DSQLITE_OMIT_TRACE=1 188 -DSQLITE_TEMP_STORE=3 189 -DSQLITE_THREADSAFE=2 190 --enable-json1 --enable-fts5 --enable-session 191 } 192 "Locking-Style" { 193 -O2 194 -DSQLITE_ENABLE_LOCKING_STYLE=1 195 } 196 "Apple" { 197 -Os 198 -DHAVE_GMTIME_R=1 199 -DHAVE_ISNAN=1 200 -DHAVE_LOCALTIME_R=1 201 -DHAVE_PREAD=1 202 -DHAVE_PWRITE=1 203 -DHAVE_UTIME=1 204 -DSQLITE_DEFAULT_CACHE_SIZE=1000 205 -DSQLITE_DEFAULT_CKPTFULLFSYNC=1 206 -DSQLITE_DEFAULT_MEMSTATUS=1 207 -DSQLITE_DEFAULT_PAGE_SIZE=1024 208 -DSQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS=1 209 -DSQLITE_ENABLE_API_ARMOR=1 210 -DSQLITE_ENABLE_AUTO_PROFILE=1 211 -DSQLITE_ENABLE_FLOCKTIMEOUT=1 212 -DSQLITE_ENABLE_FTS3=1 213 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 214 -DSQLITE_ENABLE_FTS3_TOKENIZER=1 215 -DSQLITE_ENABLE_PERSIST_WAL=1 216 -DSQLITE_ENABLE_PURGEABLE_PCACHE=1 217 -DSQLITE_ENABLE_RTREE=1 218 -DSQLITE_ENABLE_SNAPSHOT=1 219 # -DSQLITE_ENABLE_SQLLOG=1 220 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 221 -DSQLITE_MAX_LENGTH=2147483645 222 -DSQLITE_MAX_VARIABLE_NUMBER=500000 223 # -DSQLITE_MEMDEBUG=1 224 -DSQLITE_NO_SYNC=1 225 -DSQLITE_OMIT_AUTORESET=1 226 -DSQLITE_OMIT_LOAD_EXTENSION=1 227 -DSQLITE_PREFER_PROXY_LOCKING=1 228 -DSQLITE_SERIES_CONSTRAINT_VERIFY=1 229 -DSQLITE_THREADSAFE=2 230 -DSQLITE_USE_URI=1 231 -DSQLITE_WRITE_WALFRAME_PREBUFFERED=1 232 -DUSE_GUARDED_FD=1 233 -DUSE_PREAD=1 234 --enable-json1 --enable-fts5 235 } 236 "Extra-Robustness" { 237 -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1 238 -DSQLITE_MAX_ATTACHED=62 239 } 240 "Devkit" { 241 -DSQLITE_DEFAULT_FILE_FORMAT=4 242 -DSQLITE_MAX_ATTACHED=30 243 -DSQLITE_ENABLE_COLUMN_METADATA 244 -DSQLITE_ENABLE_FTS4 245 -DSQLITE_ENABLE_FTS5 246 -DSQLITE_ENABLE_FTS4_PARENTHESIS 247 -DSQLITE_DISABLE_FTS4_DEFERRED 248 -DSQLITE_ENABLE_RTREE 249 --enable-json1 --enable-fts5 250 } 251 "No-lookaside" { 252 -DSQLITE_TEST_REALLOC_STRESS=1 253 -DSQLITE_OMIT_LOOKASIDE=1 254 } 255 "Valgrind" { 256 -DSQLITE_ENABLE_STAT4 257 -DSQLITE_ENABLE_FTS4 258 -DSQLITE_ENABLE_RTREE 259 -DSQLITE_ENABLE_HIDDEN_COLUMNS 260 -DCONFIG_SLOWDOWN_FACTOR=8.0 261 --enable-json1 262 } 263 264 "Windows-Memdebug" { 265 MEMDEBUG=1 266 DEBUG=3 267 } 268 "Windows-Win32Heap" { 269 WIN32HEAP=1 270 DEBUG=4 271 } 272 273 # The next group of configurations are used only by the 274 # Failure-Detection platform. They are all the same, but we need 275 # different names for them all so that they results appear in separate 276 # subdirectories. 277 # 278 Fail0 {-O0} 279 Fail2 {-O0} 280 Fail3 {-O0} 281 Fail4 {-O0} 282 FuzzFail1 {-O0} 283 FuzzFail2 {-O0} 284 }] 285 if {$tcl_platform(os)=="Darwin"} { 286 lappend Configs(Apple) -DSQLITE_ENABLE_LOCKING_STYLE=1 287 } 288 289 array set ::Platforms [strip_comments { 290 Linux-x86_64 { 291 "Check-Symbols*" checksymbols 292 "Fast-One" "QUICKTEST_INCLUDE=rbu.test fuzztest test" 293 "Debug-One" "mptest test" 294 "Debug-Two" "test" 295 "Have-Not" test 296 "Secure-Delete" test 297 "Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test" 298 "User-Auth" tcltest 299 "Update-Delete-Limit" test 300 "Extra-Robustness" test 301 "Device-Two" "threadtest test" 302 "No-lookaside" test 303 "Devkit" test 304 "Apple" test 305 "Sanitize" test 306 "Device-One" fulltest 307 "Default" "threadtest fulltest" 308 "Valgrind*" valgrindtest 309 } 310 Linux-i686 { 311 "Devkit" test 312 "Have-Not" test 313 "Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test" 314 "Device-One" test 315 "Device-Two" test 316 "Default" "threadtest fulltest" 317 } 318 Darwin-i386 { 319 "Locking-Style" "mptest test" 320 "Have-Not" test 321 "Apple" "threadtest fulltest" 322 } 323 Darwin-x86_64 { 324 "Locking-Style" "mptest test" 325 "Have-Not" test 326 "Apple" "threadtest fulltest" 327 } 328 "Windows NT-intel" { 329 "Stdcall" test 330 "Have-Not" test 331 "Windows-Memdebug*" test 332 "Windows-Win32Heap*" test 333 "Default" "mptest fulltestonly" 334 } 335 "Windows NT-amd64" { 336 "Stdcall" test 337 "Have-Not" test 338 "Windows-Memdebug*" test 339 "Windows-Win32Heap*" test 340 "Default" "mptest fulltestonly" 341 } 342 343 # The Failure-Detection platform runs various tests that deliberately 344 # fail. This is used as a test of this script to verify that this script 345 # correctly identifies failures. 346 # 347 Failure-Detection { 348 Fail0* "TEST_FAILURE=0 test" 349 Sanitize* "TEST_FAILURE=1 test" 350 Fail2* "TEST_FAILURE=2 valgrindtest" 351 Fail3* "TEST_FAILURE=3 valgrindtest" 352 Fail4* "TEST_FAILURE=4 test" 353 FuzzFail1* "TEST_FAILURE=5 test" 354 FuzzFail2* "TEST_FAILURE=5 valgrindtest" 355 } 356 }] 357 358 #-------------------------------------------------------------------------- 359 #-------------------------------------------------------------------------- 360 #-------------------------------------------------------------------------- 361 # End of configuration section. 362 #-------------------------------------------------------------------------- 363 #-------------------------------------------------------------------------- 364 #-------------------------------------------------------------------------- 365 366 # Configuration verification: Check that each entry in the list of configs 367 # specified for each platforms exists. 368 # 369 foreach {key value} [array get ::Platforms] { 370 foreach {v t} $value { 371 if {[string range $v end end]=="*"} { 372 set v [string range $v 0 end-1] 373 } 374 if {0==[info exists ::Configs($v)]} { 375 puts stderr "No such configuration: \"$v\"" 376 exit -1 377 } 378 } 379 } 380 381 proc usage {} { 382 global argv0 383 puts stderr [subst $::USAGE] 384 exit 1 385 } 386 387 proc is_prefix {p str min} { 388 set n [string length $p] 389 if {$n<$min} { return 0 } 390 if {[string range $str 0 [expr $n-1]]!=$p} { return 0 } 391 return 1 392 } 393 394 proc main_configurations {} { 395 foreach k [lsort [array names ::Configs]] { 396 puts $k 397 } 398 } 399 400 proc main_platforms {} { 401 foreach k [lsort [array names ::Platforms]] { 402 puts "\"$k\"" 403 } 404 } 405 406 proc main_script {args} { 407 set bMsvc 0 408 set nArg [llength $args] 409 if {$nArg==3} { 410 if {![is_prefix [lindex $args 0] -msvc 2]} usage 411 set bMsvc 1 412 } elseif {$nArg<2 || $nArg>3} { 413 usage 414 } 415 set config [lindex $args end-1] 416 set target [lindex $args end] 417 418 set opts [list] ;# OPTS value 419 set cflags [expr {$bMsvc ? "-Zi" : "-g"}] ;# CFLAGS value 420 set makeOpts [list] ;# Extra args for [make] 421 set configOpts [list] ;# Extra args for [configure] 422 423 if {$::tcl_platform(platform)=="windows" || $bMsvc} { 424 lappend opts -DSQLITE_OS_WIN=1 425 } else { 426 lappend opts -DSQLITE_OS_UNIX=1 427 } 428 429 # Figure out if this is a synthetic ndebug or debug configuration. 430 # 431 set bRemoveDebug 0 432 if {[string match *-ndebug $config]} { 433 set bRemoveDebug 1 434 set config [string range $config 0 end-7] 435 } 436 if {[string match *-debug $config]} { 437 lappend opts -DSQLITE_DEBUG 438 lappend opts -DSQLITE_EXTRA_IFNULLROW 439 set config [string range $config 0 end-6] 440 } 441 442 # Ensure that the named configuration exists. 443 # 444 if {![info exists ::Configs($config)]} { 445 puts stderr "No such config: $config" 446 exit 1 447 } 448 449 # Loop through the parameters of the nominated configuration, updating 450 # $opts, $cflags, $makeOpts and $configOpts along the way. Rules are as 451 # follows: 452 # 453 # 1. If the parameter begins with a "*", discard it. 454 # 455 # 2. If $bRemoveDebug is set and the parameter is -DSQLITE_DEBUG or 456 # -DSQLITE_DEBUG=1, discard it 457 # 458 # 3. If the parameter begins with "-D", add it to $opts. 459 # 460 # 4. If the parameter begins with "--" add it to $configOpts. Unless 461 # this command is preparing a script for MSVC - then add an 462 # equivalent to $makeOpts or $opts. 463 # 464 # 5. If the parameter begins with "-" add it to $cflags. If in MSVC 465 # mode and the parameter is an -O<integer> option, instead add 466 # an OPTIMIZATIONS=<integer> switch to $makeOpts. 467 # 468 # 6. If none of the above apply, add the parameter to $makeOpts 469 # 470 foreach param $::Configs($config) { 471 if {[string range $param 0 0]=="*"} continue 472 473 if {$bRemoveDebug} { 474 if {$param=="-DSQLITE_DEBUG" || $param=="-DSQLITE_DEBUG=1" 475 || $param=="-DSQLITE_MEMDEBUG" || $param=="-DSQLITE_MEMDEBUG=1" 476 } { 477 continue 478 } 479 } 480 481 if {[string range $param 0 1]=="-D"} { 482 lappend opts $param 483 continue 484 } 485 486 if {[string range $param 0 1]=="--"} { 487 if {$bMsvc} { 488 switch -- $param { 489 --disable-amalgamation { 490 lappend makeOpts USE_AMALGAMATION=0 491 } 492 --disable-shared { 493 lappend makeOpts USE_CRT_DLL=0 DYNAMIC_SHELL=0 494 } 495 --enable-fts5 { 496 lappend opts -DSQLITE_ENABLE_FTS5 497 } 498 --enable-json1 { 499 lappend opts -DSQLITE_ENABLE_JSON1 500 } 501 --enable-shared { 502 lappend makeOpts USE_CRT_DLL=1 DYNAMIC_SHELL=1 503 } 504 --enable-session { 505 lappend opts -DSQLITE_ENABLE_PREUPDATE_HOOK 506 lappend opts -DSQLITE_ENABLE_SESSION 507 } 508 default { 509 error "Cannot translate $param for MSVC" 510 } 511 } 512 } else { 513 lappend configOpts $param 514 } 515 516 continue 517 } 518 519 if {[string range $param 0 0]=="-"} { 520 if {$bMsvc && [regexp -- {^-O(\d+)$} $param -> level]} { 521 lappend makeOpts OPTIMIZATIONS=$level 522 } else { 523 lappend cflags $param 524 } 525 continue 526 } 527 528 lappend makeOpts $param 529 } 530 531 # Some configurations specify -DHAVE_USLEEP=0. For all others, add 532 # -DHAVE_USLEEP=1. 533 # 534 if {[lsearch $opts "-DHAVE_USLEEP=0"]<0} { 535 lappend opts -DHAVE_USLEEP=1 536 } 537 538 if {$bMsvc==0} { 539 puts {set -e} 540 puts {} 541 puts {if [ "$#" -ne 1 ] ; then} 542 puts { echo "Usage: $0 <sqlite-src-dir>" } 543 puts { exit -1 } 544 puts {fi } 545 puts {SRCDIR=$1} 546 puts {} 547 puts "TCL=\"[::tcl::pkgconfig get libdir,install]\"" 548 549 puts "\$SRCDIR/configure --with-tcl=\$TCL $configOpts" 550 puts {} 551 puts {OPTS=" -DSQLITE_NO_SYNC=1"} 552 foreach o $opts { 553 puts "OPTS=\"\$OPTS $o\"" 554 } 555 puts {} 556 puts "CFLAGS=\"$cflags\"" 557 puts {} 558 puts "make $target \"CFLAGS=\$CFLAGS\" \"OPTS=\$OPTS\" $makeOpts" 559 } else { 560 561 puts {set SRCDIR=%1} 562 set makecmd "nmake /f %SRCDIR%\\Makefile.msc TOP=%SRCDIR% $target " 563 append makecmd "\"CFLAGS=$cflags\" \"OPTS=$opts\" $makeOpts" 564 565 puts "set TMP=%CD%" 566 puts $makecmd 567 } 568 } 569 570 proc main_tests {args} { 571 set bNodebug 0 572 set nArg [llength $args] 573 if {$nArg==2} { 574 if {[is_prefix [lindex $args 0] -nodebug 2]} { 575 set bNodebug 1 576 } elseif {[is_prefix [lindex $args 0] -debug 2]} { 577 set bNodebug 0 578 } else usage 579 } elseif {$nArg==0 || $nArg>2} { 580 usage 581 } 582 set p [lindex $args end] 583 if {![info exists ::Platforms($p)]} { 584 puts stderr "No such platform: $p" 585 exit 1 586 } 587 588 foreach {config target} $::Platforms($p) { 589 set bNosynthetic 0 590 if {[string range $config end end]=="*"} { 591 set bNosynthetic 1 592 set config [string range $config 0 end-1] 593 } 594 puts "$config \"$target\"" 595 if {$bNodebug==0 && $bNosynthetic==0} { 596 set iHas [string first SQLITE_DEBUG $::Configs($config)] 597 set dtarget [list] 598 set iQTI [lsearch -glob $target QUICKTEST_*] 599 if {$iQTI>=0} { 600 lappend dtarget [lindex $target $iQTI] 601 } 602 if {[lsearch $target tcltest]>=0} { 603 lappend dtarget tcltest 604 } else { 605 lappend dtarget test 606 } 607 if {$iHas>=0} { 608 puts "$config-ndebug \"$dtarget\"" 609 } else { 610 puts "$config-debug \"$dtarget\"" 611 } 612 } 613 } 614 } 615 616 if {[llength $argv]==0} { usage } 617 set cmd [lindex $argv 0] 618 set n [expr [llength $argv]-1] 619 if {[string match ${cmd}* configurations] && $n==0} { 620 main_configurations 621 } elseif {[string match ${cmd}* script]} { 622 main_script {*}[lrange $argv 1 end] 623 } elseif {[string match ${cmd}* platforms] && $n==0} { 624 main_platforms 625 } elseif {[string match ${cmd}* tests]} { 626 main_tests {*}[lrange $argv 1 end] 627 } else { 628 usage 629 }