Fossil SCM

More improvements to the 'th1' test file.

mistachkin 2016-01-12 03:14 trunk
Commit fc14f1431286cc5107b6e318e19d3c29384ba4f6
2 files changed +20 +43 -16
--- test/tester.tcl
+++ test/tester.tcl
@@ -189,10 +189,30 @@
189189
exec $::fossilexe new $filename
190190
exec $::fossilexe open $filename
191191
exec $::fossilexe clean -f
192192
exec $::fossilexe set mtime-changes off
193193
}
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
+}
194214
195215
# This (rarely used) procedure is designed to run a test within the Fossil
196216
# source checkout (e.g. one that does NOT modify any state), while saving
197217
# and restoring the current directory (e.g. one used when running a test
198218
# file outside of the Fossil source checkout). Please do NOT use this
199219
--- 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 @@
2020
2121
set dir [file dirname [info script]]; repo_init
2222
2323
###############################################################################
2424
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]
3227
3328
###############################################################################
3429
3530
fossil test-th-eval --open-config "setting abc"
3631
test th1-setting-1 {$RESULT eq ""}
@@ -560,19 +555,25 @@
560555
test th1-expr-49 {$RESULT eq {TH_ERROR: expected integer, got: "-0x"}}
561556
562557
###############################################################################
563558
564559
run_in_checkout {
560
+ # NOTE: The "1" here forces the checkout to be opened.
565561
fossil test-th-eval "checkout 1"
566562
}
567563
568564
test th1-checkout-1 {[string length $RESULT] > 0}
569565
570566
###############################################################################
571567
572568
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
+ }
574575
}
575576
576577
test th1-checkout-2 {[string length $RESULT] > 0}
577578
578579
###############################################################################
@@ -778,20 +779,33 @@
778779
test th1-artifact-9 {$RESULT eq {TH_ERROR: manifest not found}}
779780
780781
###############################################################################
781782
782783
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
+ }
784790
}
785791
786792
test th1-globalState-1 {[string length $RESULT] > 0}
787793
788794
###############################################################################
789795
790796
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
+ }
793807
}
794808
795809
###############################################################################
796810
797811
fossil test-th-eval "globalState configuration"
@@ -818,20 +832,33 @@
818832
test th1-globalState-7 {$RESULT eq "foserrors.log"}
819833
820834
###############################################################################
821835
822836
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
+ }
824843
}
825844
826845
test th1-globalState-8 {[string length $RESULT] > 0}
827846
828847
###############################################################################
829848
830849
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
+ }
833860
}
834861
835862
###############################################################################
836863
837864
fossil test-th-eval "globalState top"
@@ -886,12 +913,12 @@
886913
test th1-reinitialize-2 {$RESULT ne ""}
887914
888915
###############################################################################
889916
890917
#
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.
893920
#
894921
fossil test-th-eval "info commands"
895922
896923
if {$th1Tcl} {
897924
test th1-info-commands-1 {$RESULT eq {linecount htmlize date stime\
898925
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button