Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch testrunner Excluding Merge-Ins
This is equivalent to a diff from 320a34c0 to 64631923
2023-08-28
| ||
20:14 | Updates to testrunner.tcl so that it runs fuzztest using multiple jobs. (check-in: ceeabe9f user: dan tags: trunk) | |
20:02 | Fix the "sdevtest" testrunner.tcl command so that it correctly enables asan on windows. (Closed-Leaf check-in: 64631923 user: dan tags: testrunner) | |
18:15 | Fixes for testrunner.tcl on windows. (check-in: 26ae0908 user: dan tags: testrunner) | |
2023-08-26
| ||
21:13 | Eliminate a superfluous JNI-internal middle-man class. (check-in: daede0f8 user: stephan tags: trunk) | |
21:04 | Updates to testrunner.tcl so that it runs "make fuzztest" using multiple jobs. (check-in: 7596ea70 user: dan tags: testrunner) | |
21:02 | Whether or not OOM is always fatal in JNI is now a compile-time option. (check-in: 320a34c0 user: stephan tags: trunk) | |
19:34 | Correct a string length misuse in JNI sqlite3_result_error() in an OOM case. Unrelated minor JNI cleanups. (check-in: 4252f56f user: stephan tags: trunk) | |
Changes to Makefile.in.
︙ | ︙ | |||
1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 | ./testfixture$(TEXE) $(TOP)/test/all.test -soak=1 $(TESTOPTS) # Do extra testing but not everything. fulltestonly: $(TESTPROGS) fuzztest ./testfixture$(TEXE) $(TOP)/test/full.test # Fuzz testing fuzztest: fuzzcheck$(TEXE) $(FUZZDATA) sessionfuzz$(TEXE) ./fuzzcheck$(TEXE) $(FUZZDATA) ./sessionfuzz$(TEXE) run $(TOP)/test/sessionfuzz-data1.db valgrindfuzz: fuzzcheck$(TEXT) $(FUZZDATA) sessionfuzz$(TEXE) valgrind ./fuzzcheck$(TEXE) --cell-size-check --limit-mem 10M $(FUZZDATA) valgrind ./sessionfuzz$(TEXE) run $(TOP)/test/sessionfuzz-data1.db | > > > > > > | 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 | ./testfixture$(TEXE) $(TOP)/test/all.test -soak=1 $(TESTOPTS) # Do extra testing but not everything. fulltestonly: $(TESTPROGS) fuzztest ./testfixture$(TEXE) $(TOP)/test/full.test # Fuzz testing # # WARNING: When the "fuzztest" target is run by the testrunner.tcl script, # it does not actually run this code. Instead, it schedules equivalent # commands. Therefore, if this target is updated, then code in # testrunner_data.tcl (search for "trd_fuzztest_data") must also be updated. # fuzztest: fuzzcheck$(TEXE) $(FUZZDATA) sessionfuzz$(TEXE) ./fuzzcheck$(TEXE) $(FUZZDATA) ./sessionfuzz$(TEXE) run $(TOP)/test/sessionfuzz-data1.db valgrindfuzz: fuzzcheck$(TEXT) $(FUZZDATA) sessionfuzz$(TEXE) valgrind ./fuzzcheck$(TEXE) --cell-size-check --limit-mem 10M $(FUZZDATA) valgrind ./sessionfuzz$(TEXE) run $(TOP)/test/sessionfuzz-data1.db |
︙ | ︙ |
Changes to ext/fts5/test/fts5optimize2.test.
1 2 3 4 5 6 7 8 9 10 11 | # 2014 Dec 20 # # 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. # #*********************************************************************** # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # 2014 Dec 20 # # 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. # #*********************************************************************** # # TESTRUNNER: superslow # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5optimize2 # If SQLITE_ENABLE_FTS5 is defined, omit this file. ifcapable !fts5 { |
︙ | ︙ | |||
38 39 40 41 42 43 44 | } } {} do_execsql_test 1.2 { SELECT count(*) FROM t1('mno') } $nLoop | < < < < < < < < < < < < < < < < < < < | 38 39 40 41 42 43 44 45 | } } {} do_execsql_test 1.2 { SELECT count(*) FROM t1('mno') } $nLoop finish_test |
Added ext/fts5/test/fts5optimize3.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | # 2023 Aug 27 # # 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. # #*********************************************************************** # # TESTRUNNER: superslow # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5optimize2 # If SQLITE_ENABLE_FTS5 is defined, omit this file. ifcapable !fts5 { finish_test return } set nLoop 2500 do_execsql_test 1.0 { CREATE VIRTUAL TABLE t2 USING fts5(x); INSERT INTO t2(t2, rank) VALUES('pgsz', 32); } do_test 1.1 { for {set ii 0} {$ii < $nLoop} {incr ii} { execsql { INSERT INTO t2 VALUES('abc def ghi'); INSERT INTO t2 VALUES('jkl mno pqr'); INSERT INTO t2(t2, rank) VALUES('merge', -1); } } } {} do_execsql_test 1.2 { SELECT count(*) FROM t2('mno') } $nLoop finish_test |
Changes to test/testrunner.tcl.
︙ | ︙ | |||
55 56 57 58 59 60 61 | $a0 ?SWITCHES? ?PERMUTATION? ?PATTERNS? $a0 PERMUTATION FILE $a0 njob ?NJOB? $a0 status where SWITCHES are: --jobs NUMBER-OF-JOBS | < | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | $a0 ?SWITCHES? ?PERMUTATION? ?PATTERNS? $a0 PERMUTATION FILE $a0 njob ?NJOB? $a0 status where SWITCHES are: --jobs NUMBER-OF-JOBS --zipvfs ZIPVFS-SOURCE-DIR Interesting values for PERMUTATION are: veryquick - a fast subset of the tcl test scripts. This is the default. full - all tcl test scripts. all - all tcl test scripts, plus a subset of test scripts rerun |
︙ | ︙ | |||
79 80 81 82 83 84 85 | and other tests are run as part of the "release" permutation. These are omitted if any PATTERN arguments are specified on the command line. If a PERMUTATION is specified and is followed by the path to a Tcl script instead of a list of patterns, then that single Tcl test script is run with the specified permutation. | < < < < < | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | and other tests are run as part of the "release" permutation. These are omitted if any PATTERN arguments are specified on the command line. If a PERMUTATION is specified and is followed by the path to a Tcl script instead of a list of patterns, then that single Tcl test script is run with the specified permutation. The "status" and "njob" commands are designed to be run from the same directory as a running testrunner.tcl script that is running tests. The "status" command prints a report describing the current state and progress of the tests. The "njob" command may be used to query or modify the number of sub-processes the test script uses to run tests. }]] |
︙ | ︙ | |||
153 154 155 156 157 158 159 | set TRG(cmdline) $argv set TRG(reporttime) 2000 set TRG(fuzztest) 0 ;# is the fuzztest option present. set TRG(zipvfs) "" ;# -zipvfs option, if any switch -nocase -glob -- $tcl_platform(os) { *darwin* { | | | | > > > | | | > > > | | | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > | | | > | > > > < | < < < | | | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | set TRG(cmdline) $argv set TRG(reporttime) 2000 set TRG(fuzztest) 0 ;# is the fuzztest option present. set TRG(zipvfs) "" ;# -zipvfs option, if any switch -nocase -glob -- $tcl_platform(os) { *darwin* { set TRG(platform) osx set TRG(make) make.sh set TRG(makecmd) "bash make.sh" set TRG(testfixture) testfixture set TRG(run) run.sh set TRG(runcmd) "bash run.sh" } *linux* { set TRG(platform) linux set TRG(make) make.sh set TRG(makecmd) "bash make.sh" set TRG(testfixture) testfixture set TRG(run) run.sh set TRG(runcmd) "bash run.sh" } *win* { set TRG(platform) win set TRG(make) make.bat set TRG(makecmd) make.bat set TRG(testfixture) testfixture.exe set TRG(run) run.bat set TRG(runcmd) "run.bat" } default { error "cannot determine platform!" } } #------------------------------------------------------------------------- #------------------------------------------------------------------------- # The database schema used by the testrunner.db database. # set TRG(schema) { DROP TABLE IF EXISTS jobs; DROP TABLE IF EXISTS config; /* ** This table contains one row for each job that testrunner.tcl must run ** before the entire test run is finished. ** ** jobid: ** Unique identifier for each job. Must be a +ve non-zero number. ** ** displaytype: ** 3 or 4 letter mnemonic for the class of tests this belongs to e.g. ** "fuzz", "tcl", "make" etc. ** ** displayname: ** Name/description of job. For display purposes. ** ** build: ** If the job requires a make.bat/make.sh make wrapper (i.e. to build ** something), the name of the build configuration it uses. See ** testrunner_data.tcl for a list of build configs. e.g. "Win32-MemDebug". ** ** dirname: ** If the job should use a well-known directory name for its ** sub-directory instead of an anonymous "testdir[1234...]" sub-dir ** that is deleted after the job is finished. ** ** cmd: ** Bash or batch script to run the job. ** ** depid: ** The jobid value of a job that this job depends on. This job may not ** be run before its depid job has finished successfully. ** ** priority: ** Higher values run first. Sometimes. */ CREATE TABLE jobs( /* Fields populated when db is initialized */ jobid INTEGER PRIMARY KEY, -- id to identify job displaytype TEXT NOT NULL, -- Type of test (for one line report) displayname TEXT NOT NULL, -- Human readable job name build TEXT NOT NULL DEFAULT '', -- make.sh/make.bat file request, if any dirname TEXT NOT NULL DEFAULT '', -- directory name, if required cmd TEXT NOT NULL, -- shell command to run depid INTEGER, -- identifier of dependency (or '') priority INTEGER NOT NULL, -- higher priority jobs may run earlier /* Fields updated as jobs run */ starttime INTEGER, endtime INTEGER, state TEXT CHECK( state IN ('', 'ready', 'running', 'done', 'failed') ), output TEXT ); CREATE TABLE config( name TEXT COLLATE nocase PRIMARY KEY, value ) WITHOUT ROWID; CREATE INDEX i1 ON jobs(state, priority); CREATE INDEX i2 ON jobs(depid); } #------------------------------------------------------------------------- #-------------------------------------------------------------------------- # Check if this script is being invoked to run a single file. If so, # run it. # |
︙ | ︙ | |||
299 300 301 302 303 304 305 | #-------------------------------------------------------------------------- # Check if this is the "status" command: # if {[llength $argv]==1 && [string compare -nocase status [lindex $argv 0]]==0 } { | | < < | < < < < < < < | < | < < < < < < < < < < < < < | < < | | | < | | | < | | < < | 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | #-------------------------------------------------------------------------- # Check if this is the "status" command: # if {[llength $argv]==1 && [string compare -nocase status [lindex $argv 0]]==0 } { proc display_job {jobdict {tm ""}} { array set job $jobdict set dfname [format %-60s $job(displayname)] set dtm "" if {$tm!=""} { set dtm "\[[expr {$tm-$job(starttime)}]ms\]" } puts " $dfname $dtm" } sqlite3 mydb $TRG(dbname) mydb timeout 1000 mydb eval BEGIN set cmdline [mydb one { SELECT value FROM config WHERE name='cmdline' }] set nJob [mydb one { SELECT value FROM config WHERE name='njob' }] set now [clock_milliseconds] set tm [mydb one { SELECT COALESCE((SELECT value FROM config WHERE name='end'), $now) - (SELECT value FROM config WHERE name='start') }] set total 0 foreach s {"" ready running done failed} { set S($s) 0 } mydb eval { SELECT state, count(*) AS cnt FROM jobs GROUP BY 1 } { incr S($state) $cnt incr total $cnt } set fin [expr $S(done)+$S(failed)] if {$cmdline!=""} {set cmdline " $cmdline"} set f "" if {$S(failed)>0} { set f "$S(failed) FAILED, " } puts "Command line: \[testrunner.tcl$cmdline\]" puts "Jobs: $nJob" puts "Summary: ${tm}ms, ($fin/$total) finished, ${f}$S(running) running" set srcdir [file dirname [file dirname $TRG(info_script)]] if {$S(running)>0} { puts "Running: " mydb eval { SELECT * FROM jobs WHERE state='running' ORDER BY starttime } job { display_job [array get job] $now } } if {$S(failed)>0} { puts "Failures: " mydb eval { SELECT * FROM jobs WHERE state='failed' ORDER BY starttime } job { display_job [array get job] } } mydb close exit } #------------------------------------------------------------------------- # Parse the command line. # for {set ii 0} {$ii < [llength $argv]} {incr ii} { set isLast [expr $ii==([llength $argv]-1)] set a [lindex $argv $ii] set n [string length $a] if {[string range $a 0 0]=="-"} { if {($n>2 && [string match "$a*" --jobs]) || $a=="-j"} { incr ii set TRG(nJob) [lindex $argv $ii] if {$isLast} { usage } } elseif {($n>2 && [string match "$a*" --zipvfs]) || $a=="-z"} { incr ii set TRG(zipvfs) [lindex $argv $ii] if {$isLast} { usage } } else { usage } |
︙ | ︙ | |||
476 477 478 479 480 481 482 | set dir [file normalize $dir] catch { file mkdir $dir } foreach f [glob -nocomplain [file join $dir *]] { catch { file delete -force $f } } } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | set dir [file normalize $dir] catch { file mkdir $dir } foreach f [glob -nocomplain [file join $dir *]] { catch { file delete -force $f } } } proc build_to_dirname {bname} { set fold [string tolower [string map {- _} $bname]] return "testrunner_build_$fold" } #------------------------------------------------------------------------- proc r_write_db {tcl} { trdb eval { BEGIN EXCLUSIVE } uplevel $tcl trdb eval { COMMIT } } |
︙ | ︙ | |||
611 612 613 614 615 616 617 618 | if {($iJob%2)} { set orderby "ORDER BY priority ASC" } else { set orderby "ORDER BY priority DESC" } r_write_db { | > > | < > > | < < < < < < < < < < > > | | < > > | < | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < < < < < < < < < < < < | < < < < < < < < < | | | < | | < < | < | < | | | < < < > | | < < < | < < > | | < | < < < < | | < < < < < < < < < > > > | | > | > | | < < < | < | 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 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 585 586 587 588 589 590 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 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 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 | if {($iJob%2)} { set orderby "ORDER BY priority ASC" } else { set orderby "ORDER BY priority DESC" } set ret [list] r_write_db { set query " SELECT * FROM jobs AS j WHERE state='ready' $orderby LIMIT 1 " trdb eval $query job { set tm [clock_milliseconds] set T($iJob) $tm set jobid $job(jobid) trdb eval { UPDATE jobs SET starttime=$tm, state='running' WHERE jobid=$jobid } set ret [array get job] } } return $ret } #rename r_get_next_job r_get_next_job_r #proc r_get_next_job {iJob} { #puts [time { set res [r_get_next_job_r $iJob] }] #set res #} # Usage: # # add_job OPTION ARG OPTION ARG... # # where available OPTIONS are: # # -displaytype # -displayname # -build # -dirname # -cmd # -depid # -priority # # Returns the jobid value for the new job. # proc add_job {args} { set options { -displaytype -displayname -build -dirname -cmd -depid -priority } # Set default values of options. set A(-dirname) "" set A(-depid) "" set A(-priority) 0 set A(-build) "" array set A $args # Check all required options are present. And that no extras are present. foreach o $options { if {[info exists A($o)]==0} { error "missing required option $o" } } foreach o [array names A] { if {[lsearch -exact $options $o]<0} { error "unrecognized option: $o" } } set state "" if {$A(-depid)==""} { set state ready } trdb eval { INSERT INTO jobs( displaytype, displayname, build, dirname, cmd, depid, priority, state ) VALUES ( $A(-displaytype), $A(-displayname), $A(-build), $A(-dirname), $A(-cmd), $A(-depid), $A(-priority), $state ) } trdb last_insert_rowid } proc add_tcl_jobs {build config patternlist} { global TRG set topdir [file dirname $::testdir] set testrunner_tcl [file normalize [info script]] if {$build==""} { set testfixture [info nameofexec] } else { set testfixture [file join [lindex $build 1] $TRG(testfixture)] } if {[lindex $build 2]=="Valgrind"} { set setvar "export OMIT_MISUSE=1\n" set testfixture "${setvar}valgrind -v --error-exitcode=1 $testfixture" } # The ::testspec array is populated by permutations.test foreach f [dict get $::testspec($config) -files] { if {[llength $patternlist]>0} { set bMatch 0 foreach p $patternlist { if {[string match $p [file tail $f]]} { set bMatch 1 break } } if {$bMatch==0} continue } if {[file pathtype $f]!="absolute"} { set f [file join $::testdir $f] } set f [file normalize $f] set displayname [string map [list $topdir/ {}] $f] if {$config=="full" || $config=="veryquick"} { set cmd "$testfixture $f" } else { set cmd "$testfixture $testrunner_tcl $config $f" set displayname "config=$config $displayname" } if {$build!=""} { set displayname "[lindex $build 2] $displayname" } set lProp [trd_test_script_properties $f] set priority 0 if {[lsearch $lProp slow]>=0} { set priority 2 } if {[lsearch $lProp superslow]>=0} { set priority 4 } add_job \ -displaytype tcl \ -displayname $displayname \ -cmd $cmd \ -depid [lindex $build 0] \ -priority $priority } } proc add_build_job {buildname target} { global TRG set dirname "[string tolower [string map {- _} $buildname]]_$target" set dirname "testrunner_bld_$dirname" set id [add_job \ -displaytype bld \ -displayname "Build $buildname ($target)" \ -dirname $dirname \ -build $buildname \ -cmd "$TRG(makecmd) $target" \ -priority 3 ] list $id [file normalize $dirname] $buildname } proc add_make_job {bld target} { global TRG if {$TRG(platform)=="win"} { set path [string map {/ \\} [lindex $bld 1]] set cmd "xcopy /S $path\\* ." } else { set cmd "cp -r [lindex $bld 1]/* ." } append cmd "\n$TRG(makecmd) $target" add_job \ -displaytype make \ -displayname "[lindex $bld 2] make $target" \ -cmd $cmd \ -depid [lindex $bld 0] \ -priority 1 } proc add_fuzztest_jobs {buildname} { foreach {interpreter scripts} [trd_fuzztest_data] { set subcmd [lrange $interpreter 1 end] set interpreter [lindex $interpreter 0] set bld [add_build_job $buildname $interpreter] foreach {depid dirname displayname} $bld {} foreach s $scripts { # Fuzz data files fuzzdata1.db and fuzzdata2.db are larger than # the others. So ensure that these are run as a higher priority. set tail [file tail $s] if {$tail=="fuzzdata1.db" || $tail=="fuzzdata2.db"} { set priority 5 } else { set priority 1 } add_job \ -displaytype fuzz \ -displayname "$buildname $interpreter $tail" \ -depid $depid \ -cmd "[file join $dirname $interpreter] $subcmd $s" \ -priority $priority } } } proc add_zipvfs_jobs {} { global TRG source [file join $TRG(zipvfs) test zipvfs_testrunner.tcl] set bld [add_build_job Zipvfs $TRG(testfixture)] foreach s [zipvfs_testrunner_files] { set cmd "[file join [lindex $bld 1] $TRG(testfixture)] $s" add_job \ -displaytype tcl \ -displayname "Zipvfs [file tail $s]" \ -cmd $cmd \ -depid [lindex $bld 0] } set ::env(SQLITE_TEST_DIR) $::testdir } proc add_jobs_from_cmdline {patternlist} { global TRG if {$TRG(zipvfs)!=""} { add_zipvfs_jobs if {[llength $patternlist]==0} return } if {[llength $patternlist]==0} { set patternlist [list veryquick] } set first [lindex $patternlist 0] switch -- $first { all { set patternlist [lrange $patternlist 1 end] set clist [trd_all_configs] foreach c $clist { add_tcl_jobs "" $c $patternlist } } mdevtest { foreach b [list All-O0 All-Debug] { set bld [add_build_job $b $TRG(testfixture)] add_tcl_jobs $bld veryquick "" add_fuzztest_jobs $b } } sdevtest { foreach b [list All-Sanitize All-Debug] { set bld [add_build_job $b $TRG(testfixture)] add_tcl_jobs $bld veryquick "" add_fuzztest_jobs $b } } release { foreach b [trd_builds $TRG(platform)] { set bld [add_build_job $b $TRG(testfixture)] foreach c [trd_configs $TRG(platform) $b] { add_tcl_jobs $bld $c "" } foreach e [trd_extras $TRG(platform) $b] { if {$e=="fuzztest"} { add_fuzztest_jobs $b } else { add_make_job $bld $e } } } } default { if {[info exists ::testspec($first)]} { add_tcl_jobs "" $first [lrange $patternlist 1 end] } else { add_tcl_jobs "" full $patternlist } } } } proc make_new_testset {} { global TRG r_write_db { trdb eval $TRG(schema) set nJob $TRG(nJob) set cmdline $TRG(cmdline) set tm [clock_milliseconds] trdb eval { REPLACE INTO config VALUES('njob', $nJob ); } trdb eval { REPLACE INTO config VALUES('cmdline', $cmdline ); } trdb eval { REPLACE INTO config VALUES('start', $tm ); } add_jobs_from_cmdline $TRG(patternlist) } } proc script_input_ready {fd iJob jobid} { global TRG global O global T if {[eof $fd]} { trdb eval { SELECT * FROM jobs WHERE jobid=$jobid } job {} # If this job specified a directory name, then delete the run.sh/run.bat # file from it before continuing. This is because the contents of this # directory might be copied by some other job, and we don't want to copy # the run.sh file in this case. if {$job(dirname)!=""} { file delete -force [file join $job(dirname) $TRG(run)] } set ::done 1 fconfigure $fd -blocking 1 set state "done" set rc [catch { close $fd } msg] if {$rc} { if {[info exists TRG(reportlength)]} { puts -nonewline "[string repeat " " $TRG(reportlength)]\r" } puts "FAILED: $job(displayname) ($iJob)" set state "failed" } set tm [clock_milliseconds] set jobtm [expr {$tm - $job(starttime)}] puts $TRG(log) "### $job(displayname) ${jobtm}ms ($state)" puts $TRG(log) [string trim $O($iJob)] r_write_db { set output $O($iJob) trdb eval { UPDATE jobs SET output=$output, state=$state, endtime=$tm WHERE jobid=$jobid; UPDATE jobs SET state='ready' WHERE depid=$jobid; } } dirs_freeDir $iJob launch_some_jobs incr ::wakeup } else { |
︙ | ︙ | |||
779 780 781 782 783 784 785 | global TRG global O global T set testfixture [info nameofexec] set script $TRG(info_script) | < < < | | | < < < | | | > > | > | < | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < > > > | < | < < < < < < < | | | | | < | < < < | > | < | | < | | | | 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 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 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 | global TRG global O global T set testfixture [info nameofexec] set script $TRG(info_script) set O($iJob) "" set jobdict [r_get_next_job $iJob] if {$jobdict==""} { return 0 } array set job $jobdict set dir $job(dirname) if {$dir==""} { set dir [dirname $iJob] } create_or_clear_dir $dir if {$job(build)!=""} { set srcdir [file dirname $::testdir] if {$job(build)=="Zipvfs"} { set script [zipvfs_testrunner_script] } else { set bWin [expr {$TRG(platform)=="win"}] set script [trd_buildscript $job(build) $srcdir $bWin] } set fd [open [file join $dir $TRG(make)] w] puts $fd $script close $fd } set pwd [pwd] cd $dir set fd [open $TRG(run) w] puts $fd $job(cmd) close $fd set fd [open "|$TRG(runcmd) 2>@1" r] cd $pwd fconfigure $fd -blocking false fileevent $fd readable [list script_input_ready $fd $iJob $job(jobid)] return 1 } proc one_line_report {} { global TRG set tm [expr [clock_milliseconds] - $TRG(starttime)] set tm [format "%d" [expr int($tm/1000.0 + 0.5)]] r_write_db { trdb eval { SELECT displaytype, state, count(*) AS cnt FROM jobs GROUP BY 1, 2 } { set v($state,$displaytype) $cnt incr t($displaytype) $cnt } } set text "" foreach j [lsort [array names t]] { foreach k {done failed running} { incr v($k,$j) 0 } set fin [expr $v(done,$j) + $v(failed,$j)] lappend text "$j ($fin/$t($j)) f=$v(failed,$j) r=$v(running,$j)" } if {[info exists TRG(reportlength)]} { puts -nonewline "[string repeat " " $TRG(reportlength)]\r" } set report "${tm}s: [join $text { }]" set TRG(reportlength) [string length $report] if {[string length $report]<100} { puts -nonewline "$report\r" flush stdout } else { puts $report } after $TRG(reporttime) one_line_report } proc launch_some_jobs {} { global TRG set nJob [trdb one { SELECT value FROM config WHERE name='njob' }] while {[dirs_nHelper]<$nJob} { set iDir [dirs_allocDir] if {0==[launch_another_job $iDir]} { dirs_freeDir $iDir break; } } } proc run_testset {} { global TRG set ii 0 set TRG(starttime) [clock_milliseconds] set TRG(log) [open $TRG(logname) w] launch_some_jobs one_line_report while {[dirs_nHelper]>0} { after 500 {incr ::wakeup} vwait ::wakeup } close $TRG(log) one_line_report r_write_db { set tm [clock_milliseconds] trdb eval { REPLACE INTO config VALUES('end', $tm ); } set nErr [trdb one {SELECT count(*) FROM jobs WHERE state='failed'}] if {$nErr>0} { puts "$nErr failures:" trdb eval { SELECT displayname FROM jobs WHERE state='failed' } { puts "FAILED: $displayname" } } } puts "\nTest database is $TRG(dbname)" puts "Test log is $TRG(logname)" } |
︙ | ︙ |
Changes to test/testrunner_data.tcl.
︙ | ︙ | |||
366 367 368 369 370 371 372 | } set clist } proc trd_extras {platform bld} { trd_import | < < | | | > > > > > > > > > > > > > > > > > > > > > > > | > > | > > > > > > > | | 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | } set clist } proc trd_extras {platform bld} { trd_import if {[info exists extra($platform.$bld)]==0} { return [list] } return $extra($platform.$bld) } # Usage: # # trd_fuzztest_data # # This returns data used by testrunner.tcl to run commands equivalent # to [make fuzztest]. The returned value is a list, which should be # interpreted as a sequence of pairs. The first element of each pair # is an interpreter name. The second element is a list of files. # testrunner.tcl automatically creates one job to build each interpreter, # and one to run each of the files with it once it has been built. # # In practice, the returned value looks like this: # # { # {fuzzcheck {$testdir/fuzzdata1.db $testdir/fuzzdata2.db ...}} # {{sessionfuzz run} $testdir/sessionfuzz-data1.db} # } # # where $testdir is replaced by the full-path to the test-directory (the # directory containing this file). "fuzzcheck" and "sessionfuzz" have .exe # extensions on windows. # proc trd_fuzztest_data {} { set EXE "" set lFuzzDb [glob [file join $::testdir fuzzdata*.db]] set lSessionDb [glob [file join $::testdir sessionfuzz-data*.db]] if {$::tcl_platform(platform)=="windows"} { return [list fuzzcheck.exe $lFuzzDb] } return [list fuzzcheck $lFuzzDb sessionfuzz $lSessionDb] } proc trd_all_configs {} { trd_import set all_configs } proc trimscript {text} { set text [string map {"\n " "\n"} [string trim $text]] } proc make_sh_script {srcdir opts cflags makeOpts configOpts} { set tcldir [::tcl::pkgconfig get libdir,install] set myopts "" if {[info exists ::env(OPTS)]} { append myopts "# From environment variable:\n" append myopts "OPTS=$::env(OPTS)\n\n" } foreach o [lsort $opts] { append myopts "OPTS=\"\$OPTS $o\"\n" } return [trimscript [subst -nocommands { set -e |
︙ | ︙ | |||
505 506 507 508 509 510 511 | --enable-debug { # lappend makeOpts OPTIMIZATIONS=0 lappend opts -DSQLITE_DEBUG } default { error "Cannot translate $param for MSVC" } | < > > | | < > > > | > | > > > | 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | --enable-debug { # lappend makeOpts OPTIMIZATIONS=0 lappend opts -DSQLITE_DEBUG } default { error "Cannot translate $param for MSVC" } } } continue } if {[string range $param 0 0]=="-"} { if {$bMsvc} { if {[regexp -- {^-O(\d+)$} $param -> level]} { lappend makeOpts OPTIMIZATIONS=$level continue } if {$param eq "-fsanitize=address,undefined"} { lappend makeOpts ASAN=1 continue } } lappend cflags $param continue } lappend makeOpts $param } if {$bMsvc==0} { |
︙ | ︙ | |||
556 557 558 559 560 561 562 | error "No such build config: $config" } # Generate and return the script. return [make_script $build($config) $srcdir $bMsvc] } | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 621 622 623 624 625 626 627 628 629 630 631 632 | error "No such build config: $config" } # Generate and return the script. return [make_script $build($config) $srcdir $bMsvc] } # Usage: # # trd_test_script_properties PATH # # The argument must be a path to a Tcl test script. This function scans the # first 100 lines of the script for lines that look like: # # TESTRUNNER: <properties> # # where <properties> is a list of identifiers, each of which defines a # property of the test script. Example properties are "slow" or "superslow". # proc trd_test_script_properties {path} { # Use this global array as a cache: global trd_test_script_properties_cache if {![info exists trd_test_script_properties_cache($path)]} { set fd [open $path] set ret [list] for {set line 0} {$line < 100 && ![eof $fd]} {incr line} { set text [gets $fd] if {[string match -nocase *testrunner:* $text]} { regexp -nocase {.*testrunner:(.*)} $text -> properties lappend ret {*}$properties } } set trd_test_script_properties_cache($path) $ret close $fd } set trd_test_script_properties_cache($path) } |