Check-in [2416dce66e]

Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Extended test utilities - kt semi-local* : Search local first, then global - kt in : Change test directory context.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:2416dce66ed8b5a4ba3f378755686a22c871765ff9a4984f0c11ef2508b2a6b9
User & Date: aku 2018-09-08 04:28:40
Context
2018-09-12
23:27
Fixed test utilities - Process --notfile, --file in Kettle instead of passing into the test file. Our testmain does not use the relevant command from Tcltest where this information would be used. Leaf check-in: 9a1f50ef97 user: aku tags: trunk
2018-09-08
04:28
Extended test utilities - kt semi-local* : Search local first, then global - kt in : Change test directory context. check-in: 2416dce66e user: aku tags: trunk
2018-07-11
04:01
Extended testsuite support with --valgrind. check-in: 788e5e66a9 user: aku tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to testutilities.tcl.

5
6
7
8
9
10
11












12
13
14
15
16
17
18
19
20
21
22
..
99
100
101
102
103
104
105





























106
107
108
109
110
111
112
namespace eval ::kt {
    namespace export {[a-z]*}
    namespace ensemble create
}

# # ## ### ##### ######## ############# #####################
## API. Use of files relative to the test directory.













proc ::kt::source {path} {
    variable ::tcltest::testsDirectory
    uplevel 1 [list ::source [file join $testsDirectory $path]]
}

proc ::kt::find {pattern} {
    return [lsort -dict [glob -nocomplain -directory $::tcltest::testsDirectory $pattern]]
}

proc ::kt::source* {pattern} {
................................................................................
    } finally {
	package unknown $saved
    }

    puts "LOCAL  [dict get $tag $type] $name [package present $name]"
    return
}






























proc ::kt::PU {name args} {
    global   auto_path
    variable localprefix

    set saved $auto_path
    set auto_path [list $localprefix/lib]







>
>
>
>
>
>
>
>
>
>
>
>



|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
...
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
namespace eval ::kt {
    namespace export {[a-z]*}
    namespace ensemble create
}

# # ## ### ##### ######## ############# #####################
## API. Use of files relative to the test directory.

proc ::kt::in {path script} {
    # change context to a different test suite
    variable ::tcltest::testsDirectory
    set saved $testsDirectory
    set testsDirectory [file normalize [file join $testsDirectory $path]]
    try {
	uplevel 1 $script
    } finally {
	set testsDirectory $saved
    }
}

proc ::kt::source {path} {
    variable ::tcltest::testsDirectory
    uplevel 1 [list ::source [file normalize [file join $testsDirectory $path]]]
}

proc ::kt::find {pattern} {
    return [lsort -dict [glob -nocomplain -directory $::tcltest::testsDirectory $pattern]]
}

proc ::kt::source* {pattern} {
................................................................................
    } finally {
	package unknown $saved
    }

    puts "LOCAL  [dict get $tag $type] $name [package present $name]"
    return
}

proc ::kt::semi-local* {type name args} {
    variable tag
    # Specialized package require. It searches the local installation
    # first, via a custom unknown handler temporarily replacing the
    # regular functionality. If that fails the regular set of packages
    # is checked too.

    set saved [package unknown]
    try {
	package unknown ::kt::PU
	package require $name {*}$args
	puts "LOCAL  [dict get $tag $type] $name [package present $name]"
    } on error {e o} {
	package unknown $saved
	try {
	    package require $name {*}$args
	    puts "SYSTEM [dict get $tag $type] $name [package present $name]"
	} on error {e o} {
	    puts "    Aborting the tests found in \"[file tail [info script]]\""
	    puts "    Required semi-local package $name not found: $e"
	    puts "    |[join [split [dict get $o -errorinfo] \n] "\n    |"]"
	    return -code return
	}
    } finally {
	package unknown $saved
    }
    return
}

proc ::kt::PU {name args} {
    global   auto_path
    variable localprefix

    set saved $auto_path
    set auto_path [list $localprefix/lib]