Fossil SCM
Tidy up test running ready for merge
Commit
468ea833e89a66ceb4b4f5a80b56627786339d5aeea42b7629c05d74433800b6
Parent
2b8d7a025a806a1…
1 file changed
+40
-52
+40
-52
| --- test/tester.tcl | ||
| +++ test/tester.tcl | ||
| @@ -13,25 +13,23 @@ | ||
| 13 | 13 | # [email protected] |
| 14 | 14 | # http://www.hwaci.com/drh/ |
| 15 | 15 | # |
| 16 | 16 | ############################################################################ |
| 17 | 17 | # |
| 18 | -# This is the main test script. To run a regression test, do this: | |
| 19 | -# | |
| 20 | -# tclsh ../test/tester.tcl ../bld/fossil | |
| 21 | -# | |
| 22 | -# Where ../test/tester.tcl is the name of this file and ../bld/fossil | |
| 23 | -# is the name of the executable to be tested. | |
| 24 | -# | |
| 25 | -# To run a subset of tests (i.e. only one or more of the test/*.test | |
| 26 | -# scripts), append the script base names as arguments: | |
| 27 | -# | |
| 28 | -# tclsh ../test/tester.tcl ../bld/fossil <script-basename>... | |
| 29 | -# | |
| 30 | - | |
| 31 | -# We use some things introduced in 8.6 such as lmap. auto.def should | |
| 32 | -# have found us a suitable Tcl installation. | |
| 18 | +# This is the main test script. "make test" runs it from a build | |
| 19 | +# directory, or run it by hand: | |
| 20 | +# | |
| 21 | +# tclsh ../test/tester.tcl ./fossil | |
| 22 | +# tclsh ../test/tester.tcl ./fossil -quiet merge1 update | |
| 23 | +# | |
| 24 | +# The first argument is the fossil executable to test, followed by | |
| 25 | +# the test files, so "update" runs test/update.test. See test/README.md | |
| 26 | +# for details of options such as -strict, -halt, -prot etc. | |
| 27 | +# | |
| 28 | + | |
| 29 | +# Minimum Tcl is 8.6. auto.def should have found us a suitable Tcl | |
| 30 | +# installation. Care is needed to keep compatible with both 8.6 and 9.0. | |
| 33 | 31 | package require Tcl 8.6- |
| 34 | 32 | |
| 35 | 33 | set testfiledir [file normalize [file dirname [info script]]] |
| 36 | 34 | set testrundir [pwd] |
| 37 | 35 | set testdir [file normalize [file dirname $argv0]] |
| @@ -44,10 +42,14 @@ | ||
| 44 | 42 | append fossilexe .exe |
| 45 | 43 | } |
| 46 | 44 | set outside_fossil_repo [expr ![file exists "$::testfiledir\\..\\_FOSSIL_"]] |
| 47 | 45 | } else { |
| 48 | 46 | set outside_fossil_repo [expr ![file exists "$::testfiledir/../.fslckout"]] |
| 47 | +} | |
| 48 | +if {![file isfile $fossilexe]} { | |
| 49 | + puts stderr "usage: tclsh [info script] FOSSIL ?OPTIONS? ?TESTFILE ...?" | |
| 50 | + exit 1 | |
| 49 | 51 | } |
| 50 | 52 | |
| 51 | 53 | catch {exec $::fossilexe changes --changed} res |
| 52 | 54 | set dirty_ckout [string length $res] |
| 53 | 55 | |
| @@ -636,47 +638,33 @@ | ||
| 636 | 638 | # |
| 637 | 639 | proc appendArgs {args} { |
| 638 | 640 | eval append result $args |
| 639 | 641 | } |
| 640 | 642 | |
| 641 | -# Returns the value of the specified environment variable -OR- any empty | |
| 642 | -# string if it does not exist. | |
| 643 | -# | |
| 644 | -proc getEnvironmentVariable { name } { | |
| 645 | - return [expr {[info exists ::env($name)] ? $::env($name) : ""}] | |
| 646 | -} | |
| 647 | - | |
| 648 | -# Returns a usable temporary directory -OR- fails the testing process. | |
| 649 | -# | |
| 650 | -proc getTemporaryPath {} { | |
| 651 | - set names [list] | |
| 652 | - | |
| 653 | - foreach name [list FOSSIL_TEST_TEMP FOSSIL_TEMP TMPDIR TEMP TMP] { | |
| 654 | - lappend names [string toupper $name] [string tolower $name] \ | |
| 655 | - [string totitle $name] | |
| 656 | - } | |
| 657 | - | |
| 658 | - foreach name $names { | |
| 659 | - set value [getEnvironmentVariable $name] | |
| 660 | - | |
| 661 | - if {[string length $value] > 0} { | |
| 662 | - set value [file normalize $value] | |
| 663 | - | |
| 664 | - if {[file exists $value] && [file isdirectory $value]} { | |
| 665 | - return $value | |
| 666 | - } | |
| 667 | - } | |
| 668 | - } | |
| 669 | - | |
| 670 | - if {!$::is_windows} { | |
| 671 | - set value /tmp | |
| 672 | - | |
| 673 | - if {[file exists $value] && [file isdirectory $value]} { | |
| 674 | - return $value | |
| 675 | - } | |
| 676 | - } | |
| 677 | - | |
| 643 | +# Returns the first directory given by the environment variables | |
| 644 | +# FOSSIL_TEST_TEMP, FOSSIL_TEMP, TMPDIR, TEMP and TMP, each read in | |
| 645 | +# upper, lower and title case, or /tmp except on Windows. Raises an | |
| 646 | +# error if none of those are directories. | |
| 647 | +# | |
| 648 | +proc getTemporaryPath {} { | |
| 649 | + set values [list] | |
| 650 | + foreach name {FOSSIL_TEST_TEMP FOSSIL_TEMP TMPDIR TEMP TMP} { | |
| 651 | + foreach spelling \ | |
| 652 | + [list $name [string tolower $name] [string totitle $name]] { | |
| 653 | + if {[info exists ::env($spelling)] && $::env($spelling) ne ""} { | |
| 654 | + lappend values [file normalize $::env($spelling)] | |
| 655 | + } | |
| 656 | + } | |
| 657 | + } | |
| 658 | + if {!$::is_windows} { | |
| 659 | + lappend values /tmp | |
| 660 | + } | |
| 661 | + foreach value $values { | |
| 662 | + if {[file isdirectory $value]} { | |
| 663 | + return $value | |
| 664 | + } | |
| 665 | + } | |
| 678 | 666 | error "Cannot find a usable temporary directory, testing halted." |
| 679 | 667 | } |
| 680 | 668 | |
| 681 | 669 | # Return VALUE as lines for the report of a failed test, after LABEL. |
| 682 | 670 | # A value on one line is shown in double quotes. Each line of a value |
| 683 | 671 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -13,25 +13,23 @@ | |
| 13 | # [email protected] |
| 14 | # http://www.hwaci.com/drh/ |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # This is the main test script. To run a regression test, do this: |
| 19 | # |
| 20 | # tclsh ../test/tester.tcl ../bld/fossil |
| 21 | # |
| 22 | # Where ../test/tester.tcl is the name of this file and ../bld/fossil |
| 23 | # is the name of the executable to be tested. |
| 24 | # |
| 25 | # To run a subset of tests (i.e. only one or more of the test/*.test |
| 26 | # scripts), append the script base names as arguments: |
| 27 | # |
| 28 | # tclsh ../test/tester.tcl ../bld/fossil <script-basename>... |
| 29 | # |
| 30 | |
| 31 | # We use some things introduced in 8.6 such as lmap. auto.def should |
| 32 | # have found us a suitable Tcl installation. |
| 33 | package require Tcl 8.6- |
| 34 | |
| 35 | set testfiledir [file normalize [file dirname [info script]]] |
| 36 | set testrundir [pwd] |
| 37 | set testdir [file normalize [file dirname $argv0]] |
| @@ -44,10 +42,14 @@ | |
| 44 | append fossilexe .exe |
| 45 | } |
| 46 | set outside_fossil_repo [expr ![file exists "$::testfiledir\\..\\_FOSSIL_"]] |
| 47 | } else { |
| 48 | set outside_fossil_repo [expr ![file exists "$::testfiledir/../.fslckout"]] |
| 49 | } |
| 50 | |
| 51 | catch {exec $::fossilexe changes --changed} res |
| 52 | set dirty_ckout [string length $res] |
| 53 | |
| @@ -636,47 +638,33 @@ | |
| 636 | # |
| 637 | proc appendArgs {args} { |
| 638 | eval append result $args |
| 639 | } |
| 640 | |
| 641 | # Returns the value of the specified environment variable -OR- any empty |
| 642 | # string if it does not exist. |
| 643 | # |
| 644 | proc getEnvironmentVariable { name } { |
| 645 | return [expr {[info exists ::env($name)] ? $::env($name) : ""}] |
| 646 | } |
| 647 | |
| 648 | # Returns a usable temporary directory -OR- fails the testing process. |
| 649 | # |
| 650 | proc getTemporaryPath {} { |
| 651 | set names [list] |
| 652 | |
| 653 | foreach name [list FOSSIL_TEST_TEMP FOSSIL_TEMP TMPDIR TEMP TMP] { |
| 654 | lappend names [string toupper $name] [string tolower $name] \ |
| 655 | [string totitle $name] |
| 656 | } |
| 657 | |
| 658 | foreach name $names { |
| 659 | set value [getEnvironmentVariable $name] |
| 660 | |
| 661 | if {[string length $value] > 0} { |
| 662 | set value [file normalize $value] |
| 663 | |
| 664 | if {[file exists $value] && [file isdirectory $value]} { |
| 665 | return $value |
| 666 | } |
| 667 | } |
| 668 | } |
| 669 | |
| 670 | if {!$::is_windows} { |
| 671 | set value /tmp |
| 672 | |
| 673 | if {[file exists $value] && [file isdirectory $value]} { |
| 674 | return $value |
| 675 | } |
| 676 | } |
| 677 | |
| 678 | error "Cannot find a usable temporary directory, testing halted." |
| 679 | } |
| 680 | |
| 681 | # Return VALUE as lines for the report of a failed test, after LABEL. |
| 682 | # A value on one line is shown in double quotes. Each line of a value |
| 683 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -13,25 +13,23 @@ | |
| 13 | # [email protected] |
| 14 | # http://www.hwaci.com/drh/ |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # This is the main test script. "make test" runs it from a build |
| 19 | # directory, or run it by hand: |
| 20 | # |
| 21 | # tclsh ../test/tester.tcl ./fossil |
| 22 | # tclsh ../test/tester.tcl ./fossil -quiet merge1 update |
| 23 | # |
| 24 | # The first argument is the fossil executable to test, followed by |
| 25 | # the test files, so "update" runs test/update.test. See test/README.md |
| 26 | # for details of options such as -strict, -halt, -prot etc. |
| 27 | # |
| 28 | |
| 29 | # Minimum Tcl is 8.6. auto.def should have found us a suitable Tcl |
| 30 | # installation. Care is needed to keep compatible with both 8.6 and 9.0. |
| 31 | package require Tcl 8.6- |
| 32 | |
| 33 | set testfiledir [file normalize [file dirname [info script]]] |
| 34 | set testrundir [pwd] |
| 35 | set testdir [file normalize [file dirname $argv0]] |
| @@ -44,10 +42,14 @@ | |
| 42 | append fossilexe .exe |
| 43 | } |
| 44 | set outside_fossil_repo [expr ![file exists "$::testfiledir\\..\\_FOSSIL_"]] |
| 45 | } else { |
| 46 | set outside_fossil_repo [expr ![file exists "$::testfiledir/../.fslckout"]] |
| 47 | } |
| 48 | if {![file isfile $fossilexe]} { |
| 49 | puts stderr "usage: tclsh [info script] FOSSIL ?OPTIONS? ?TESTFILE ...?" |
| 50 | exit 1 |
| 51 | } |
| 52 | |
| 53 | catch {exec $::fossilexe changes --changed} res |
| 54 | set dirty_ckout [string length $res] |
| 55 | |
| @@ -636,47 +638,33 @@ | |
| 638 | # |
| 639 | proc appendArgs {args} { |
| 640 | eval append result $args |
| 641 | } |
| 642 | |
| 643 | # Returns the first directory given by the environment variables |
| 644 | # FOSSIL_TEST_TEMP, FOSSIL_TEMP, TMPDIR, TEMP and TMP, each read in |
| 645 | # upper, lower and title case, or /tmp except on Windows. Raises an |
| 646 | # error if none of those are directories. |
| 647 | # |
| 648 | proc getTemporaryPath {} { |
| 649 | set values [list] |
| 650 | foreach name {FOSSIL_TEST_TEMP FOSSIL_TEMP TMPDIR TEMP TMP} { |
| 651 | foreach spelling \ |
| 652 | [list $name [string tolower $name] [string totitle $name]] { |
| 653 | if {[info exists ::env($spelling)] && $::env($spelling) ne ""} { |
| 654 | lappend values [file normalize $::env($spelling)] |
| 655 | } |
| 656 | } |
| 657 | } |
| 658 | if {!$::is_windows} { |
| 659 | lappend values /tmp |
| 660 | } |
| 661 | foreach value $values { |
| 662 | if {[file isdirectory $value]} { |
| 663 | return $value |
| 664 | } |
| 665 | } |
| 666 | error "Cannot find a usable temporary directory, testing halted." |
| 667 | } |
| 668 | |
| 669 | # Return VALUE as lines for the report of a failed test, after LABEL. |
| 670 | # A value on one line is shown in double quotes. Each line of a value |
| 671 |