File: all.tcl

package info (click to toggle)
tclvfs 1.3-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,240 kB
  • ctags: 416
  • sloc: tcl: 3,670; xml: 2,882; sh: 2,833; ansic: 1,264; makefile: 58
file content (93 lines) | stat: -rw-r--r-- 2,900 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# all.tcl --
#
# This file contains a top-level script to run all of the Tcl
# tests.  Execute it by invoking "source all.test" when running tcltest
# in this directory.
#
# Copyright (c) 1998-2000 by Scriptics Corporation.
# All rights reserved.
# 
# RCS: @(#) $Id: all.tcl,v 1.2 2004/01/20 15:25:15 vincentdarley Exp $

set tcltestVersion [package require tcltest]
namespace import -force tcltest::*

#tcltest::testsDirectory [file dir [info script]]
#tcltest::runAllTests

set ::tcltest::testSingleFile false
set ::tcltest::testsDirectory [file dir [info script]]

proc vfsCreateInterp {name} {
    # Have to make sure we load the same dll else we'll have multiple
    # copies!
    if {[catch {
	interp create $name 
	$name eval [list package ifneeded vfs 1.3 [package ifneeded vfs 1.3]]
	$name eval [list set ::auto_path $::auto_path]
	$name eval {package require vfs}
    } err]} {
	puts "$err ; $::errorInfo"
    }
}

# Set up auto_path and package indices for loading.  Must make sure we 
# can load the same dll into the main interpreter and sub interps.
proc setupForVfs {lib} {
    namespace eval vfs {}
    global auto_path dir vfs::dll
    set dir [file norm $lib]
    set auto_path [linsert $auto_path 0 $dir]
    uplevel \#0 [list source [file join $dir pkgIndex.tcl]]
    set orig [package ifneeded vfs 1.3]
    set vfs::dll [lindex $orig 2]
    if {![file exists $vfs::dll]} {
	set vfs::dll [file join [pwd] [file tail $vfs::dll]]
	package ifneeded vfs 1.3 [list [lindex $orig 0] [lindex $orig 1] $vfs::dll]
    }
}

# We need to ensure that the testsDirectory is absolute
::tcltest::normalizePath ::tcltest::testsDirectory

if {[lindex [file system $::tcltest::testsDirectory] 0] == "native"} {
    setupForVfs [file join [file dir $::tcltest::testsDirectory] library]
}

package require vfs

puts stdout "Tests running in interp:  [info nameofexecutable]"
puts stdout "Tests running in working dir:  $::tcltest::testsDirectory"
if {[llength $::tcltest::skip] > 0} {
    puts stdout "Skipping tests that match:  $::tcltest::skip"
}
if {[llength $::tcltest::match] > 0} {
    puts stdout "Only running tests that match:  $::tcltest::match"
}

if {[llength $::tcltest::skipFiles] > 0} {
    puts stdout "Skipping test files that match:  $::tcltest::skipFiles"
}
if {[llength $::tcltest::matchFiles] > 0} {
    puts stdout "Only sourcing test files that match:  $::tcltest::matchFiles"
}

tcltest::testConstraint fsIsWritable [expr {1 - [catch {file mkdir isreadonly ; file delete isreadonly}]}]

set timeCmd {clock format [clock seconds]}
puts stdout "Tests began at [eval $timeCmd]"

# source each of the specified tests
foreach file [lsort [::tcltest::getMatchingFiles]] {
    set tail [file tail $file]
    puts stdout $tail
    if {[catch {source $file} msg]} {
	puts stdout $msg
    }
}

# cleanup
puts stdout "\nTests ended at [eval $timeCmd]"
::tcltest::cleanupTests 1
return