diff --git a/testsuite/example/siteconfig.tcl-1 b/testsuite/example/siteconfig.tcl-1 index 3c13f5b1..c660f24a 100644 --- a/testsuite/example/siteconfig.tcl-1 +++ b/testsuite/example/siteconfig.tcl-1 @@ -16,6 +16,18 @@ if {[info exists env(TESTSUITE_ENABLE_SITECONFIG_BROKEN)]} { unk_foo } +# redefine existing modulecmd.tcl procedure to make it broken +if {[info exists env(TESTSUITE_ENABLE_SITECONFIG_BROKEN2)]} { + proc pushModuleFile {str} { + unk_foo + } +} + +# unset existing modulecmd.tcl procedure +if {[info exists env(TESTSUITE_ENABLE_SITECONFIG_BROKEN3)]} { + rename ::pushModuleFile {} +} + # generate error with parseAccessIssue generic msg if following environment variable is set if {[info exists env(TESTSUITE_ENABLE_SITECONFIG_ACCESSERR)]} { set errorCode "Custom error code" diff --git a/testsuite/modules.00-init/120-siteconfig.exp b/testsuite/modules.00-init/120-siteconfig.exp index d1cc3aef..b4e832d8 100644 --- a/testsuite/modules.00-init/120-siteconfig.exp +++ b/testsuite/modules.00-init/120-siteconfig.exp @@ -124,6 +124,28 @@ if { $verbose > 0 } { unset env(TESTSUITE_ENABLE_SITECONFIG_BROKEN) +# test siteconfig that breaks modulecmd.tcl code +setenv_var TESTSUITE_ENABLE_SITECONFIG_BROKEN2 1 +set ans [list] +lappend ans "$error_msgs: invalid command name \"unk_foo\"" +lappend ans { while executing} +lappend ans { "unk_foo"} +lappend ans { (procedure "pushModuleFile" line 2)} +lappend ans { invoked from within} +lappend ans { "pushModuleFile {}"} +lappend ans { Please report this issue at https://github.com/cea-hpc/modules/issues} +testouterr_cmd sh {foo} ERR [join $ans \n] +unsetenv_var TESTSUITE_ENABLE_SITECONFIG_BROKEN2 +setenv_var TESTSUITE_ENABLE_SITECONFIG_BROKEN3 1 +set ans [list] +lappend ans "$error_msgs: invalid command name \"pushModuleFile\"" +lappend ans { while executing} +lappend ans { "pushModuleFile {}"} +lappend ans { Please report this issue at https://github.com/cea-hpc/modules/issues} +testouterr_cmd sh {foo} ERR [join $ans \n] +unsetenv_var TESTSUITE_ENABLE_SITECONFIG_BROKEN3 + + # test siteconfig file raising error # test parseAccessIssue with custom error code by the way if { $verbose > 0 } {