From 03fd7ea46e40ed553f53502c6f1cee38ccef21ff Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Tue, 14 May 2019 06:32:30 +0200 Subject: [PATCH] ts: superseded defs between siteconfig files --- testsuite/example/siteconfig.tcl-2 | 15 ++++++++++----- testsuite/modules.00-init/120-siteconfig.exp | 15 +++++++-------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/testsuite/example/siteconfig.tcl-2 b/testsuite/example/siteconfig.tcl-2 index ad5729ab..ad053cb5 100644 --- a/testsuite/example/siteconfig.tcl-2 +++ b/testsuite/example/siteconfig.tcl-2 @@ -1,7 +1,12 @@ # -*- tcl -*- -proc someUserProc {} { - puts stderr "someUserProc" -} +# disable debug mode if following environment variable is set +if {[info exists env(TESTSUITE_ENABLE_SITECONFIG_DEBUG)]} { + set g_debug 0 +} else { + proc someUserProc {} { + puts stderr "someUserProc" + } -# execute this user-proc to print something to stderr -someUserProc + # execute this user-proc to print something to stderr + someUserProc +} diff --git a/testsuite/modules.00-init/120-siteconfig.exp b/testsuite/modules.00-init/120-siteconfig.exp index 877ed794..2a2d248d 100644 --- a/testsuite/modules.00-init/120-siteconfig.exp +++ b/testsuite/modules.00-init/120-siteconfig.exp @@ -47,10 +47,7 @@ if {$is_stderr_tty} { # no procedure superseding test, already handled in 100-pager tests # test variable superseding -if { $verbose > 0 } { - send_user "\tSetup TESTSUITE_ENABLE_SITECONFIG_DEBUG = '1'\n" -} -set env(TESTSUITE_ENABLE_SITECONFIG_DEBUG) 1 +setenv_var TESTSUITE_ENABLE_SITECONFIG_DEBUG 1 set ans [list] lappend ans "DEBUG CALLING $MODULECMD sh -V" @@ -62,11 +59,13 @@ lappend ans "DEBUG getColor: color set to '0'" lappend ans "Modules Release \[0-9a-zA-Z\.\+\\-\]+ \\(\[0-9\-\]{10}\\)" testouterr_cmd_re "sh" "-V" "" [join $ans "\n"] +# test variable superseding of regular siteconfig file by additional siteconfig file +setenv_var MODULES_SITECONFIG testsuite/example/siteconfig.tcl-2 +testouterr_cmd_re sh {-V} {} {Modules Release [0-9a-zA-Z\.\+\-]+ \([0-9\-]{10}\)} + # restore environment -if { $verbose > 0 } { - send_user "\tUnset TESTSUITE_ENABLE_SITECONFIG_DEBUG\n" -} -unset env(TESTSUITE_ENABLE_SITECONFIG_DEBUG) +unsetenv_var MODULES_SITECONFIG +unsetenv_var TESTSUITE_ENABLE_SITECONFIG_DEBUG # test broken siteconfig file