Fossil SCM
More improvements to the 'th1' test file.
Commit
fc14f1431286cc5107b6e318e19d3c29384ba4f6
Parent
8435adc47150796…
2 files changed
+20
+43
-16
+20
| --- test/tester.tcl | ||
| +++ test/tester.tcl | ||
| @@ -189,10 +189,30 @@ | ||
| 189 | 189 | exec $::fossilexe new $filename |
| 190 | 190 | exec $::fossilexe open $filename |
| 191 | 191 | exec $::fossilexe clean -f |
| 192 | 192 | exec $::fossilexe set mtime-changes off |
| 193 | 193 | } |
| 194 | + | |
| 195 | +# This procedure only returns non-zero if the Tcl integration feature was | |
| 196 | +# enabled at compile-time and is now enabled at runtime. | |
| 197 | +proc is_tcl_usable_by_fossil {} { | |
| 198 | + fossil test-th-eval "hasfeature tcl" | |
| 199 | + if {$::RESULT ne "1"} {return 0} | |
| 200 | + fossil test-th-eval "setting tcl" | |
| 201 | + if {$::RESULT eq "1"} {return 1} | |
| 202 | + return [info exists ::env(TH1_ENABLE_TCL)] | |
| 203 | +} | |
| 204 | + | |
| 205 | +# This procedure only returns non-zero if the TH1 hooks feature was enabled | |
| 206 | +# at compile-time and is now enabled at runtime. | |
| 207 | +proc are_th1_hooks_usable_by_fossil {} { | |
| 208 | + fossil test-th-eval "hasfeature th1Hooks" | |
| 209 | + if {$::RESULT ne "1"} {return 0} | |
| 210 | + fossil test-th-eval "setting th1-hooks" | |
| 211 | + if {$::RESULT eq "1"} {return 1} | |
| 212 | + return [info exists ::env(TH1_ENABLE_HOOKS)] | |
| 213 | +} | |
| 194 | 214 | |
| 195 | 215 | # This (rarely used) procedure is designed to run a test within the Fossil |
| 196 | 216 | # source checkout (e.g. one that does NOT modify any state), while saving |
| 197 | 217 | # and restoring the current directory (e.g. one used when running a test |
| 198 | 218 | # file outside of the Fossil source checkout). Please do NOT use this |
| 199 | 219 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -189,10 +189,30 @@ | |
| 189 | exec $::fossilexe new $filename |
| 190 | exec $::fossilexe open $filename |
| 191 | exec $::fossilexe clean -f |
| 192 | exec $::fossilexe set mtime-changes off |
| 193 | } |
| 194 | |
| 195 | # This (rarely used) procedure is designed to run a test within the Fossil |
| 196 | # source checkout (e.g. one that does NOT modify any state), while saving |
| 197 | # and restoring the current directory (e.g. one used when running a test |
| 198 | # file outside of the Fossil source checkout). Please do NOT use this |
| 199 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -189,10 +189,30 @@ | |
| 189 | exec $::fossilexe new $filename |
| 190 | exec $::fossilexe open $filename |
| 191 | exec $::fossilexe clean -f |
| 192 | exec $::fossilexe set mtime-changes off |
| 193 | } |
| 194 | |
| 195 | # This procedure only returns non-zero if the Tcl integration feature was |
| 196 | # enabled at compile-time and is now enabled at runtime. |
| 197 | proc is_tcl_usable_by_fossil {} { |
| 198 | fossil test-th-eval "hasfeature tcl" |
| 199 | if {$::RESULT ne "1"} {return 0} |
| 200 | fossil test-th-eval "setting tcl" |
| 201 | if {$::RESULT eq "1"} {return 1} |
| 202 | return [info exists ::env(TH1_ENABLE_TCL)] |
| 203 | } |
| 204 | |
| 205 | # This procedure only returns non-zero if the TH1 hooks feature was enabled |
| 206 | # at compile-time and is now enabled at runtime. |
| 207 | proc are_th1_hooks_usable_by_fossil {} { |
| 208 | fossil test-th-eval "hasfeature th1Hooks" |
| 209 | if {$::RESULT ne "1"} {return 0} |
| 210 | fossil test-th-eval "setting th1-hooks" |
| 211 | if {$::RESULT eq "1"} {return 1} |
| 212 | return [info exists ::env(TH1_ENABLE_HOOKS)] |
| 213 | } |
| 214 | |
| 215 | # This (rarely used) procedure is designed to run a test within the Fossil |
| 216 | # source checkout (e.g. one that does NOT modify any state), while saving |
| 217 | # and restoring the current directory (e.g. one used when running a test |
| 218 | # file outside of the Fossil source checkout). Please do NOT use this |
| 219 |
+43
-16
| --- test/th1.test | ||
| +++ test/th1.test | ||
| @@ -20,17 +20,12 @@ | ||
| 20 | 20 | |
| 21 | 21 | set dir [file dirname [info script]]; repo_init |
| 22 | 22 | |
| 23 | 23 | ############################################################################### |
| 24 | 24 | |
| 25 | -fossil test-th-eval --open-config "setting tcl" | |
| 26 | -set th1Tcl [expr {$RESULT eq "1" || [info exists ::env(TH1_ENABLE_TCL)]}] | |
| 27 | - | |
| 28 | -############################################################################### | |
| 29 | - | |
| 30 | -fossil test-th-eval --open-config "setting th1-hooks" | |
| 31 | -set th1Hooks [expr {$RESULT eq "1" || [info exists ::env(TH1_ENABLE_HOOKS)]}] | |
| 25 | +set th1Tcl [is_tcl_usable_by_fossil] | |
| 26 | +set th1Hooks [are_th1_hooks_usable_by_fossil] | |
| 32 | 27 | |
| 33 | 28 | ############################################################################### |
| 34 | 29 | |
| 35 | 30 | fossil test-th-eval --open-config "setting abc" |
| 36 | 31 | test th1-setting-1 {$RESULT eq ""} |
| @@ -560,19 +555,25 @@ | ||
| 560 | 555 | test th1-expr-49 {$RESULT eq {TH_ERROR: expected integer, got: "-0x"}} |
| 561 | 556 | |
| 562 | 557 | ############################################################################### |
| 563 | 558 | |
| 564 | 559 | run_in_checkout { |
| 560 | + # NOTE: The "1" here forces the checkout to be opened. | |
| 565 | 561 | fossil test-th-eval "checkout 1" |
| 566 | 562 | } |
| 567 | 563 | |
| 568 | 564 | test th1-checkout-1 {[string length $RESULT] > 0} |
| 569 | 565 | |
| 570 | 566 | ############################################################################### |
| 571 | 567 | |
| 572 | 568 | run_in_checkout { |
| 573 | - fossil test-th-eval "checkout" | |
| 569 | + if {$th1Hooks} { | |
| 570 | + fossil test-th-eval "checkout" | |
| 571 | + } else { | |
| 572 | + # NOTE: No TH1 hooks, force checkout to be populated. | |
| 573 | + fossil test-th-eval --open-config "checkout" | |
| 574 | + } | |
| 574 | 575 | } |
| 575 | 576 | |
| 576 | 577 | test th1-checkout-2 {[string length $RESULT] > 0} |
| 577 | 578 | |
| 578 | 579 | ############################################################################### |
| @@ -778,20 +779,33 @@ | ||
| 778 | 779 | test th1-artifact-9 {$RESULT eq {TH_ERROR: manifest not found}} |
| 779 | 780 | |
| 780 | 781 | ############################################################################### |
| 781 | 782 | |
| 782 | 783 | run_in_checkout { |
| 783 | - fossil test-th-eval "globalState checkout" | |
| 784 | + if {$th1Hooks} { | |
| 785 | + fossil test-th-eval "globalState checkout" | |
| 786 | + } else { | |
| 787 | + # NOTE: No TH1 hooks, force checkout to be populated. | |
| 788 | + fossil test-th-eval --open-config "globalState checkout" | |
| 789 | + } | |
| 784 | 790 | } |
| 785 | 791 | |
| 786 | 792 | test th1-globalState-1 {[string length $RESULT] > 0} |
| 787 | 793 | |
| 788 | 794 | ############################################################################### |
| 789 | 795 | |
| 790 | 796 | run_in_checkout { |
| 791 | - fossil test-th-eval "globalState checkout" | |
| 792 | - test th1-globalState-2 {$RESULT eq [fossil test-th-eval checkout]} | |
| 797 | + if {$th1Hooks} { | |
| 798 | + fossil test-th-eval "globalState checkout" | |
| 799 | + test th1-globalState-2 {$RESULT eq [fossil test-th-eval checkout]} | |
| 800 | + } else { | |
| 801 | + # NOTE: No TH1 hooks, force checkout to be populated. | |
| 802 | + fossil test-th-eval --open-config "globalState checkout" | |
| 803 | + | |
| 804 | + test th1-globalState-2 {$RESULT eq \ | |
| 805 | + [fossil test-th-eval --open-config checkout]} | |
| 806 | + } | |
| 793 | 807 | } |
| 794 | 808 | |
| 795 | 809 | ############################################################################### |
| 796 | 810 | |
| 797 | 811 | fossil test-th-eval "globalState configuration" |
| @@ -818,20 +832,33 @@ | ||
| 818 | 832 | test th1-globalState-7 {$RESULT eq "foserrors.log"} |
| 819 | 833 | |
| 820 | 834 | ############################################################################### |
| 821 | 835 | |
| 822 | 836 | run_in_checkout { |
| 823 | - fossil test-th-eval "globalState repository" | |
| 837 | + if {$th1Hooks} { | |
| 838 | + fossil test-th-eval "globalState repository" | |
| 839 | + } else { | |
| 840 | + # NOTE: No TH1 hooks, force repository to be populated. | |
| 841 | + fossil test-th-eval --open-config "globalState repository" | |
| 842 | + } | |
| 824 | 843 | } |
| 825 | 844 | |
| 826 | 845 | test th1-globalState-8 {[string length $RESULT] > 0} |
| 827 | 846 | |
| 828 | 847 | ############################################################################### |
| 829 | 848 | |
| 830 | 849 | run_in_checkout { |
| 831 | - fossil test-th-eval "globalState repository" | |
| 832 | - test th1-globalState-9 {$RESULT eq [fossil test-th-eval repository]} | |
| 850 | + if {$th1Hooks} { | |
| 851 | + fossil test-th-eval "globalState repository" | |
| 852 | + test th1-globalState-9 {$RESULT eq [fossil test-th-eval repository]} | |
| 853 | + } else { | |
| 854 | + # NOTE: No TH1 hooks, force repository to be populated. | |
| 855 | + fossil test-th-eval --open-config "globalState repository" | |
| 856 | + | |
| 857 | + test th1-globalState-9 {$RESULT eq \ | |
| 858 | + [fossil test-th-eval --open-config repository]} | |
| 859 | + } | |
| 833 | 860 | } |
| 834 | 861 | |
| 835 | 862 | ############################################################################### |
| 836 | 863 | |
| 837 | 864 | fossil test-th-eval "globalState top" |
| @@ -886,12 +913,12 @@ | ||
| 886 | 913 | test th1-reinitialize-2 {$RESULT ne ""} |
| 887 | 914 | |
| 888 | 915 | ############################################################################### |
| 889 | 916 | |
| 890 | 917 | # |
| 891 | -# NOTE: This test may fail if the command names do not always come | |
| 892 | -# out in a deterministic order from TH1. | |
| 918 | +# NOTE: This test may fail if the command names do not always come out in a | |
| 919 | +# deterministic order from TH1. | |
| 893 | 920 | # |
| 894 | 921 | fossil test-th-eval "info commands" |
| 895 | 922 | |
| 896 | 923 | if {$th1Tcl} { |
| 897 | 924 | test th1-info-commands-1 {$RESULT eq {linecount htmlize date stime\ |
| 898 | 925 |
| --- test/th1.test | |
| +++ test/th1.test | |
| @@ -20,17 +20,12 @@ | |
| 20 | |
| 21 | set dir [file dirname [info script]]; repo_init |
| 22 | |
| 23 | ############################################################################### |
| 24 | |
| 25 | fossil test-th-eval --open-config "setting tcl" |
| 26 | set th1Tcl [expr {$RESULT eq "1" || [info exists ::env(TH1_ENABLE_TCL)]}] |
| 27 | |
| 28 | ############################################################################### |
| 29 | |
| 30 | fossil test-th-eval --open-config "setting th1-hooks" |
| 31 | set th1Hooks [expr {$RESULT eq "1" || [info exists ::env(TH1_ENABLE_HOOKS)]}] |
| 32 | |
| 33 | ############################################################################### |
| 34 | |
| 35 | fossil test-th-eval --open-config "setting abc" |
| 36 | test th1-setting-1 {$RESULT eq ""} |
| @@ -560,19 +555,25 @@ | |
| 560 | test th1-expr-49 {$RESULT eq {TH_ERROR: expected integer, got: "-0x"}} |
| 561 | |
| 562 | ############################################################################### |
| 563 | |
| 564 | run_in_checkout { |
| 565 | fossil test-th-eval "checkout 1" |
| 566 | } |
| 567 | |
| 568 | test th1-checkout-1 {[string length $RESULT] > 0} |
| 569 | |
| 570 | ############################################################################### |
| 571 | |
| 572 | run_in_checkout { |
| 573 | fossil test-th-eval "checkout" |
| 574 | } |
| 575 | |
| 576 | test th1-checkout-2 {[string length $RESULT] > 0} |
| 577 | |
| 578 | ############################################################################### |
| @@ -778,20 +779,33 @@ | |
| 778 | test th1-artifact-9 {$RESULT eq {TH_ERROR: manifest not found}} |
| 779 | |
| 780 | ############################################################################### |
| 781 | |
| 782 | run_in_checkout { |
| 783 | fossil test-th-eval "globalState checkout" |
| 784 | } |
| 785 | |
| 786 | test th1-globalState-1 {[string length $RESULT] > 0} |
| 787 | |
| 788 | ############################################################################### |
| 789 | |
| 790 | run_in_checkout { |
| 791 | fossil test-th-eval "globalState checkout" |
| 792 | test th1-globalState-2 {$RESULT eq [fossil test-th-eval checkout]} |
| 793 | } |
| 794 | |
| 795 | ############################################################################### |
| 796 | |
| 797 | fossil test-th-eval "globalState configuration" |
| @@ -818,20 +832,33 @@ | |
| 818 | test th1-globalState-7 {$RESULT eq "foserrors.log"} |
| 819 | |
| 820 | ############################################################################### |
| 821 | |
| 822 | run_in_checkout { |
| 823 | fossil test-th-eval "globalState repository" |
| 824 | } |
| 825 | |
| 826 | test th1-globalState-8 {[string length $RESULT] > 0} |
| 827 | |
| 828 | ############################################################################### |
| 829 | |
| 830 | run_in_checkout { |
| 831 | fossil test-th-eval "globalState repository" |
| 832 | test th1-globalState-9 {$RESULT eq [fossil test-th-eval repository]} |
| 833 | } |
| 834 | |
| 835 | ############################################################################### |
| 836 | |
| 837 | fossil test-th-eval "globalState top" |
| @@ -886,12 +913,12 @@ | |
| 886 | test th1-reinitialize-2 {$RESULT ne ""} |
| 887 | |
| 888 | ############################################################################### |
| 889 | |
| 890 | # |
| 891 | # NOTE: This test may fail if the command names do not always come |
| 892 | # out in a deterministic order from TH1. |
| 893 | # |
| 894 | fossil test-th-eval "info commands" |
| 895 | |
| 896 | if {$th1Tcl} { |
| 897 | test th1-info-commands-1 {$RESULT eq {linecount htmlize date stime\ |
| 898 |
| --- test/th1.test | |
| +++ test/th1.test | |
| @@ -20,17 +20,12 @@ | |
| 20 | |
| 21 | set dir [file dirname [info script]]; repo_init |
| 22 | |
| 23 | ############################################################################### |
| 24 | |
| 25 | set th1Tcl [is_tcl_usable_by_fossil] |
| 26 | set th1Hooks [are_th1_hooks_usable_by_fossil] |
| 27 | |
| 28 | ############################################################################### |
| 29 | |
| 30 | fossil test-th-eval --open-config "setting abc" |
| 31 | test th1-setting-1 {$RESULT eq ""} |
| @@ -560,19 +555,25 @@ | |
| 555 | test th1-expr-49 {$RESULT eq {TH_ERROR: expected integer, got: "-0x"}} |
| 556 | |
| 557 | ############################################################################### |
| 558 | |
| 559 | run_in_checkout { |
| 560 | # NOTE: The "1" here forces the checkout to be opened. |
| 561 | fossil test-th-eval "checkout 1" |
| 562 | } |
| 563 | |
| 564 | test th1-checkout-1 {[string length $RESULT] > 0} |
| 565 | |
| 566 | ############################################################################### |
| 567 | |
| 568 | run_in_checkout { |
| 569 | if {$th1Hooks} { |
| 570 | fossil test-th-eval "checkout" |
| 571 | } else { |
| 572 | # NOTE: No TH1 hooks, force checkout to be populated. |
| 573 | fossil test-th-eval --open-config "checkout" |
| 574 | } |
| 575 | } |
| 576 | |
| 577 | test th1-checkout-2 {[string length $RESULT] > 0} |
| 578 | |
| 579 | ############################################################################### |
| @@ -778,20 +779,33 @@ | |
| 779 | test th1-artifact-9 {$RESULT eq {TH_ERROR: manifest not found}} |
| 780 | |
| 781 | ############################################################################### |
| 782 | |
| 783 | run_in_checkout { |
| 784 | if {$th1Hooks} { |
| 785 | fossil test-th-eval "globalState checkout" |
| 786 | } else { |
| 787 | # NOTE: No TH1 hooks, force checkout to be populated. |
| 788 | fossil test-th-eval --open-config "globalState checkout" |
| 789 | } |
| 790 | } |
| 791 | |
| 792 | test th1-globalState-1 {[string length $RESULT] > 0} |
| 793 | |
| 794 | ############################################################################### |
| 795 | |
| 796 | run_in_checkout { |
| 797 | if {$th1Hooks} { |
| 798 | fossil test-th-eval "globalState checkout" |
| 799 | test th1-globalState-2 {$RESULT eq [fossil test-th-eval checkout]} |
| 800 | } else { |
| 801 | # NOTE: No TH1 hooks, force checkout to be populated. |
| 802 | fossil test-th-eval --open-config "globalState checkout" |
| 803 | |
| 804 | test th1-globalState-2 {$RESULT eq \ |
| 805 | [fossil test-th-eval --open-config checkout]} |
| 806 | } |
| 807 | } |
| 808 | |
| 809 | ############################################################################### |
| 810 | |
| 811 | fossil test-th-eval "globalState configuration" |
| @@ -818,20 +832,33 @@ | |
| 832 | test th1-globalState-7 {$RESULT eq "foserrors.log"} |
| 833 | |
| 834 | ############################################################################### |
| 835 | |
| 836 | run_in_checkout { |
| 837 | if {$th1Hooks} { |
| 838 | fossil test-th-eval "globalState repository" |
| 839 | } else { |
| 840 | # NOTE: No TH1 hooks, force repository to be populated. |
| 841 | fossil test-th-eval --open-config "globalState repository" |
| 842 | } |
| 843 | } |
| 844 | |
| 845 | test th1-globalState-8 {[string length $RESULT] > 0} |
| 846 | |
| 847 | ############################################################################### |
| 848 | |
| 849 | run_in_checkout { |
| 850 | if {$th1Hooks} { |
| 851 | fossil test-th-eval "globalState repository" |
| 852 | test th1-globalState-9 {$RESULT eq [fossil test-th-eval repository]} |
| 853 | } else { |
| 854 | # NOTE: No TH1 hooks, force repository to be populated. |
| 855 | fossil test-th-eval --open-config "globalState repository" |
| 856 | |
| 857 | test th1-globalState-9 {$RESULT eq \ |
| 858 | [fossil test-th-eval --open-config repository]} |
| 859 | } |
| 860 | } |
| 861 | |
| 862 | ############################################################################### |
| 863 | |
| 864 | fossil test-th-eval "globalState top" |
| @@ -886,12 +913,12 @@ | |
| 913 | test th1-reinitialize-2 {$RESULT ne ""} |
| 914 | |
| 915 | ############################################################################### |
| 916 | |
| 917 | # |
| 918 | # NOTE: This test may fail if the command names do not always come out in a |
| 919 | # deterministic order from TH1. |
| 920 | # |
| 921 | fossil test-th-eval "info commands" |
| 922 | |
| 923 | if {$th1Tcl} { |
| 924 | test th1-info-commands-1 {$RESULT eq {linecount htmlize date stime\ |
| 925 |