1
# Commands covered: running our tests from inside a 'zip' vfs.
3
# This file contains a collection of tests for one or more of the Tcl
4
# built-in commands. Sourcing this file into Tcl runs the tests and
5
# generates output for errors. No output means no errors were found.
7
# Copyright (c) 2001-2002 by Vince Darley.
9
# See the file "license.terms" for information on usage and redistribution
10
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13
if {[lsearch [namespace children] ::tcltest] == -1} {
14
package require tcltest
15
namespace import ::tcltest::*
18
tcltest::testConstraint nativefs \
19
[string equal [lindex [file system [info script]] 0] "native"]
21
proc makeAndMountZipArchive {} {
22
puts stdout "Zipping tests" ; update
23
cd [file dirname [file dirname [file normalize [info script]]]]
24
set filelist [concat [glob -dir [pwd] -join -tails tests *.test] \
25
[glob -dir [pwd] -join -tails tests *.tcl]]
26
catch {file delete [file join tests tests.zip]}
27
eval [list exec zip -q -9 [file join tests tests.zip]] $filelist
28
puts stdout "Done zipping"
29
cd [file dirname [info script]]
31
package require vfs::zip
32
set mount [vfs::zip::Mount tests.zip tests.zip]
34
return [list vfs::zip::Unmount $mount tests.zip]
37
proc makeAndMountMk4Archive {} {
38
puts stdout "Making mk4 archive of tests" ; update
39
cd [file dirname [file dirname [file normalize [info script]]]]
40
catch {file delete [file join tests tests.bin]}
42
puts stdout "Done making mk4 archive"
43
cd [file dirname [info script]]
45
package require vfs::mk4
46
set mount [vfs::mk4::Mount tests.bin tests.bin]
48
return [list vfs::mk4::Unmount $mount tests.bin]
51
# This actually calls the test suite recursively, which probably
52
# causes some problems, although it shouldn't really!
53
test vfsArchive-1.1 {run tests in zip archive} {nativefs} {
54
# If this test fails, you probably don't have 'zip' installed.
58
if {[catch {makeAndMountZipArchive} unmount]} {
59
set res "Couldn't make zip archive to test with: $unmount"
60
puts stderr $::auto_path
75
# This actually calls the test suite recursively, which probably
76
# causes some problems, although it shouldn't really!
77
test vfsArchive-1.2 {run tests in mk4 archive} {nativefs} {
78
# If this test fails, you probably don't have tclkit and 'sdx'
79
# installed. That's not a big deal.
83
if {[catch {makeAndMountMk4Archive} unmount]} {
84
set res "Couldn't make mk4 archive to test with: $unmount"
85
puts stderr $::auto_path