############################################################################## # Modules Revision 3.0 # Providing a flexible user environment # # File: modules.00-init/%M% # Revision: %I% # First Edition: 2017/05/06 # Last Mod.: %U%, %G% # # Authors: Xavier Delaruelle, xavier.delaruelle@cea.fr # # Description: Testuite testsequence # Command: # Sub-Command: # # Comment: %C{ # Check basic set of module commands on all shells # }C% # ############################################################################## set bad_cmd "$error_msgs: Invalid command 'foo'" set bad_cmd_re "(envmodule: )?$bad_cmd" # # The tests # if {$verbose} { send_user "\tChecking basic set of module commands\n" } foreach shell $shell_list { testall_cmd_re "$shell" "module --version" {} "Modules Release \\S+ (\\S+)" 0 testall_cmd "$shell" "module foo" "" "$bad_cmd\n$type_help" 1 testall_cmd "$shell" "module use $share_modpath\; module purge\; module load null\; module list -t" "" "$cur_loaded\nnull" 0 testall_cmd "$shell" "module use $share_modpath\; module purge\; module load null\; module unload null\; module list -t" "" "$no_loaded" 0 testall_cmd "$shell" "module is-loaded unk" "" "" 1 testall_cmd "$shell" "module use $share_modpath\; module load null\; module is-loaded null" "" "" 0 testall_cmd "$shell" "module info-loaded unk" "" "" 0 testall_cmd "$shell" "module use $share_modpath\; module load null\; module info-loaded null" "null" "" 0 } # ensure tools used in complex shell alias definition are available if {[find_bin grep] ne "" && [find_bin tr] ne "" && [find_bin awk] ne ""} { foreach shell $shell_list { if {$shell eq {csh} || $shell eq {tcsh}} { # alias evaluation leads to a syntax error if wa_277 is enabled testall_cmd_re "$shell" "module load $testsuite_modpath/alias/3.0\; testsuite; ts2; ts3" [expr {$install_wa277 eq {y} ? {} : "Release\nhttp://an.example.web\\?¶m=one\nselect\\\[type==BAR && osrel==FOO\\\] myapp"}] ".*" [expr {$install_wa277 eq {y} ? 1 : 0}] } else { testall_cmd_re "$shell" "module load $testsuite_modpath/alias/3.0\; testsuite; ts2; ts3" "Release\nhttp://an.example.web\\?¶m=one\nselect\\\[type==BAR && osrel==FOO\\\] myapp" ".*" 0 } } } elseif {$verbose} { send_user "\tSkipping shell alias definition tests\n" } foreach shell $othlang_list { testall_cmd_re "$shell" "--version" {} "Modules Release \\S+ (\\S+)" 0 testall_cmd_re "$shell" "foo" {} "$bad_cmd_re\n$type_help.*" 1 testall_cmd "$shell" "use,$share_modpath:purge:load,null:list,-t" "" "$cur_loaded\nnull" 0 testall_cmd "$shell" "use,$share_modpath:purge:load,null:unload,null:list,-t" "" "$no_loaded" 0 switch -- $shell { cmake - r { testall_cmd_re "$shell" "is-loaded,unk" "" ".*" 1 } default { testall_cmd_re "$shell" "is-loaded,unk" "" "" 1 } } testall_cmd "$shell" "use,$share_modpath:load,null:is-loaded,null" "" "" 0 switch -- $shell { r { testall_cmd "$shell" "info-loaded,unk" "\[1\] \"\"" {} 0 } python - ruby { testall_cmd "$shell" "info-loaded,unk" "\n" "" 0 } default { testall_cmd "$shell" "info-loaded,unk" "" "" 0 } } switch -- $shell { {cmake} { set anstxt "-- null" } {r} { set anstxt "\[1\] \"null\"" } default { set anstxt "null" } } testall_cmd "$shell" "use,$share_modpath:load,null:info-loaded,null" $anstxt "" 0 } # test unload of previously loaded modulefile if {$verbose} { send_user "\tSetup LOADEDMODULES = 'null'\n" send_user "\tSetup _LMFILES_ = '$share_modpath/null'\n" } set env(LOADEDMODULES) "null" set env(_LMFILES_) "$share_modpath/null" foreach shell $shell_list { testall_cmd "$shell" "module use $share_modpath\; module unload null\; module list -t" "" "$no_loaded" 0 } foreach shell $othlang_list { testall_cmd "$shell" "use,$share_modpath:unload,null:list,-t" "" "$no_loaded" 0 } # ensure advanced_version_spec is efficient on all shells set loadunloadout "Loading advvers6/1.3\n Loading requirement: advvers7/1.0\nUnloading advvers7/1.0 \n Unloading dependent: advvers6/1.3" if {![is_config_locked implicit_default]} { foreach shell $shell_list { testall_cmd $shell "module use $testsuite_modpath.2\; module config implicit_default 1\; module config verbosity normal\; module config advanced_version_spec 1\; module load --auto advvers6@1.3\; module unload --auto advvers7@1.0" {} $loadunloadout 0 } foreach shell $othlang_list { testall_cmd $shell "use,$testsuite_modpath.2:config,implicit_default,1:config,verbosity,normal:config,advanced_version_spec,1:load,--auto,advvers6@1.3:unload,--auto,advvers7@1.0" {} $loadunloadout 0 } } elseif {$verbose} { send_user "\tSkipping advanced_version_spec tests as implicit_default config is locked\n" } # test modulepath and module names containing space if {!$is_symlink_supported} { send_user "\tskipping tests over '$testsuite_modpath wspace' modulepath as symbolic links are not supported on filesystem\n" } else { set loadunloadout "Loading 'space yc/4'\nUnloading 'space yc/4'" foreach shell $shell_list { testall_cmd $shell "module use \"$testsuite_modpath wspace\"\; module load -v \"space yc/4\"\; module unload -v \"space yc/4\"" {} $loadunloadout 0 } foreach shell $othlang_list { testall_cmd $shell "use,$testsuite_modpath wspace:load,-v,space yc/4:unload,-v,space yc/4" {} $loadunloadout 0 } } # test complete command setenv_var TESTSUITE_COMPLETE comp3 foreach shell $shell_list { if {$shell in {bash tcsh fish}} { testall_cmd $shell "module use \"$testsuite_modpath.3\"\; module load complete/1.0\; cmd" cmd {} 0 testall_cmd $shell "module use \"$testsuite_modpath.3\"\; module load complete/1.0 complete/1.1\; cmd" cmd {} 0 } } unsetenv_var TESTSUITE_COMPLETE # test noglob eval on sh-kind shells foreach shell $shell_list { if {$shell in {sh bash ksh zsh}} { set tsout {foo} if {$shell eq {sh} && $sh_strict} { set tserr {.*eval: \[\[: not found.*} } else { set tserr {} } testouterr_cmd_re $shell "module use \"$testsuite_modpath.3\"\; module load noglobeval/1.0\; foo" $tsout $tserr } } # test unset undefined elements on shells foreach shell $shell_list { foreach elt {variable alias function complete} { setenv_var TESTSUITE_UNSET $elt testall_cmd $shell "module use \"$testsuite_modpath.4\"\; module load unset/1.0" {} {} 0 } } unsetenv_var TESTSUITE_UNSET # test special characters in environment variable foreach shell $shell_list { if {$shell in {csh tcsh}} { if {$install_wa277 eq {y}} { set tsout "abc : \\|<>!#$^&'\"()@x%y\\z:sh* -" } else { set tsout "abc : {}|<>!#$^&'\"()@x%y\\z:sh* -" } } else { set tsout "abc : {}|<>!#$^&'\"()@x%y\\z:sh*\n -" } testouterr_cmd $shell "module use \"$testsuite_modpath\"\; module load eschars/1.0\; echo \"\$pathelogical -\"" $tsout {} } # # Clean up variables used in this test case # reset_test_env # vim:set tabstop=3 shiftwidth=3 expandtab autoindent: