Fossil SCM

The test harness now skips all tests done in the Fossil source repo checkout directory while there are uncommitted changes because that will affect the behavior of fossil status, fossil diff, etc., which in turn tends to create false positives in test harness code that checks for changes in fossil command output.

wyoung 2018-09-03 06:27 wrap-run_in_checkout
Commit 78ec683882d697712126ad778b36ae1212aeebcbd93ee0589a1ef457abe8c371
+12 -3
--- test/tester.tcl
+++ test/tester.tcl
@@ -40,10 +40,13 @@
4040
set outside_fossil_repo [expr ![file exists "$::testfiledir\\..\\_FOSSIL_"]]
4141
} else {
4242
set outside_fossil_repo [expr ![file exists "$::testfiledir/../.fslckout"]]
4343
}
4444
45
+catch {exec $::fossilexe changes --changed} res
46
+set dirty_ckout [string length $res]
47
+
4548
set argv [lrange $argv 1 end]
4649
4750
set i [lsearch $argv -keep]
4851
if {$i>=0} {
4952
set KEEP 1
@@ -531,11 +534,18 @@
531534
# checkout directory. If you are unsure, test $::outside_fossil_repo
532535
# or call one of the test_* wrappers below which do that for you.
533536
#
534537
# As a rule, you should not be calling this function directly!
535538
#
536
-# 2. The test does NOT modify the Fossil checkout tree in any way.
539
+# 2. This test run is being done from a repo checkout directory that
540
+# doesn't have any uncommitted changes. If it does, that affects the
541
+# output of any test based on the output of "fossil status",
542
+# "... diff", etc., which is likely to make the test appear to fail.
543
+# If you must call this function directly, test $::dirty_ckout and
544
+# skip the call if it's true. The test_* wrappers do this for you.
545
+#
546
+# 3. The test does NOT modify the Fossil checkout tree in any way.
537547
proc run_in_checkout { script {dir ""} } {
538548
if {[string length $dir] == 0} {set dir $::testfiledir}
539549
set savedPwd [pwd]; cd $dir
540550
set code [catch {
541551
uplevel 1 $script
@@ -548,12 +558,11 @@
548558
# optional post-run test script. Some callers choose instead to put
549559
# the tests inline with the rscript commands.
550560
#
551561
# Be sure to adhere to the requirements of run_in_checkout!
552562
proc test_block_in_checkout { name rscript {tscript ""} } {
553
- if {$::outside_fossil_repo} {
554
- puts "Skipping $name test: not in Fossil repo checkout."
563
+ if {$::outside_fossil_repo || $::dirty_ckout} {
555564
set $::CODE 0
556565
set $::RESULT ""
557566
} else {
558567
run_in_checkout $rscript
559568
if {[string length $tscript] == 0} {
560569
--- test/tester.tcl
+++ test/tester.tcl
@@ -40,10 +40,13 @@
40 set outside_fossil_repo [expr ![file exists "$::testfiledir\\..\\_FOSSIL_"]]
41 } else {
42 set outside_fossil_repo [expr ![file exists "$::testfiledir/../.fslckout"]]
43 }
44
 
 
 
45 set argv [lrange $argv 1 end]
46
47 set i [lsearch $argv -keep]
48 if {$i>=0} {
49 set KEEP 1
@@ -531,11 +534,18 @@
531 # checkout directory. If you are unsure, test $::outside_fossil_repo
532 # or call one of the test_* wrappers below which do that for you.
533 #
534 # As a rule, you should not be calling this function directly!
535 #
536 # 2. The test does NOT modify the Fossil checkout tree in any way.
 
 
 
 
 
 
 
537 proc run_in_checkout { script {dir ""} } {
538 if {[string length $dir] == 0} {set dir $::testfiledir}
539 set savedPwd [pwd]; cd $dir
540 set code [catch {
541 uplevel 1 $script
@@ -548,12 +558,11 @@
548 # optional post-run test script. Some callers choose instead to put
549 # the tests inline with the rscript commands.
550 #
551 # Be sure to adhere to the requirements of run_in_checkout!
552 proc test_block_in_checkout { name rscript {tscript ""} } {
553 if {$::outside_fossil_repo} {
554 puts "Skipping $name test: not in Fossil repo checkout."
555 set $::CODE 0
556 set $::RESULT ""
557 } else {
558 run_in_checkout $rscript
559 if {[string length $tscript] == 0} {
560
--- test/tester.tcl
+++ test/tester.tcl
@@ -40,10 +40,13 @@
40 set outside_fossil_repo [expr ![file exists "$::testfiledir\\..\\_FOSSIL_"]]
41 } else {
42 set outside_fossil_repo [expr ![file exists "$::testfiledir/../.fslckout"]]
43 }
44
45 catch {exec $::fossilexe changes --changed} res
46 set dirty_ckout [string length $res]
47
48 set argv [lrange $argv 1 end]
49
50 set i [lsearch $argv -keep]
51 if {$i>=0} {
52 set KEEP 1
@@ -531,11 +534,18 @@
534 # checkout directory. If you are unsure, test $::outside_fossil_repo
535 # or call one of the test_* wrappers below which do that for you.
536 #
537 # As a rule, you should not be calling this function directly!
538 #
539 # 2. This test run is being done from a repo checkout directory that
540 # doesn't have any uncommitted changes. If it does, that affects the
541 # output of any test based on the output of "fossil status",
542 # "... diff", etc., which is likely to make the test appear to fail.
543 # If you must call this function directly, test $::dirty_ckout and
544 # skip the call if it's true. The test_* wrappers do this for you.
545 #
546 # 3. The test does NOT modify the Fossil checkout tree in any way.
547 proc run_in_checkout { script {dir ""} } {
548 if {[string length $dir] == 0} {set dir $::testfiledir}
549 set savedPwd [pwd]; cd $dir
550 set code [catch {
551 uplevel 1 $script
@@ -548,12 +558,11 @@
558 # optional post-run test script. Some callers choose instead to put
559 # the tests inline with the rscript commands.
560 #
561 # Be sure to adhere to the requirements of run_in_checkout!
562 proc test_block_in_checkout { name rscript {tscript ""} } {
563 if {$::outside_fossil_repo || $::dirty_ckout} {
 
564 set $::CODE 0
565 set $::RESULT ""
566 } else {
567 run_in_checkout $rscript
568 if {[string length $tscript] == 0} {
569
--- test/th1-docs.test
+++ test/th1-docs.test
@@ -16,15 +16,10 @@
1616
############################################################################
1717
#
1818
# TH1 Docs
1919
#
2020
21
-if {$::outside_fossil_repo} {
22
- puts "Skipping th1-docs-* tests: not in Fossil repo checkout."
23
- test_cleanup_then_return
24
-}
25
-
2621
fossil test-th-eval "hasfeature th1Docs"
2722
2823
if {[normalize_result] ne "1"} {
2924
puts "Fossil was not compiled with TH1 docs support."
3025
test_cleanup_then_return
@@ -34,10 +29,18 @@
3429
3530
if {[normalize_result] ne "1"} {
3631
puts "Fossil was not compiled with Tcl support."
3732
test_cleanup_then_return
3833
}
34
+
35
+if {$::outside_fossil_repo} {
36
+ puts "Skipping th1-docs-* tests: not in Fossil repo checkout."
37
+ test_cleanup_then_return
38
+} elseif ($::dirty_ckout) {
39
+ puts "Skipping th1-docs-* tests: uncommitted changes in Fossil checkout."
40
+ test_cleanup_then_return
41
+}
3942
4043
###############################################################################
4144
4245
test_setup ""
4346
4447
--- test/th1-docs.test
+++ test/th1-docs.test
@@ -16,15 +16,10 @@
16 ############################################################################
17 #
18 # TH1 Docs
19 #
20
21 if {$::outside_fossil_repo} {
22 puts "Skipping th1-docs-* tests: not in Fossil repo checkout."
23 test_cleanup_then_return
24 }
25
26 fossil test-th-eval "hasfeature th1Docs"
27
28 if {[normalize_result] ne "1"} {
29 puts "Fossil was not compiled with TH1 docs support."
30 test_cleanup_then_return
@@ -34,10 +29,18 @@
34
35 if {[normalize_result] ne "1"} {
36 puts "Fossil was not compiled with Tcl support."
37 test_cleanup_then_return
38 }
 
 
 
 
 
 
 
 
39
40 ###############################################################################
41
42 test_setup ""
43
44
--- test/th1-docs.test
+++ test/th1-docs.test
@@ -16,15 +16,10 @@
16 ############################################################################
17 #
18 # TH1 Docs
19 #
20
 
 
 
 
 
21 fossil test-th-eval "hasfeature th1Docs"
22
23 if {[normalize_result] ne "1"} {
24 puts "Fossil was not compiled with TH1 docs support."
25 test_cleanup_then_return
@@ -34,10 +29,18 @@
29
30 if {[normalize_result] ne "1"} {
31 puts "Fossil was not compiled with Tcl support."
32 test_cleanup_then_return
33 }
34
35 if {$::outside_fossil_repo} {
36 puts "Skipping th1-docs-* tests: not in Fossil repo checkout."
37 test_cleanup_then_return
38 } elseif ($::dirty_ckout) {
39 puts "Skipping th1-docs-* tests: uncommitted changes in Fossil checkout."
40 test_cleanup_then_return
41 }
42
43 ###############################################################################
44
45 test_setup ""
46
47
--- test/th1.test
+++ test/th1.test
@@ -557,10 +557,12 @@
557557
###############################################################################
558558
559559
set skip_anycap 1
560560
if {$::outside_fossil_repo} {
561561
puts "Skipping th1-anycap-*-1 perm tests: not in Fossil repo checkout."
562
+} elseif ($::dirty_ckout) {
563
+ puts "Skipping th1-anycap-*-1 perm tests: uncommitted changes in Fossil checkout."
562564
} else {
563565
set skip_anycap 0
564566
}
565567
566568
foreach perm [list a b c d e f g h i j k l m n o p q r s t u v w x y z] {
567569
--- test/th1.test
+++ test/th1.test
@@ -557,10 +557,12 @@
557 ###############################################################################
558
559 set skip_anycap 1
560 if {$::outside_fossil_repo} {
561 puts "Skipping th1-anycap-*-1 perm tests: not in Fossil repo checkout."
 
 
562 } else {
563 set skip_anycap 0
564 }
565
566 foreach perm [list a b c d e f g h i j k l m n o p q r s t u v w x y z] {
567
--- test/th1.test
+++ test/th1.test
@@ -557,10 +557,12 @@
557 ###############################################################################
558
559 set skip_anycap 1
560 if {$::outside_fossil_repo} {
561 puts "Skipping th1-anycap-*-1 perm tests: not in Fossil repo checkout."
562 } elseif ($::dirty_ckout) {
563 puts "Skipping th1-anycap-*-1 perm tests: uncommitted changes in Fossil checkout."
564 } else {
565 set skip_anycap 0
566 }
567
568 foreach perm [list a b c d e f g h i j k l m n o p q r s t u v w x y z] {
569

Keyboard Shortcuts

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