File: run.in

package info (click to toggle)
tkrat 1%3A2.2cvs20100105-true-dfsg-6.1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 10,340 kB
  • ctags: 9,259
  • sloc: ansic: 96,057; tcl: 25,667; makefile: 1,638; sh: 282
file content (74 lines) | stat: -rwxr-xr-x 1,365 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
# the next line restarts using wish \
exec @wish@ "$0" "$@"

set tclsh_binary @tclsh@

wm withdraw .

# Change to test directory
cd [file dirname $argv0]

# Setup environment
set errors 0
set HEAD "---"
set LEAD "***"
set dir [pwd]/TESTDIR
if [file exists $dir] {
    file delete -force $dir
}
file mkdir $dir
set debug 0
set passwd {}
set tests {}
set verbose 0
set delay 0
set abortOnError 0
for {set ai 0} {$ai < [llength $argv]} {incr ai} {
    switch [lindex $argv $ai] {
	debug { set debug 1 }
	verbose { set verbose 1 }
	passwd { set passwd [lindex $argv [incr ai]] }
	run { set tests [lindex $argv [incr ai]] }
	delay { set delay 1}
	aoe { set abortOnError 1 }
	default {
	    puts {Usage: run [verbose] [debug] [delay] [passwd PASSWD] [run TESTFILE]}
	    exit 0
	}
    }
}
source setup.tcl

# Allow user to break
if $delay {
    puts "Libraries loaded..."
    after 1000
}

# Run tests
cd $dir
if {0 < [llength $tests]} {
    set at $tests
    set tests ""
    foreach c [list ../$at ../test_$at.tcl ../*$at*] {
	set g [glob -nocomplain $c]
	if {1 == [llength $g]} {
	    lappend tests $g
	    break
	}
    }
    if {"" == $tests} {
	puts "No test specified"
	exit 1
    }
} else {
    set tests [lsort [glob -nocomplain ../test_*.tcl]]
}
foreach st $tests {
    source $st
}
puts "Total number of errors: $errors"

file delete -force $dir
exit