############################################################################## # Modules Revision 3.0 # Providing a flexible user environment # # File: install.00-init/%M% # Revision: %I% # First Edition: 2017/05/06 # Last Mod.: %U%, %G% # # Authors: Xavier Delaruelle, xavier.delaruelle@cea.fr # # Description: Test procedures # Command: # Sub-Command: # # Comment: %C{ # Defines the testprocedures for probing the outputs # on stdout and stderr of the test target # }C% # ############################################################################## # # Test subprocedures # proc _test_sub {test_shell cmd {input noinput} {launcher {}}} { global comp_output global comp_error global comp_exit global shell global autoinit_mode global verbose set comp_output "" set comp_error "" set comp_exit "" if { ![info exists test_shell] || ![info exists cmd] } { unresolved "$cmd ($test_shell) internal error" } # enable autoinit initialization when asked set shell_args [split $test_shell ":"] if { [llength $shell_args] == 2 && [lindex $shell_args 0] eq "autoinit" } { set autoinit_mode 1 set test_shell [lindex $shell_args 1] } else { set autoinit_mode 0 } set shell $test_shell install_test_xxx_ "$cmd" # if environment is found undefined, initrc is evaluated so the default # module to load will appear on every test output if {![info exists ::no_loadedmodules_inject] && $::install_loadedmodules\ ne {} && (![info exists ::env(LOADEDMODULES)] && ![info exists\ ::env(MODULEPATH)])} { foreach lm [split $::install_loadedmodules :] { lappend anserrpre "Loading $lm" } upvar anserr anserr if {$anserr ne {.*}} { if {[string length $anserr]} { set startmatch [expr {[string index $anserr 0] eq {^}}] set anserr \n[string range $anserr $startmatch end] } else { set startmatch 0 } set anserr [expr {$startmatch ? {^} : {}}][join $anserrpre \n]$anserr } } if { $verbose > 1 } { set ol [string length $comp_output] set oe [string length $comp_error] send_user "OUT\[$ol\]: '$comp_output'#>\n" send_user "ERR\[$oe\]: '$comp_error'#>\n" send_user "EXIT: '$comp_exit'#>\n" } } # vim:set tabstop=3 shiftwidth=3 expandtab autoindent: