1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
##############################################################################
# Modules Revision 3.0
# Providing a flexible user environment
#
# File: modules.00-init/%M%
# Revision: %I%
# First Edition: 2019/11/29
# Last Mod.: %U%, %G%
#
# Authors: Xavier Delaruelle, xavier.delaruelle@cea.fr
#
# Description: Testuite testsequence
# Command:
# Sub-Command:
#
# Comment: %C{
# Check basic set of ml commands on all shells
# }C%
#
##############################################################################
if {$install_ml ne {y}} {
send_user "\tSkipping ml command tests, as it is disabled\n"
} else {
set bad_cmd "$error_msgs: Unable to locate a modulefile for 'foo'"
set bad_cmd_re "(ml: )?$bad_cmd"
#
# The tests
#
if {$verbose} {
send_user "\tChecking basic set of ml commands\n"
}
foreach shell $shell_list {
testall_cmd_re "$shell" "ml --version" {} "Modules Release \\S+ (\\S+)" 0
testall_cmd "$shell" "ml foo" "" "$bad_cmd" 1
testall_cmd "$shell" "ml use $share_modpath\; ml purge\; ml null\; ml list -t" "" "$cur_loaded\nnull" 0
testall_cmd "$shell" "ml use $share_modpath\; ml purge\; ml null\; ml -null\; ml" "" "$no_loaded" 0
testall_cmd "$shell" "ml is-loaded unk" "" "" 1
testall_cmd "$shell" "ml use $share_modpath\; ml null\; ml is-loaded null" "" "" 0
testall_cmd "$shell" "ml info-loaded unk" "" "" 0
testall_cmd "$shell" "ml use $share_modpath\; ml load null\; ml 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" "ml $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" "ml $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" "ml:--version" {} "Modules Release \\S+ (\\S+)" 0
testall_cmd_re "$shell" "ml:foo" {} "$bad_cmd_re.*" 1
testall_cmd "$shell" "ml:use,$share_modpath:purge:null:list,-t" "" "$cur_loaded\nnull" 0
testall_cmd "$shell" "ml:use,$share_modpath:purge:null:-null:list,-t" "" "$no_loaded" 0
switch -- $shell {
cmake - r {
testall_cmd_re "$shell" "ml:is-loaded,unk" "" ".*" 1
}
default {
testall_cmd_re "$shell" "ml:is-loaded,unk" "" "" 1
}
}
testall_cmd "$shell" "ml:use,$share_modpath:load,null:is-loaded,null" "" "" 0
switch -- $shell {
r {
testall_cmd "$shell" "ml:info-loaded,unk" "\[1\] \"\"" {} 0
}
python - ruby {
testall_cmd "$shell" "ml:info-loaded,unk" "\n" "" 0
}
default {
testall_cmd "$shell" "ml:info-loaded,unk" "" "" 0
}
}
switch -- $shell {
{cmake} {
set anstxt "-- null"
}
{r} {
set anstxt "\[1\] \"null\""
}
default {
set anstxt "null"
}
}
testall_cmd "$shell" "ml: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" "ml use $share_modpath\; ml -null\; ml" "" "$no_loaded" 0
}
foreach shell $othlang_list {
testall_cmd "$shell" "ml:use,$share_modpath:unload,null:list" "" "$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 <aL>\n Unloading dependent: advvers6/1.3"
if {![is_config_locked implicit_default]} {
foreach shell $shell_list {
testall_cmd $shell "ml use $testsuite_modpath.2\; ml config implicit_default 1\; ml config verbosity normal\; ml config advanced_version_spec 1\; ml --auto advvers6@1.3\; ml --auto -advvers7@1.0" {} $loadunloadout 0
}
foreach shell $othlang_list {
testall_cmd $shell "ml:use,$testsuite_modpath.2:config,implicit_default,1:config,verbosity,normal:config,advanced_version_spec,1:--auto,advvers6@1.3:--auto,-advvers7@1.0" {} $loadunloadout 0
}
} elseif {$verbose} {
send_user "\tSkipping advanced_version_spec tests as implicit_default config is locked\n"
}
#
# Clean up variables used in this test case
#
reset_test_env
}
# vim:set tabstop=3 shiftwidth=3 expandtab autoindent:
|