Annotation For example/main.tcl

Origin for each line in example/main.tcl from check-in 4a6a7916e7:

ad7092b843 2019-09-16    1: #! /usr/bin/env tclsh
ad7092b843 2019-09-16    2: 
ad7092b843 2019-09-16    3: package require tcltest
ad7092b843 2019-09-16    4: 
10f67b2ced 2019-09-16    5: tcltest::testConstraint tcl87 [string match "8.7.*" [info patchlevel]]
10f67b2ced 2019-09-16    6: 
ad7092b843 2019-09-16    7: tcltest::configure -verbose pbse
ad7092b843 2019-09-16    8: tcltest::configure {*}$argv
ad7092b843 2019-09-16    9: 
57c553f477 2019-09-18   10: if {![info exists ::env(XVFS_ROOT_MOUNTPOINT)]} {
2139fe19a8 2019-09-18   11: 	set xvfsRootMountpoint "//xvfs:/"
57c553f477 2019-09-18   12: } else {
57c553f477 2019-09-18   13: 	set xvfsRootMountpoint $::env(XVFS_ROOT_MOUNTPOINT)
57c553f477 2019-09-18   14: }
57c553f477 2019-09-18   15: 
2139fe19a8 2019-09-18   16: set rootDir "${xvfsRootMountpoint}example"
ad7092b843 2019-09-16   17: set rootDirNative  [file join [pwd] example]
ad7092b843 2019-09-16   18: #set rootDir $rootDirNative
ad7092b843 2019-09-16   19: set testFile "${rootDir}/foo"
ad7092b843 2019-09-16   20: 
ad7092b843 2019-09-16   21: proc glob_verify {args} {
ad7092b843 2019-09-16   22: 	set rv [glob -nocomplain -directory $::rootDir {*}$args]
ad7092b843 2019-09-16   23: 	set verify [glob -nocomplain -directory $::rootDirNative {*}$args]
5583d77f1c 2019-09-14   24: 
5583d77f1c 2019-09-14   25: 	if {[llength $rv] != [llength $verify]} {
5583d77f1c 2019-09-14   26: 		error "VERIFY FAILED: glob ... $args ($rv versus $verify)"
5583d77f1c 2019-09-14   27: 	}
5583d77f1c 2019-09-14   28: 
5583d77f1c 2019-09-14   29: 	return $rv
e6735bc1dd 2019-09-17   30: }
e6735bc1dd 2019-09-17   31: 
e6735bc1dd 2019-09-17   32: proc test_summary {} {
e6735bc1dd 2019-09-17   33: 	set format "| %7s | %7s | %7s | %7s |"
e6735bc1dd 2019-09-17   34: 	set emptyRow [format $format "" "" "" ""]
e6735bc1dd 2019-09-17   35: 	set emptyRowLength [string length $emptyRow]
e6735bc1dd 2019-09-17   36: 	lappend output "/[string repeat - [expr {$emptyRowLength - 2}]]\\"
e6735bc1dd 2019-09-17   37: 	lappend output [format $format "Passed" "Failed" "Skipped" "Total"]
e6735bc1dd 2019-09-17   38: 	lappend output [regsub -all -- " " [regsub -all -- " \\| " $emptyRow " + "] "-"]
e6735bc1dd 2019-09-17   39: 	lappend output [format $format \
e6735bc1dd 2019-09-17   40: 		$::tcltest::numTests(Passed) \
e6735bc1dd 2019-09-17   41: 		$::tcltest::numTests(Failed) \
e6735bc1dd 2019-09-17   42: 		$::tcltest::numTests(Skipped) \
e6735bc1dd 2019-09-17   43: 		$::tcltest::numTests(Total) \
e6735bc1dd 2019-09-17   44: 	]
e6735bc1dd 2019-09-17   45: 	lappend output "\\[string repeat - [expr {$emptyRowLength - 2}]]/"
e6735bc1dd 2019-09-17   46: 
e6735bc1dd 2019-09-17   47: 	return [join $output "\n"]
10f67b2ced 2019-09-16   48: }
10f67b2ced 2019-09-16   49: 
ad7092b843 2019-09-16   50: tcltest::customMatch boolean [list apply {{expected actual} {
ad7092b843 2019-09-16   51: 	if {!!$expected == !!$actual} {
ad7092b843 2019-09-16   52: 		return true
ad7092b843 2019-09-16   53: 	} else {
ad7092b843 2019-09-16   54: 		return false
ad7092b843 2019-09-16   55: 	}
ad7092b843 2019-09-16   56: }}]
ad7092b843 2019-09-16   57: 
10f67b2ced 2019-09-16   58: tcltest::test xvfs-seek-basic "Xvfs Seek Test" -setup {
ad7092b843 2019-09-16   59: 	set fd [open $testFile]
ad7092b843 2019-09-16   60: } -body {
ad7092b843 2019-09-16   61: 	seek $fd 0 end
ad7092b843 2019-09-16   62: 	seek $fd -1 current
ad7092b843 2019-09-16   63: 
ad7092b843 2019-09-16   64: 	read $fd 1
ad7092b843 2019-09-16   65: } -cleanup {
ad7092b843 2019-09-16   66: 	close $fd
ad7092b843 2019-09-16   67: 	unset fd
ad7092b843 2019-09-16   68: } -result "\n"
10f67b2ced 2019-09-16   69: 
10f67b2ced 2019-09-16   70: tcltest::test xvfs-seek-past-eof "Xvfs Seek Past EOF File Test" -setup {
10f67b2ced 2019-09-16   71: 	set fd [open $testFile]
10f67b2ced 2019-09-16   72: } -body {
10f67b2ced 2019-09-16   73: 	seek $fd 1 end
10f67b2ced 2019-09-16   74: } -cleanup {
10f67b2ced 2019-09-16   75: 	close $fd
10f67b2ced 2019-09-16   76: 	unset fd
10f67b2ced 2019-09-16   77: } -match glob -returnCodes error -result "*: invalid argument"
10f67b2ced 2019-09-16   78: 
10f67b2ced 2019-09-16   79: tcltest::test xvfs-seek-past-eof "Xvfs Seek Past EOF File Test" -setup {
10f67b2ced 2019-09-16   80: 	set fd [open $testFile]
10f67b2ced 2019-09-16   81: } -body {
10f67b2ced 2019-09-16   82: 	seek $fd -10 current
10f67b2ced 2019-09-16   83: } -cleanup {
10f67b2ced 2019-09-16   84: 	close $fd
10f67b2ced 2019-09-16   85: 	unset fd
10f67b2ced 2019-09-16   86: } -match glob -returnCodes error -result "*: invalid argument"
10f67b2ced 2019-09-16   87: 
10f67b2ced 2019-09-16   88: tcltest::test xvfs-seek-read-past-eof "Xvfs Seek Then Read Past EOF Test" -setup {
10f67b2ced 2019-09-16   89: 	set fd [open $testFile]
10f67b2ced 2019-09-16   90: } -body {
10f67b2ced 2019-09-16   91: 	seek $fd 0 end
10f67b2ced 2019-09-16   92: 
10f67b2ced 2019-09-16   93: 	read $fd 1
10f67b2ced 2019-09-16   94: 	read $fd 1
10f67b2ced 2019-09-16   95: } -cleanup {
10f67b2ced 2019-09-16   96: 	close $fd
10f67b2ced 2019-09-16   97: 	unset fd
10f67b2ced 2019-09-16   98: } -result ""
10f67b2ced 2019-09-16   99: 
e786b9e07b 2019-09-16  100: tcltest::test xvfs-basic-open-neg "Xvfs Open Non-Existant File Test" -body {
e786b9e07b 2019-09-16  101: 	unset -nocomplain fd
e786b9e07b 2019-09-16  102: 	set fd [open $rootDir/does-not-exist]
e786b9e07b 2019-09-16  103: } -cleanup {
e786b9e07b 2019-09-16  104: 	if {[info exists fd]} {
e786b9e07b 2019-09-16  105: 		close $fd
e786b9e07b 2019-09-16  106: 		unset fd
e786b9e07b 2019-09-16  107: 	}
e786b9e07b 2019-09-16  108: } -returnCodes error -result "no such file or directory"
e786b9e07b 2019-09-16  109: 
e786b9e07b 2019-09-16  110: tcltest::test xvfs-basic-open-write "Xvfs Open For Writing Test" -body {
10f67b2ced 2019-09-16  111: 	unset -nocomplain fd
10f67b2ced 2019-09-16  112: 	set fd [open $rootDir/new-file w]
10f67b2ced 2019-09-16  113: } -cleanup {
10f67b2ced 2019-09-16  114: 	if {[info exists fd]} {
10f67b2ced 2019-09-16  115: 		close $fd
10f67b2ced 2019-09-16  116: 		unset fd
10f67b2ced 2019-09-16  117: 	}
10f67b2ced 2019-09-16  118: 	catch {
10f67b2ced 2019-09-16  119: 		file delete $rootDir/new-file
10f67b2ced 2019-09-16  120: 	}
10f67b2ced 2019-09-16  121: } -match glob -returnCodes error -result "*read*only file*system*"
e786b9e07b 2019-09-16  122: 
e786b9e07b 2019-09-16  123: tcltest::test xvfs-basic-open-directory "Xvfs Open Directory Test" -body {
e786b9e07b 2019-09-16  124: 	unset -nocomplain fd
e786b9e07b 2019-09-16  125: 	set fd [open $rootDir/lib]
e786b9e07b 2019-09-16  126: 	set fd
e786b9e07b 2019-09-16  127: } -cleanup {
e786b9e07b 2019-09-16  128: 	if {[info exists fd]} {
e786b9e07b 2019-09-16  129: 		close $fd
e786b9e07b 2019-09-16  130: 		unset fd
e786b9e07b 2019-09-16  131: 	}
e786b9e07b 2019-09-16  132: } -match glob -returnCodes error -result "*illegal operation on a directory"
ad7092b843 2019-09-16  133: 
ad7092b843 2019-09-16  134: tcltest::test xvfs-basic-two-files "Xvfs Multiple Open Files Test" -setup {
ad7092b843 2019-09-16  135: 	set fd1 [open $testFile]
ad7092b843 2019-09-16  136: 	set fd2 [open $testFile]
ad7092b843 2019-09-16  137: } -body {
ad7092b843 2019-09-16  138: 	set data1 [read $fd1]
ad7092b843 2019-09-16  139: 	close $fd1
ad7092b843 2019-09-16  140: 	set data2 [read $fd2]
ad7092b843 2019-09-16  141: 	close $fd2
ad7092b843 2019-09-16  142: 
ad7092b843 2019-09-16  143: 	expr {$data1 eq $data2}
ad7092b843 2019-09-16  144: } -cleanup {
ad7092b843 2019-09-16  145: 	unset -nocomplain fd1 fd2 data1 data2
ad7092b843 2019-09-16  146: } -match boolean -result true
ad7092b843 2019-09-16  147: 
ad7092b843 2019-09-16  148: tcltest::test xvfs-events "Xvfs Fileevent Test" -setup {
ad7092b843 2019-09-16  149: 	set fd [open $testFile]
ad7092b843 2019-09-16  150: 	seek $fd 0 end
ad7092b843 2019-09-16  151: 	set size [tell $fd]
ad7092b843 2019-09-16  152: 	seek $fd 0 start
ad7092b843 2019-09-16  153: 
ad7092b843 2019-09-16  154: 	set done false
ad7092b843 2019-09-16  155: 	set calls 0
ad7092b843 2019-09-16  156: 	set output ""
ad7092b843 2019-09-16  157: } -body {
ad7092b843 2019-09-16  158: 	fileevent $fd readable [list apply {{fd} {
ad7092b843 2019-09-16  159: 		set pos [tell $fd]
ad7092b843 2019-09-16  160: 		set x [read $fd 1]
ad7092b843 2019-09-16  161: 		if {[string length $x] == 0} {
ad7092b843 2019-09-16  162: 			set ::done true
ad7092b843 2019-09-16  163: 			fileevent $fd readable ""
ad7092b843 2019-09-16  164: 		}
ad7092b843 2019-09-16  165: 
ad7092b843 2019-09-16  166: 		lappend ::output $pos
ad7092b843 2019-09-16  167: 		incr ::calls
ad7092b843 2019-09-16  168: 	}} $fd]
ad7092b843 2019-09-16  169: 	vwait done
ad7092b843 2019-09-16  170: 
ad7092b843 2019-09-16  171: 	list [expr {$calls == ($size + 1)}] [expr {[lsort -integer $output] eq $output}]
ad7092b843 2019-09-16  172: } -cleanup {
ad7092b843 2019-09-16  173: 	close $fd
10f67b2ced 2019-09-16  174: 	update
ad7092b843 2019-09-16  175: 	unset -nocomplain fd size done calls output
ad7092b843 2019-09-16  176: } -result {1 1}
10f67b2ced 2019-09-16  177: 
10f67b2ced 2019-09-16  178: tcltest::test xvfs-match-almost-root-neg "Xvfs Match Almost Root" -body {
10f67b2ced 2019-09-16  179: 	file exists ${rootDir}_DOES_NOT_EXIST
10f67b2ced 2019-09-16  180: } -match boolean -result false
ad7092b843 2019-09-16  181: 
ad7092b843 2019-09-16  182: tcltest::test xvfs-glob-basic-any "Xvfs Glob Match Any Test" -body {
ad7092b843 2019-09-16  183: 	llength [glob_verify *]
ad7092b843 2019-09-16  184: } -result 3
10f67b2ced 2019-09-16  185: 
3d002d6892 2019-09-16  186: tcltest::test xvfs-glob-files-any "Xvfs Glob Match Any File Test" -body {
3d002d6892 2019-09-16  187: 	llength [glob_verify -type f *]
3d002d6892 2019-09-16  188: } -result 2
3d002d6892 2019-09-16  189: 
3d002d6892 2019-09-16  190: tcltest::test xvfs-glob-dir-any "Xvfs Glob On a File Test" -body {
3d002d6892 2019-09-16  191: 	glob -nocomplain -directory $testFile *
3d002d6892 2019-09-16  192: } -returnCodes error -result "not a directory"
3d002d6892 2019-09-16  193: 
ad7092b843 2019-09-16  194: tcltest::test xvfs-glob-basic-limited "Xvfs Glob Match Limited Test" -body {
ad7092b843 2019-09-16  195: 	llength [glob_verify f*]
ad7092b843 2019-09-16  196: } -result 1
ad7092b843 2019-09-16  197: 
ad7092b843 2019-09-16  198: tcltest::test xvfs-glob-basic-limited-neg "Xvfs Glob Match Limited Negative Test" -body {
ad7092b843 2019-09-16  199: 	llength [glob_verify x*]
ad7092b843 2019-09-16  200: } -result 0
ad7092b843 2019-09-16  201: 
ad7092b843 2019-09-16  202: tcltest::test xvfs-glob-basic-limited-prefixed "Xvfs Glob Match Limited But With Directory Prefix Test" -body {
ad7092b843 2019-09-16  203: 	llength [glob_verify ./f*]
ad7092b843 2019-09-16  204: } -result 1
ad7092b843 2019-09-16  205: 
ad7092b843 2019-09-16  206: tcltest::test xvfs-glob-basic-limited-and-typed-prefixed "Xvfs Glob Match Limited Path and Type Positive Test" -body {
ad7092b843 2019-09-16  207: 	llength [glob_verify -type f ./f*]
ad7092b843 2019-09-16  208: } -result 1
ad7092b843 2019-09-16  209: 
ad7092b843 2019-09-16  210: tcltest::test xvfs-glob-basic-limited-and-typed-prefixed-neg "Xvfs Glob Match Limited Path and Type Negative Test" -body {
ad7092b843 2019-09-16  211: 	llength [glob_verify -type d ./f*]
ad7092b843 2019-09-16  212: } -result 0
ad7092b843 2019-09-16  213: 
ad7092b843 2019-09-16  214: tcltest::test xvfs-glob-basic-limited-prefixed-other-dir-1 "Xvfs Glob Match Directory Included in Search Test (Count)" -body {
ad7092b843 2019-09-16  215: 	llength [glob_verify lib/*]
ad7092b843 2019-09-16  216: } -result 1
ad7092b843 2019-09-16  217: 
ad7092b843 2019-09-16  218: tcltest::test xvfs-glob-basic-limited-prefixed-other-dir-2 "Xvfs Glob Match Directory Included in Search Test (Value)" -body {
ad7092b843 2019-09-16  219: 	lindex [glob_verify lib/*] 0
ad7092b843 2019-09-16  220: } -match glob -result "$rootDir/*"
ad7092b843 2019-09-16  221: 
3d002d6892 2019-09-16  222: tcltest::test xvfs-glob-no-dir "Xvfs Glob Non-Existant Directory Test" -body {
3d002d6892 2019-09-16  223: 	glob_verify libx/*
3d002d6892 2019-09-16  224: } -returnCodes error -result "no such file or directory"
3d002d6892 2019-09-16  225: 
3d002d6892 2019-09-16  226: tcltest::test xvfs-glob-pipes "Xvfs Glob Pipes Test " -body {
3d002d6892 2019-09-16  227: 	glob_verify -types {p b c s l} lib/*
3d002d6892 2019-09-16  228: } -result ""
3d002d6892 2019-09-16  229: 
3d002d6892 2019-09-16  230: tcltest::test xvfs-glob-writable "Xvfs Glob Writable Test " -body {
3d002d6892 2019-09-16  231: 	glob -nocomplain -directory $rootDir -types w *
3d002d6892 2019-09-16  232: } -result ""
3d002d6892 2019-09-16  233: 
3d002d6892 2019-09-16  234: tcltest::test xvfs-glob-hidden "Xvfs Glob Hidden Test " -body {
3d002d6892 2019-09-16  235: 	glob -nocomplain -directory $rootDir -types hidden *
3d002d6892 2019-09-16  236: } -result ""
3d002d6892 2019-09-16  237: 
3d002d6892 2019-09-16  238: tcltest::test xvfs-glob-executable "Xvfs Glob Executable Test " -body {
3d002d6892 2019-09-16  239: 	glob -nocomplain -directory $rootDir -types x *
3d002d6892 2019-09-16  240: } -result $rootDir/lib
3d002d6892 2019-09-16  241: 
b502b175ea 2020-04-13  242: tcltest::test xvfs-glob-trailing-slash-1 "Xvfs Glob Trailing Slash Test" -body {
b502b175ea 2020-04-13  243: 	llength [glob -nocomplain -directory $rootDir/ *]
b502b175ea 2020-04-13  244: } -result 3
b502b175ea 2020-04-13  245: 
32bd347b13 2020-04-13  246: tcltest::test xvfs-glob-trailing-slash-2 "Xvfs Glob Trailing Slashes Test" -body {
32bd347b13 2020-04-13  247: 	llength [glob -nocomplain -directory $rootDir//// *]
32bd347b13 2020-04-13  248: } -result 3
32bd347b13 2020-04-13  249: 
32bd347b13 2020-04-13  250: tcltest::test xvfs-glob-middle-slash-1 "Xvfs Glob Middle Slash Test" -body {
32bd347b13 2020-04-13  251: 	llength [glob -nocomplain -directory $rootDir/lib// *]
32bd347b13 2020-04-13  252: } -result 1 -constraints knownBug
32bd347b13 2020-04-13  253: 
10f67b2ced 2019-09-16  254: tcltest::test xvfs-access-basic-read "Xvfs acccess Read Basic Test" -body {
10f67b2ced 2019-09-16  255: 	file readable $testFile
10f67b2ced 2019-09-16  256: } -match boolean -result true
10f67b2ced 2019-09-16  257: 
10f67b2ced 2019-09-16  258: tcltest::test xvfs-access-basic-write "Xvfs acccess Write Basic Test" -body {
10f67b2ced 2019-09-16  259: 	file writable $testFile
10f67b2ced 2019-09-16  260: } -match boolean -result false
10f67b2ced 2019-09-16  261: 
10f67b2ced 2019-09-16  262: tcltest::test xvfs-access-basic-neg "Xvfs acccess Basic Negative Test" -body {
10f67b2ced 2019-09-16  263: 	file executable $testFile
3d002d6892 2019-09-16  264: } -match boolean -result false
3d002d6892 2019-09-16  265: 
3d002d6892 2019-09-16  266: tcltest::test xvfs-access-similar-neg "Xvfs acccess Similar Negative Test" -body {
3d002d6892 2019-09-16  267: 	file executable ${rootDir}_DOES_NOT_EXIST
10f67b2ced 2019-09-16  268: } -match boolean -result false
10f67b2ced 2019-09-16  269: 
10f67b2ced 2019-09-16  270: tcltest::test xvfs-exists-basic-neg "Xvfs exists Basic Negative Test" -body {
10f67b2ced 2019-09-16  271: 	file exists $rootDir/does-not-exist 
10f67b2ced 2019-09-16  272: } -match boolean -result false
10f67b2ced 2019-09-16  273: 
10f67b2ced 2019-09-16  274: tcltest::test xvfs-stat-basic-file "Xvfs stat Basic File Test" -body {
10f67b2ced 2019-09-16  275: 	file stat $testFile fileInfo
10f67b2ced 2019-09-16  276: 	set fileInfo(type)
10f67b2ced 2019-09-16  277: } -cleanup {
10f67b2ced 2019-09-16  278: 	unset -nocomplain fileInfo
10f67b2ced 2019-09-16  279: } -result file
10f67b2ced 2019-09-16  280: 
e786b9e07b 2019-09-16  281: tcltest::test xvfs-stat-basic-file-neg "Xvfs stat Basic File Negative Test" -body {
e786b9e07b 2019-09-16  282: 	file stat $rootDir/does-not-exist fileInfo
e786b9e07b 2019-09-16  283: } -cleanup {
e786b9e07b 2019-09-16  284: 	unset -nocomplain fileInfo
e786b9e07b 2019-09-16  285: } -match glob -returnCodes error -result "*no such file or directory"
e786b9e07b 2019-09-16  286: 
10f67b2ced 2019-09-16  287: tcltest::test xvfs-stat-basic-dir "Xvfs stat Basic Directory Test" -body {
10f67b2ced 2019-09-16  288: 	file stat $rootDir/lib fileInfo
10f67b2ced 2019-09-16  289: 	set fileInfo(type)
10f67b2ced 2019-09-16  290: } -cleanup {
10f67b2ced 2019-09-16  291: 	unset -nocomplain fileInfo
10f67b2ced 2019-09-16  292: } -result directory
4a6a7916e7 2020-04-13  293: 
4a6a7916e7 2020-04-13  294: tcltest::test xvfs-child-interp-basic "Xvfs Child Interp Test" -setup {
4a6a7916e7 2020-04-13  295: 	set interp [interp create]
4a6a7916e7 2020-04-13  296: } -body {
4a6a7916e7 2020-04-13  297: 	llength [$interp eval [list glob -nocomplain -directory $rootDir *]]
4a6a7916e7 2020-04-13  298: } -cleanup {
4a6a7916e7 2020-04-13  299: 	interp delete $interp
4a6a7916e7 2020-04-13  300: 	unset -nocomplain $interp
4a6a7916e7 2020-04-13  301: } -result 3
4a6a7916e7 2020-04-13  302: 
4a6a7916e7 2020-04-13  303: tcltest::test xvfs-thread-interp-basic "Xvfs Thread Interp Test" -setup {
4a6a7916e7 2020-04-13  304: 	package require Thread
4a6a7916e7 2020-04-13  305: 	set thread [thread::create -joinable]
4a6a7916e7 2020-04-13  306: } -body {
4a6a7916e7 2020-04-13  307: 	llength [thread::send $thread [list glob -nocomplain -directory $rootDir *]]
4a6a7916e7 2020-04-13  308: } -cleanup {
4a6a7916e7 2020-04-13  309: 	thread::release -wait $thread
4a6a7916e7 2020-04-13  310: 	thread::join $thread
4a6a7916e7 2020-04-13  311: 	unset -nocomplain $thread
4a6a7916e7 2020-04-13  312: } -result 3
57c553f477 2019-09-18  313: 
ad7092b843 2019-09-16  314: # Broken in Tcl 8.6 and earlier
ad7092b843 2019-09-16  315: tcltest::test xvfs-glob-advanced-dir-with-pattern "Xvfs Glob Match Pattern and Directory Together" -body {
57c553f477 2019-09-18  316: 	llength [glob ${rootDir}/*]
ad7092b843 2019-09-16  317: } -constraints tcl87 -result 3
ad7092b843 2019-09-16  318: 
ad7092b843 2019-09-16  319: tcltest::test xvfs-glob-file-dirname "Xvfs Relies on file dirname" -body {
ad7092b843 2019-09-16  320: 	lindex [glob -directory [file dirname $testFile] *] 0
ad7092b843 2019-09-16  321: } -constraints tcl87 -match glob -result "$rootDir/*"
ad7092b843 2019-09-16  322: 
ad7092b843 2019-09-16  323: tcltest::test xvfs-cwd-1 "Xvfs Can Be cwd" -setup {
ad7092b843 2019-09-16  324: 	set startDir [pwd]
ad7092b843 2019-09-16  325: } -body {
ad7092b843 2019-09-16  326: 	cd $rootDir
ad7092b843 2019-09-16  327: 	pwd
ad7092b843 2019-09-16  328: } -cleanup {
ad7092b843 2019-09-16  329: 	cd $startDir
ad7092b843 2019-09-16  330: 	unset startDir
e4bde431db 2019-09-16  331: } -constraints tcl87 -result $rootDir
ad7092b843 2019-09-16  332: 
ad7092b843 2019-09-16  333: tcltest::test xvfs-cwd-2 "Xvfs Can Be cwd" -setup {
ad7092b843 2019-09-16  334: 	set startDir [pwd]
ad7092b843 2019-09-16  335: } -body {
ad7092b843 2019-09-16  336: 	cd $rootDir
ad7092b843 2019-09-16  337: 	cd lib
ad7092b843 2019-09-16  338: 	lindex [glob *] 0
ad7092b843 2019-09-16  339: } -cleanup {
ad7092b843 2019-09-16  340: 	cd $startDir
ad7092b843 2019-09-16  341: 	unset startDir
e4bde431db 2019-09-16  342: } -constraints tcl87 -result "hello"
ad7092b843 2019-09-16  343: 
ad7092b843 2019-09-16  344: # Currently broken
ad7092b843 2019-09-16  345: tcltest::test xvfs-package "Xvfs Can Be Package Directory" -setup {
ad7092b843 2019-09-16  346: 	set startAutoPath $auto_path
ad7092b843 2019-09-16  347: 	lappend auto_path ${rootDir}/lib
ad7092b843 2019-09-16  348: } -body {
ad7092b843 2019-09-16  349: 	package require hello
ad7092b843 2019-09-16  350: 	set auto_path
ad7092b843 2019-09-16  351: } -cleanup {
ad7092b843 2019-09-16  352: 	set auto_path $startAutoPath
ad7092b843 2019-09-16  353: 	unset startAutoPath
ad7092b843 2019-09-16  354: } -constraints knownBug -result ""
ad7092b843 2019-09-16  355: 
ad7092b843 2019-09-16  356: # Output results
ad7092b843 2019-09-16  357: if {$::tcltest::numTests(Failed) != 0} {
e6735bc1dd 2019-09-17  358: 	puts [test_summary]
10f67b2ced 2019-09-16  359: 	if {[info exists ::env(XVFS_TEST_EXIT_ON_FAILURE)]} {
10f67b2ced 2019-09-16  360: 		exit $::env(XVFS_TEST_EXIT_ON_FAILURE)
10f67b2ced 2019-09-16  361: 	}
ad7092b843 2019-09-16  362: 	exit 1
ad7092b843 2019-09-16  363: }
ad7092b843 2019-09-16  364: 
e6735bc1dd 2019-09-17  365: puts [test_summary]
5583d77f1c 2019-09-14  366: puts "ALL TESTS PASSED"
ad7092b843 2019-09-16  367: 
10f67b2ced 2019-09-16  368: if {[info exists ::env(XVFS_TEST_EXIT_ON_SUCCESS)]} {
10f67b2ced 2019-09-16  369: 	exit $::env(XVFS_TEST_EXIT_ON_SUCCESS)
10f67b2ced 2019-09-16  370: }
ad7092b843 2019-09-16  371: exit 0