mirror of
https://github.com/envmodules/modules.git
synced 2026-06-14 00:42:43 +08:00
testsuite: add 151-module-onlytop in 50-cmds suite
Check module sub-commands that cannot be called within modulefile.
This commit is contained in:
31
testsuite/modulefiles/modbad/append-path
Normal file
31
testsuite/modulefiles/modbad/append-path
Normal file
@@ -0,0 +1,31 @@
|
||||
#%Module1.0
|
||||
|
||||
##############################################################################
|
||||
# Modules Revision 3.0
|
||||
# Providing a flexible user environment
|
||||
#
|
||||
# File: modbad/%M%
|
||||
# Revision: %I%
|
||||
# First Edition: 2017/11/25
|
||||
# Last Mod.: %U%, %G%
|
||||
#
|
||||
# Authors: Xavier Delaruelle, xavier.delaruelle@cea.fr
|
||||
#
|
||||
# Description: Testuite modulefile
|
||||
# Command:
|
||||
#
|
||||
# Invocation:
|
||||
# Result: %R{
|
||||
# }R%
|
||||
# Comment: %C{
|
||||
# test behavior against a modulefile using module sub-commands
|
||||
# only reachable from command line
|
||||
# }C%
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
module append-path FOO bar
|
||||
module prepend-path FOO bar
|
||||
module remove-path FOO bar
|
||||
module autoinit
|
||||
module help
|
||||
31
testsuite/modulefiles/modbad/autoinit
Normal file
31
testsuite/modulefiles/modbad/autoinit
Normal file
@@ -0,0 +1,31 @@
|
||||
#%Module1.0
|
||||
|
||||
##############################################################################
|
||||
# Modules Revision 3.0
|
||||
# Providing a flexible user environment
|
||||
#
|
||||
# File: modbad/%M%
|
||||
# Revision: %I%
|
||||
# First Edition: 2017/11/25
|
||||
# Last Mod.: %U%, %G%
|
||||
#
|
||||
# Authors: Xavier Delaruelle, xavier.delaruelle@cea.fr
|
||||
#
|
||||
# Description: Testuite modulefile
|
||||
# Command:
|
||||
#
|
||||
# Invocation:
|
||||
# Result: %R{
|
||||
# }R%
|
||||
# Comment: %C{
|
||||
# test behavior against a modulefile using module sub-commands
|
||||
# only reachable from command line
|
||||
# }C%
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
module autoinit
|
||||
module help
|
||||
module append-path FOO bar
|
||||
module prepend-path FOO bar
|
||||
module remove-path FOO bar
|
||||
27
testsuite/modulefiles/modbad/foo
Normal file
27
testsuite/modulefiles/modbad/foo
Normal file
@@ -0,0 +1,27 @@
|
||||
#%Module1.0
|
||||
|
||||
##############################################################################
|
||||
# Modules Revision 3.0
|
||||
# Providing a flexible user environment
|
||||
#
|
||||
# File: modbad/%M%
|
||||
# Revision: %I%
|
||||
# First Edition: 2017/11/25
|
||||
# Last Mod.: %U%, %G%
|
||||
#
|
||||
# Authors: Xavier Delaruelle, xavier.delaruelle@cea.fr
|
||||
#
|
||||
# Description: Testuite modulefile
|
||||
# Command:
|
||||
#
|
||||
# Invocation:
|
||||
# Result: %R{
|
||||
# }R%
|
||||
# Comment: %C{
|
||||
# test behavior against a modulefile using module sub-commands
|
||||
# only reachable from command line
|
||||
# }C%
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
module foo
|
||||
31
testsuite/modulefiles/modbad/help
Normal file
31
testsuite/modulefiles/modbad/help
Normal file
@@ -0,0 +1,31 @@
|
||||
#%Module1.0
|
||||
|
||||
##############################################################################
|
||||
# Modules Revision 3.0
|
||||
# Providing a flexible user environment
|
||||
#
|
||||
# File: modbad/%M%
|
||||
# Revision: %I%
|
||||
# First Edition: 2017/11/25
|
||||
# Last Mod.: %U%, %G%
|
||||
#
|
||||
# Authors: Xavier Delaruelle, xavier.delaruelle@cea.fr
|
||||
#
|
||||
# Description: Testuite modulefile
|
||||
# Command:
|
||||
#
|
||||
# Invocation:
|
||||
# Result: %R{
|
||||
# }R%
|
||||
# Comment: %C{
|
||||
# test behavior against a modulefile using module sub-commands
|
||||
# only reachable from command line
|
||||
# }C%
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
module help
|
||||
module append-path FOO bar
|
||||
module prepend-path FOO bar
|
||||
module remove-path FOO bar
|
||||
module autoinit
|
||||
31
testsuite/modulefiles/modbad/prepend-path
Normal file
31
testsuite/modulefiles/modbad/prepend-path
Normal file
@@ -0,0 +1,31 @@
|
||||
#%Module1.0
|
||||
|
||||
##############################################################################
|
||||
# Modules Revision 3.0
|
||||
# Providing a flexible user environment
|
||||
#
|
||||
# File: modbad/%M%
|
||||
# Revision: %I%
|
||||
# First Edition: 2017/11/25
|
||||
# Last Mod.: %U%, %G%
|
||||
#
|
||||
# Authors: Xavier Delaruelle, xavier.delaruelle@cea.fr
|
||||
#
|
||||
# Description: Testuite modulefile
|
||||
# Command:
|
||||
#
|
||||
# Invocation:
|
||||
# Result: %R{
|
||||
# }R%
|
||||
# Comment: %C{
|
||||
# test behavior against a modulefile using module sub-commands
|
||||
# only reachable from command line
|
||||
# }C%
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
module prepend-path FOO bar
|
||||
module remove-path FOO bar
|
||||
module autoinit
|
||||
module help
|
||||
module append-path FOO bar
|
||||
31
testsuite/modulefiles/modbad/remove-path
Normal file
31
testsuite/modulefiles/modbad/remove-path
Normal file
@@ -0,0 +1,31 @@
|
||||
#%Module1.0
|
||||
|
||||
##############################################################################
|
||||
# Modules Revision 3.0
|
||||
# Providing a flexible user environment
|
||||
#
|
||||
# File: bad3/%M%
|
||||
# Revision: %I%
|
||||
# First Edition: 2017/11/25
|
||||
# Last Mod.: %U%, %G%
|
||||
#
|
||||
# Authors: Xavier Delaruelle, xavier.delaruelle@cea.fr
|
||||
#
|
||||
# Description: Testuite modulefile
|
||||
# Command:
|
||||
#
|
||||
# Invocation:
|
||||
# Result: %R{
|
||||
# }R%
|
||||
# Comment: %C{
|
||||
# test behavior against a modulefile using module sub-commands
|
||||
# only reachable from command line
|
||||
# }C%
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
module remove-path FOO bar
|
||||
module autoinit
|
||||
module help
|
||||
module append-path FOO bar
|
||||
module prepend-path FOO bar
|
||||
52
testsuite/modules.50-cmds/151-module-onlytop.exp
Normal file
52
testsuite/modules.50-cmds/151-module-onlytop.exp
Normal file
@@ -0,0 +1,52 @@
|
||||
##############################################################################
|
||||
# Modules Revision 3.0
|
||||
# Providing a flexible user environment
|
||||
#
|
||||
# File: modules.50-cmds/%M%
|
||||
# Revision: %I%
|
||||
# First Edition: 2017/11/25
|
||||
# Last Mod.: %U%, %G%
|
||||
#
|
||||
# Authors: Xavier Delaruelle, xavier.delaruelle@cea.fr
|
||||
#
|
||||
# Description: Testuite testsequence
|
||||
# Command: load
|
||||
# Modulefiles: modbad3
|
||||
# Sub-Command:
|
||||
#
|
||||
# Comment: %C{
|
||||
# Tests 'module' sub-commands that cannot be called
|
||||
# outside of command line
|
||||
# }C%
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
foreach subcmd [list append-path prepend-path remove-path autoinit help] {
|
||||
set module "modbad/$subcmd"
|
||||
set modulefile "$modpath/$module"
|
||||
set modulefilere "$modpathre/$module"
|
||||
set moderr "$moderr_msgs: module: Command '$subcmd' not supported\n In '$modulefile'\n$err_contact"
|
||||
|
||||
testouterr_cmd_re "sh" "load $module" "ERR" "$moderr"
|
||||
testouterr_cmd_re "sh" "display $module" "ERR" "$modlin\n$modulefilere:\n\n$moderr\n$modlin"
|
||||
}
|
||||
|
||||
set module "modbad/foo"
|
||||
set modulefile "$modpath/$module"
|
||||
set modulefilere "$modpathre/$module"
|
||||
set moderr "$moderr_msgs: module: Invalid command 'foo'\n In '$modulefile'\n$err_contact"
|
||||
|
||||
testouterr_cmd_re "sh" "load $module" "ERR" "$moderr"
|
||||
testouterr_cmd_re "sh" "display $module" "ERR" "$modlin\n$modulefilere:\n\n$moderr\n$modlin"
|
||||
|
||||
|
||||
#
|
||||
# Cleanup
|
||||
#
|
||||
|
||||
unset subcmd
|
||||
|
||||
unset moderr
|
||||
unset modulefilere
|
||||
unset modulefile
|
||||
unset module
|
||||
@@ -37,69 +37,69 @@ set len [string length $modpath]
|
||||
set lrep [expr {($test_cols - $len - 2)/2}]
|
||||
set rrep [expr {$test_cols - $len - 2 - $lrep}]
|
||||
set ts_sh "[string repeat {-} $lrep] $modpath [string repeat {-} $rrep]
|
||||
alias/1.0 info/user loc_rc6/bar(@) log/badfac tr2_loc/al2(tr2bar:@)
|
||||
alias/2.0 info/userexp loc_rc7/0.9 log/err_both_1 tr2_loc/al3(default:tr2exp:trreg:@)
|
||||
append/0.1 inforc/1.0 loc_rc7/1(@) log/err_both_2 tr2_loc/al4(@)
|
||||
append/0.2 inforc/2.0(avail:bar:default) loc_rc7/1.2 log/err_file tr2_loc/al5(default:trreg:@)
|
||||
append/1.0 inforc/foo(@) loc_rc7/bar(@) log/err_syslog tr_loc/al1(tr2unstable:trunstable:@)
|
||||
append/1.1 load/00 loc_rc8/0.9(@) module/2.0 tr_loc/al2(default:tr2bar:tr2exp:trbar:trreg:@)
|
||||
append/2.0 load/10 loc_rc8/1.0 module/bad tr_loc/al3(trexp:@)
|
||||
append/2.1 load/11 loc_sym/1.0 module/err tr_loc/al4(@)
|
||||
append/2.2 load/12 loc_sym/alias1 module/lbad tr_loc/al5(@)
|
||||
averssort/1(@) load/13 loc_sym/alias2 module/lerr trace/all_off
|
||||
averssort/1.2.4(@) load/14 loc_sym/alias3 module/lunk trace/all_on
|
||||
averssort/1.10(@) load/15 loc_sym/alias4 module/meta uname/domain
|
||||
bad/after(good) load/16 loc_sym/alias5 module/unk uname/machine
|
||||
bad/before load/17 loc_sym/alias6 prepend/0.1 uname/nodename
|
||||
bad2/body load/18 loc_sym/alias7 prepend/0.2 uname/release
|
||||
bad2/proc load/19 loc_sym/exec1 prepend/1.0 uname/sysname
|
||||
break/1.0 load/20 loc_sym/exec2 prepend/1.1 uname/version
|
||||
break/2.0 load/21 loc_sym/getvers1 prepend/2.0 unsetenv/0.8
|
||||
break/3.0 load/22 loc_sym/getvers2 prepend/2.1 unsetenv/0.9
|
||||
break/4.0 load/23 loc_sym/getvers3 prepend/2.2 unsetenv/1.0
|
||||
break/5.0 load/24 loc_sym/getvers4 prereq/full use/1.0(default)
|
||||
break/6.0 load/25 loc_sym/getvers5 prereq/module use/2.0
|
||||
chdir/1.0 load/26 loc_sym/getvers6 prereq/orlist use/2.1
|
||||
chdir/2.0 load/27 loc_sym/getvers7 puts/1 use/2.2
|
||||
chdir/3.0 load/28 loc_sym/getvers8 puts/2 use/3.0
|
||||
chdir/4.0 load/29 loc_sym/versinf1 puts/3 use/3.1
|
||||
coll/a load/30 loc_sym/versinf2 puts/4 use/3.2
|
||||
coll/b load/all(default) loc_sym/versinf3 puts/5 use/4.0
|
||||
coll/c loc_def/default loc_sym/versinf4 puts/6 user/adv
|
||||
coll/d loc_def/truedef loc_sym/versinf5 recurs/modA user/advanced
|
||||
conflict/full loc_dv1/1.0 loc_sym/versinf6 recurs/modB user/exp
|
||||
conflict/module loc_dv1/2.0 loc_sym/versinf7 remove/1.0 user/expert
|
||||
continue/1.0 loc_dv2/1.0(default) loc_sym/version1 remove/2.0 user/nov
|
||||
continue/2.0 loc_dv2/2.0 loc_sym/version2 setenv/0.8 user/novice
|
||||
continue/3.0 loc_dv3/1.0 loc_sym/version3 setenv/1.0 user/undef
|
||||
continue/4.0 loc_dv3/2.0 loc_sym/version4 spread/1.0 verbose/msg
|
||||
continue/5.0 loc_dv4/1.0 loc_sym/version5 spread/2.0 verbose/off
|
||||
continue/6.0 loc_dv6/1.0 loc_sym/version6 spread/3.0 verbose/on
|
||||
dirmodalias(@) loc_dv6/2.0/1.0 loc_sym/version7 spread/4.0 verbose/undef
|
||||
dirmodalias/1.0 loc_dv7/1.0 loc_sym/version8 spread/5.0 versions/1.1
|
||||
empty/1.0 loc_dv7/2.0(default) loc_sym/version9 spread/6.0 versions/1.2
|
||||
eschars/1.0 loc_dv7/2.0/1.0 loc_sym/version10 spread/7.0 versions/1.3
|
||||
exit/1.0 loc_dv7/3.0 loc_sym/version11 spread/8.0 verssort/1
|
||||
exit/2.0 loc_dv8/1.0 loc_sym/version12 spreadrc/dir1/1.0 verssort/1.2.1
|
||||
exit/3.0 loc_dv8/2.0 loc_sym/version13 spreadrc/dir2/1.0 verssort/1.2.4
|
||||
exit/4.0 loc_dv9/1.0(default) loc_sym/version14 spreadrc/dir3/1.0 verssort/1.8-2015-12-01
|
||||
getenv/1.0 loc_dv9/2.0 loc_sym/version15 spreadrc/dir4/1.0 verssort/1.8-2016-02-01
|
||||
help/2.0 loc_fq/1.0 loc_sym/version16 spreadrc/dir5/1.0 verssort/1.10
|
||||
info/command loc_rc1/1.0(foo) loc_sym/version17 spreadrc/dir6/1.0 whatis/lines
|
||||
info/commandexp loc_rc1/2.0 loc_sym/version18 spreadrc/dir7/1.0 whatis/multiple
|
||||
info/isloaded loc_rc2/1.0(bar:blah:foo) loc_sym/version19 spreadrc/dir8/1.0 whatis/none
|
||||
info/mode1 loc_rc2/2.0 loc_sym/version20 symlink/0.9 whatis/single
|
||||
info/mode2 loc_rc3/1.0(default) loc_sym/version21 symlink/1(@) whatis/string
|
||||
info/mode3 loc_rc3/2.0(cur:stable) loc_sym/version22 symlink/1.2(default:new) x-resource/1
|
||||
info/mode4 loc_rc3/3.0(chk:exp:new:test) loc_sym/version23 symlink/bar(@)
|
||||
info/mode5 loc_rc4/1.0 loc_tr(reg) symlink2/1.0
|
||||
info/mode6 loc_rc4/2.0(default) loc_tr/1.0(cur:stable) symlink2/2.0
|
||||
info/name loc_rc4/3.0 loc_tr/2.0(next:tr2unstable:trunstable:unstable) system/2.0
|
||||
info/others loc_rc5/1.0 loc_tr/3.0(bar:default:exp:foo:reg:tr2bar:tr2exp:trbar:trexp:trreg) test/1.0
|
||||
info/shells loc_rc5/2.0 loc_tr/al1(unstable:@) test/1.2
|
||||
info/shellsexp loc_rc6/0.9 loc_tr/al2(bar:default:exp:reg:trexp:@) test/2.0
|
||||
info/specified(foo) loc_rc6/1(@) loc_tr/al3(default:exp:reg:@) tr2_loc(trreg)
|
||||
info/type loc_rc6/1.2(default:new) loc_tr/al4(default:reg:@) tr2_loc/al1(tr2unstable:@) "
|
||||
alias/1.0 info/user loc_rc6/bar(@) log/badfac system/2.0
|
||||
alias/2.0 info/userexp loc_rc7/0.9 log/err_both_1 test/1.0
|
||||
append/0.1 inforc/1.0 loc_rc7/1(@) log/err_both_2 test/1.2
|
||||
append/0.2 inforc/2.0(avail:bar:default) loc_rc7/1.2 log/err_file test/2.0
|
||||
append/1.0 inforc/foo(@) loc_rc7/bar(@) log/err_syslog tr2_loc(trreg)
|
||||
append/1.1 load/00 loc_rc8/0.9(@) modbad/append-path tr2_loc/al1(tr2unstable:@)
|
||||
append/2.0 load/10 loc_rc8/1.0 modbad/autoinit tr2_loc/al2(tr2bar:@)
|
||||
append/2.1 load/11 loc_sym/1.0 modbad/foo tr2_loc/al3(default:tr2exp:trreg:@)
|
||||
append/2.2 load/12 loc_sym/alias1 modbad/help tr2_loc/al4(@)
|
||||
averssort/1(@) load/13 loc_sym/alias2 modbad/prepend-path tr2_loc/al5(default:trreg:@)
|
||||
averssort/1.2.4(@) load/14 loc_sym/alias3 modbad/remove-path tr_loc/al1(tr2unstable:trunstable:@)
|
||||
averssort/1.10(@) load/15 loc_sym/alias4 module/2.0 tr_loc/al2(default:tr2bar:tr2exp:trbar:trreg:@)
|
||||
bad/after(good) load/16 loc_sym/alias5 module/bad tr_loc/al3(trexp:@)
|
||||
bad/before load/17 loc_sym/alias6 module/err tr_loc/al4(@)
|
||||
bad2/body load/18 loc_sym/alias7 module/lbad tr_loc/al5(@)
|
||||
bad2/proc load/19 loc_sym/exec1 module/lerr trace/all_off
|
||||
break/1.0 load/20 loc_sym/exec2 module/lunk trace/all_on
|
||||
break/2.0 load/21 loc_sym/getvers1 module/meta uname/domain
|
||||
break/3.0 load/22 loc_sym/getvers2 module/unk uname/machine
|
||||
break/4.0 load/23 loc_sym/getvers3 prepend/0.1 uname/nodename
|
||||
break/5.0 load/24 loc_sym/getvers4 prepend/0.2 uname/release
|
||||
break/6.0 load/25 loc_sym/getvers5 prepend/1.0 uname/sysname
|
||||
chdir/1.0 load/26 loc_sym/getvers6 prepend/1.1 uname/version
|
||||
chdir/2.0 load/27 loc_sym/getvers7 prepend/2.0 unsetenv/0.8
|
||||
chdir/3.0 load/28 loc_sym/getvers8 prepend/2.1 unsetenv/0.9
|
||||
chdir/4.0 load/29 loc_sym/versinf1 prepend/2.2 unsetenv/1.0
|
||||
coll/a load/30 loc_sym/versinf2 prereq/full use/1.0(default)
|
||||
coll/b load/all(default) loc_sym/versinf3 prereq/module use/2.0
|
||||
coll/c loc_def/default loc_sym/versinf4 prereq/orlist use/2.1
|
||||
coll/d loc_def/truedef loc_sym/versinf5 puts/1 use/2.2
|
||||
conflict/full loc_dv1/1.0 loc_sym/versinf6 puts/2 use/3.0
|
||||
conflict/module loc_dv1/2.0 loc_sym/versinf7 puts/3 use/3.1
|
||||
continue/1.0 loc_dv2/1.0(default) loc_sym/version1 puts/4 use/3.2
|
||||
continue/2.0 loc_dv2/2.0 loc_sym/version2 puts/5 use/4.0
|
||||
continue/3.0 loc_dv3/1.0 loc_sym/version3 puts/6 user/adv
|
||||
continue/4.0 loc_dv3/2.0 loc_sym/version4 recurs/modA user/advanced
|
||||
continue/5.0 loc_dv4/1.0 loc_sym/version5 recurs/modB user/exp
|
||||
continue/6.0 loc_dv6/1.0 loc_sym/version6 remove/1.0 user/expert
|
||||
dirmodalias(@) loc_dv6/2.0/1.0 loc_sym/version7 remove/2.0 user/nov
|
||||
dirmodalias/1.0 loc_dv7/1.0 loc_sym/version8 setenv/0.8 user/novice
|
||||
empty/1.0 loc_dv7/2.0(default) loc_sym/version9 setenv/1.0 user/undef
|
||||
eschars/1.0 loc_dv7/2.0/1.0 loc_sym/version10 spread/1.0 verbose/msg
|
||||
exit/1.0 loc_dv7/3.0 loc_sym/version11 spread/2.0 verbose/off
|
||||
exit/2.0 loc_dv8/1.0 loc_sym/version12 spread/3.0 verbose/on
|
||||
exit/3.0 loc_dv8/2.0 loc_sym/version13 spread/4.0 verbose/undef
|
||||
exit/4.0 loc_dv9/1.0(default) loc_sym/version14 spread/5.0 versions/1.1
|
||||
getenv/1.0 loc_dv9/2.0 loc_sym/version15 spread/6.0 versions/1.2
|
||||
help/2.0 loc_fq/1.0 loc_sym/version16 spread/7.0 versions/1.3
|
||||
info/command loc_rc1/1.0(foo) loc_sym/version17 spread/8.0 verssort/1
|
||||
info/commandexp loc_rc1/2.0 loc_sym/version18 spreadrc/dir1/1.0 verssort/1.2.1
|
||||
info/isloaded loc_rc2/1.0(bar:blah:foo) loc_sym/version19 spreadrc/dir2/1.0 verssort/1.2.4
|
||||
info/mode1 loc_rc2/2.0 loc_sym/version20 spreadrc/dir3/1.0 verssort/1.8-2015-12-01
|
||||
info/mode2 loc_rc3/1.0(default) loc_sym/version21 spreadrc/dir4/1.0 verssort/1.8-2016-02-01
|
||||
info/mode3 loc_rc3/2.0(cur:stable) loc_sym/version22 spreadrc/dir5/1.0 verssort/1.10
|
||||
info/mode4 loc_rc3/3.0(chk:exp:new:test) loc_sym/version23 spreadrc/dir6/1.0 whatis/lines
|
||||
info/mode5 loc_rc4/1.0 loc_tr(reg) spreadrc/dir7/1.0 whatis/multiple
|
||||
info/mode6 loc_rc4/2.0(default) loc_tr/1.0(cur:stable) spreadrc/dir8/1.0 whatis/none
|
||||
info/name loc_rc4/3.0 loc_tr/2.0(next:tr2unstable:trunstable:unstable) symlink/0.9 whatis/single
|
||||
info/others loc_rc5/1.0 loc_tr/3.0(bar:default:exp:foo:reg:tr2bar:tr2exp:trbar:trexp:trreg) symlink/1(@) whatis/string
|
||||
info/shells loc_rc5/2.0 loc_tr/al1(unstable:@) symlink/1.2(default:new) x-resource/1
|
||||
info/shellsexp loc_rc6/0.9 loc_tr/al2(bar:default:exp:reg:trexp:@) symlink/bar(@)
|
||||
info/specified(foo) loc_rc6/1(@) loc_tr/al3(default:exp:reg:@) symlink2/1.0
|
||||
info/type loc_rc6/1.2(default:new) loc_tr/al4(default:reg:@) symlink2/2.0 "
|
||||
|
||||
#
|
||||
# test
|
||||
|
||||
Reference in New Issue
Block a user