chiark / gitweb /
changelog: start 0.6.8
[secnet.git] / test-common.tcl
1 # This file is part of secnet.
2 # See LICENCE and this file CREDITS for full list of copyright holders.
3 # SPDX-License-Identifier: GPL-3.0-or-later
4 # There is NO WARRANTY.
5
6 proc prefix_some_path {pathvar entry} {
7     global env
8     set l {}
9     catch { set l [split $env($pathvar) :] }
10     set l [concat [list $entry] $l]
11     set env($pathvar) [join $l :]
12 }
13
14 proc prexec {args} {
15     puts "exec $args"
16     eval exec $args
17 }
18
19 if {![catch {
20     set builddir $env(SECNET_TEST_BUILDDIR)
21 }]} {} else {
22     set builddir .
23 }
24
25 if {![catch {
26     set tmp $env(AUTOPKGTEST_ARTIACTS)
27 }]} {} elseif {![catch {
28     set tmp $env(AUTOPKGTEST_TMP)
29 }]} {} elseif {[regsub {^(?:\./)?([sm]test)/t-} $argv0 {\1/d-} tmp]} {
30     set tmp $builddir/$tmp
31     file mkdir $tmp
32 }