1#!/usr/local/bin/tclsh
2# -*- tcl -*-
3# Generic test application for all test suites
4#
5# This file contains a top-level script to run all of the tests
6# in an extension.  Execute it by invoking "tclsh testshell -testdir ... -load".
7#
8# Derived from tcl 8.2/all.tcl, Copyright (c) 1998-1999 by Scriptics Corporation.
9# Copyright (c) 1999 by andreas Kupries <a.kupries@westend.com>
10#
11# All rights reserved.
12# 
13# CVS $Id: testshell,v 1.1 2002/08/21 05:59:14 andreas_kupries Exp $
14
15if {[lsearch [namespace children] ::tcltest] == -1} {
16    # Initialize autoloader, then load the commands and initialize
17    # the package (constraints and command line argument processing).
18
19    package require tcltest
20    namespace import ::tcltest::*
21}
22
23# Directory containing the tests specified via '-testDir'.
24# Scripts to load the commands to test in '-load' / '-loadfile'.
25
26set ::tcltest::testSingleFile false
27
28puts stdout "Tests running in interp:       [info nameofexecutable]"
29puts stdout "Tests running in working dir:  $::tcltest::testsDirectory"
30
31if {[llength $::tcltest::skip] > 0} {
32    puts stdout "Skipping tests that match:  $::tcltest::skip"
33}
34if {[llength $::tcltest::match] > 0} {
35    puts stdout "Only running tests that match:  $::tcltest::match"
36}
37
38if {[llength $::tcltest::skipFiles] > 0} {
39    puts stdout "Skipping test files that match:  $::tcltest::skipFiles"
40}
41if {[llength $::tcltest::matchFiles] > 0} {
42    puts stdout "Only sourcing test files that match:  $::tcltest::matchFiles"
43}
44
45
46::tcltest::loadTestedCommands
47
48set timeCmd {clock format [clock seconds]}
49puts stdout "Tests began at [eval $timeCmd]"
50
51# Source each of the specified tests
52
53foreach file [lsort [::tcltest::getMatchingFiles]] {
54    set tail [file tail $file]
55    puts stdout $tail
56
57    if {[catch {source $file} msg]} {
58	puts stdout $msg
59    }
60}
61
62# cleanup
63puts stdout "\nTests ended at [eval $timeCmd]"
64::tcltest::cleanupTests 1
65return
66
67