Fossil

Check-in [78ec6838]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | wrap-run_in_checkout
Files: files | file ages | folders
SHA3-256: 78ec683882d697712126ad778b36ae1212aeebcbd93ee0589a1ef457abe8c371
User & Date: wyoung 2018-09-03 06:27:07.369
Context
2018-09-03
07:06
Merged wrap-run_in_checkout branch down to trunk. ... (check-in: 49e86fe0 user: wyoung tags: trunk)
06:27
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. ... (Closed-Leaf check-in: 78ec6838 user: wyoung tags: wrap-run_in_checkout)
06:22
Partially reverted one of the run_in_checkout replacements in test/th1.test: it was inside a foreach loop, which means the test for whether we're inside the Fossil repo checkout was being done 26 times. This is not only inefficient, it spammed the output with "Skipping test blabla..." lines. Now doing a manual check outside the loop and skipping the in-repo tests silently inside the loop. ... (check-in: 3cb1b4f0 user: wyoung tags: wrap-run_in_checkout)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/tester.tcl.
38
39
40
41
42
43
44



45
46
47
48
49
50
51
    append fossilexe .exe
  }
  set outside_fossil_repo [expr ![file exists "$::testfiledir\\..\\_FOSSIL_"]]
} else {
  set outside_fossil_repo [expr ![file exists "$::testfiledir/../.fslckout"]]
}




set argv [lrange $argv 1 end]

set i [lsearch $argv -keep]
if {$i>=0} {
  set KEEP 1
  set argv [lreplace $argv $i $i]
} else {







>
>
>







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
    append fossilexe .exe
  }
  set outside_fossil_repo [expr ![file exists "$::testfiledir\\..\\_FOSSIL_"]]
} else {
  set outside_fossil_repo [expr ![file exists "$::testfiledir/../.fslckout"]]
}

catch {exec $::fossilexe changes --changed} res
set dirty_ckout [string length $res]

set argv [lrange $argv 1 end]

set i [lsearch $argv -keep]
if {$i>=0} {
  set KEEP 1
  set argv [lreplace $argv $i $i]
} else {
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
#
# 1. This test run is in fact being done from within a Fossil repo
#    checkout directory.  If you are unsure, test $::outside_fossil_repo
#    or call one of the test_* wrappers below which do that for you.
#
#    As a rule, you should not be calling this function directly!
#







# 2. The test does NOT modify the Fossil checkout tree in any way.
proc run_in_checkout { script {dir ""} } {
  if {[string length $dir] == 0} {set dir $::testfiledir}
  set savedPwd [pwd]; cd $dir
  set code [catch {
    uplevel 1 $script
  } result]
  cd $savedPwd; unset savedPwd
  return -code $code $result
}

# Wrapper for the above function pair.  The tscript parameter is an
# optional post-run test script.  Some callers choose instead to put
# the tests inline with the rscript commands.
#
# Be sure to adhere to the requirements of run_in_checkout!
proc test_block_in_checkout { name rscript {tscript ""} } {
  if {$::outside_fossil_repo} {
    puts "Skipping $name test: not in Fossil repo checkout."
    set $::CODE 0
    set $::RESULT ""
  } else {
    run_in_checkout $rscript
    if {[string length $tscript] == 0} {
      return ""
    } else {







>
>
>
>
>
>
>
|
















|
<







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
#
# 1. This test run is in fact being done from within a Fossil repo
#    checkout directory.  If you are unsure, test $::outside_fossil_repo
#    or call one of the test_* wrappers below which do that for you.
#
#    As a rule, you should not be calling this function directly!
#
# 2. This test run is being done from a repo checkout directory that
#    doesn't have any uncommitted changes.  If it does, that affects the
#    output of any test based on the output of "fossil status",
#    "... diff", etc., which is likely to make the test appear to fail.
#    If you must call this function directly, test $::dirty_ckout and
#    skip the call if it's true.  The test_* wrappers do this for you.
#
# 3. The test does NOT modify the Fossil checkout tree in any way.
proc run_in_checkout { script {dir ""} } {
  if {[string length $dir] == 0} {set dir $::testfiledir}
  set savedPwd [pwd]; cd $dir
  set code [catch {
    uplevel 1 $script
  } result]
  cd $savedPwd; unset savedPwd
  return -code $code $result
}

# Wrapper for the above function pair.  The tscript parameter is an
# optional post-run test script.  Some callers choose instead to put
# the tests inline with the rscript commands.
#
# Be sure to adhere to the requirements of run_in_checkout!
proc test_block_in_checkout { name rscript {tscript ""} } {
  if {$::outside_fossil_repo || $::dirty_ckout} {

    set $::CODE 0
    set $::RESULT ""
  } else {
    run_in_checkout $rscript
    if {[string length $tscript] == 0} {
      return ""
    } else {
Changes to test/th1-docs.test.
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
#   http://www.hwaci.com/drh/
#
############################################################################
#
# TH1 Docs
#

if {$::outside_fossil_repo} {
  puts "Skipping th1-docs-* tests: not in Fossil repo checkout."
  test_cleanup_then_return
}

fossil test-th-eval "hasfeature th1Docs"

if {[normalize_result] ne "1"} {
  puts "Fossil was not compiled with TH1 docs support."
  test_cleanup_then_return
}

fossil test-th-eval "hasfeature tcl"

if {[normalize_result] ne "1"} {
  puts "Fossil was not compiled with Tcl support."
  test_cleanup_then_return
}









###############################################################################

test_setup ""

###############################################################################








<
<
<
<
<













>
>
>
>
>
>
>
>







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
46
47
48
#   http://www.hwaci.com/drh/
#
############################################################################
#
# TH1 Docs
#






fossil test-th-eval "hasfeature th1Docs"

if {[normalize_result] ne "1"} {
  puts "Fossil was not compiled with TH1 docs support."
  test_cleanup_then_return
}

fossil test-th-eval "hasfeature tcl"

if {[normalize_result] ne "1"} {
  puts "Fossil was not compiled with Tcl support."
  test_cleanup_then_return
}

if {$::outside_fossil_repo} {
  puts "Skipping th1-docs-* tests: not in Fossil repo checkout."
  test_cleanup_then_return
} elseif ($::dirty_ckout) {
  puts "Skipping th1-docs-* tests: uncommitted changes in Fossil checkout."
  test_cleanup_then_return
}

###############################################################################

test_setup ""

###############################################################################

Changes to test/th1.test.
555
556
557
558
559
560
561


562
563
564
565
566
567
568
test th1-expr-49 {$RESULT eq {TH_ERROR: expected integer, got: "-0x"}}

###############################################################################

set skip_anycap 1
if {$::outside_fossil_repo} {
  puts "Skipping th1-anycap-*-1 perm tests: not in Fossil repo checkout."


} else {
  set skip_anycap 0
}

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] {
  if {$perm eq "u"} continue; # NOTE: Skip "reader" meta-permission.
  if {$perm eq "v"} continue; # NOTE: Skip "developer" meta-permission.







>
>







555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
test th1-expr-49 {$RESULT eq {TH_ERROR: expected integer, got: "-0x"}}

###############################################################################

set skip_anycap 1
if {$::outside_fossil_repo} {
  puts "Skipping th1-anycap-*-1 perm tests: not in Fossil repo checkout."
} elseif ($::dirty_ckout) {
  puts "Skipping th1-anycap-*-1 perm tests: uncommitted changes in Fossil checkout."
} else {
  set skip_anycap 0
}

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] {
  if {$perm eq "u"} continue; # NOTE: Skip "reader" meta-permission.
  if {$perm eq "v"} continue; # NOTE: Skip "developer" meta-permission.