############################################################################## # Modules Revision 3.0 # Providing a flexible user environment # # File: modules.30-cache/%M% # Revision: %I% # First Edition: 2022/12/17 # Last Mod.: %U%, %G% # # Authors: Xavier Delaruelle, xavier.delaruelle@cea.fr # # Description: Testuite testsequence # Command: avail, whatis, load # Modulefiles: # Sub-Command: # # Comment: %C{ # Test use of cachefiles with files and directories # declared as limited access # }C% # ############################################################################## skip_if_quick_mode # cannot test access if cannot change file permission if {!$is_file_perms_editable} { send_user "\tskipping access tests as file permissions cannot be changed\n" # cannot test access if superuser privileges are in use } elseif {$tcl_platform(user) eq "root"} { send_user "\tskipping access tests as tests are run by superuser\n" # cannot test access if restricted file permissions have no effect } elseif {$is_locked_dir_file_readable && $is_locked_file_readable} { send_user "\tskipping access tests as locked files or directories are still readable\n" } else { # ensure avail tests are made using in depth mode setenv_var MODULES_AVAIL_INDEPTH 1 # ensure avail tests have implicit default enabled setenv_var MODULES_IMPLICIT_DEFAULT 1 # ensure auto symbolic versions are set for these tests setenv_var MODULES_ADVANCED_VERSION_SPEC 1 # ensure regular avail search match is set for these tests setenv_var MODULES_SEARCH_MATCH starts_with # generate content in modulepaths lassign [create_diverse_module_setup $mp1] dir_list file_list lassign [extend_diverse_module_setup $mp1] other_dir_list other_file_list lappend dir_list {*}$other_dir_list array set file_arr [concat $file_list $other_file_list] setenv_var MODULEPATH $mp1 set no_ar_perms ugo-r set no_ax_perms ugo-x set no_arx_perms ugo-rx set no_or_perms o-r set no_ox_perms o-x set no_orx_perms o-rx # limit access to some files and dirs for others change_file_perms $mp1/foo $no_or_perms change_file_perms $mp1/quux/oth $no_ox_perms change_file_perms $mp1/.modulerc $no_orx_perms change_file_perms $mp1/empty $no_orx_perms change_file_perms $mp1/anotherempty $no_or_perms change_file_perms $mp1/bar/.version $no_or_perms change_file_perms $mp1/quxa/.modulerc $no_orx_perms change_file_perms $mp1/baz/.1.10 $no_orx_perms change_file_perms $mp1/quxc/1.0 $no_orx_perms change_file_perms $mp1/quxc/1.0~ $no_orx_perms change_file_perms $mp1/.svn $no_orx_perms change_file_perms $mp1/.sos/ignmod $no_orx_perms # create file cache for test set tserr [msg_create $mp1cache] testouterr_cmd sh cachebuild OK $tserr set tserr {} set tserr_long {} set tserr_mcookie {} set tserr_mcookie_vers {} foreach f [lsort [array names file_arr]] { switch -glob -- $f { */.modulerc - */.version - quux/nok/5.0 - .modulerc - .version -\ .git/ignmod - quux/SCCS/ignmod - {w s/1.0~} - foo/1.0,v - quxc/1.0~ -\ .svn/ignmod - .sos/ignmod {} foo/1.0 - empty/notamodule - empty/deep/notadeepmodule { lappend tserr_mcookie $f } foo/3.0 { lappend tserr_mcookie $f lappend tserr_mcookie_vers $f } {* *} { lappend tserr '$f' lappend tserr_long "'$f'.*\[0-9:\/ \]*" lappend tserr_mcookie '$f' lappend tserr_mcookie_vers '$f' } default { lappend tserr $f lappend tserr_long "$f.*\[0-9:\/ \]*" lappend tserr_mcookie $f lappend tserr_mcookie_vers $f } } } set tserr_avail1 [join $tserr \n] testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1 set tserr_avail1_long .*[join $tserr_long \n] testouterr_cmd_re sh {avail -a -l} OK $tserr_avail1_long set tserr_avail2 [join {foo/2.0 foo/4.0 foo/5.0 foo/6.0 foobar} \n] testouterr_cmd sh {avail -a -t -o foo} OK $tserr_avail2 set tserr_whatis1 "$modlin [escre $mp1] $modlin \\s+bar/1.0: bar/1.0 \\s+bar/2.0: bar/2.0 \\s+baz/w s: baz/w s \\s+baz/w\"s: baz/w\"s \\s+baz/w#s: baz/w#s \\s+foo/2.0: foo/2.0 \\s+foobar: foobar \\s+quux/oth/3.0: quux/oth/3.0 \\s+quux/oth/4.0: quux/oth/4.0 \\s+quux/sub/1.0: quux/sub/1.0 \\s+quux/sub/2.0: quux/sub/2.0 \\s+quuxbar: quuxbar \\s+quxa/1.0: quxa/1.0 \\s+quxb/1.0: quxb/1.0 \\s+quxc/1.0: quxc/1.0 \\s+quxd/1.0: quxd/1.0 \\s+quxe/1.0: quxe/1.0 \\s+w s/1.0: w s/1.0 \\s+w\"s/1.0: w\"s/1.0 \\s+w#s/1.0: w#s/1.0" testouterr_cmd_re sh whatis OK $tserr_whatis1 set tserr_whatis2 "$modlin [escre $mp1] $modlin \\s+baz/w s: baz/w s \\s+baz/w\"s: baz/w\"s \\s+baz/w#s: baz/w#s" testouterr_cmd_re sh {whatis baz} OK $tserr_whatis2 set ans_load1 [list] lappend ans_load1 [list set __MODULES_LMALTNAME bar/1.0&bar/default&bar] lappend ans_load1 [list set _LMFILES_ $mp1/bar/1.0] lappend ans_load1 [list set LOADEDMODULES bar/1.0] testouterr_cmd sh {load bar} $ans_load1 {} set tserr_load2 "$err_magic'$mp1/foo/.modulerc'\n$err_contact $err_magic'$mp1/foo/1.0'\n$err_contact" testouterr_cmd sh {load foo/1.0} ERR $tserr_load2 set tserr_load3 "$err_magic'$mp1/foo/.modulerc'\n$err_contact [moderr_minverreq $mp1/foo/3.0 99]" testouterr_cmd sh {load foo/3.0} ERR $tserr_load3 set tserr_load4 "$err_magic'[escre $mp1]/foo/.modulerc'\n$err_contact [escre [msg_load foo/5.0 [msg_moderr {missing close-brace} if\ \{ $mp1/foo/5.0 2]]]" testouterr_cmd_re sh {load foo/5.0} ERR $tserr_load4 set ans_load5 [list] lappend ans_load5 [list set __MODULES_LMALTNAME .hid/1.0&as|.hid/default&as|.hid/latest] lappend ans_load5 [list set _LMFILES_ $mp1/.hid/1.0] lappend ans_load5 [list set LOADEDMODULES .hid/1.0] testouterr_cmd sh {load .hid} $ans_load5 {} # test indepth/noindepth resolution set tserr "$mp1: bar/ baz/ foo/ foobar quux/ quuxbar quxa/ quxb/ quxc/ quxd/ quxe/ 'w s'/ w\"s/ w#s/" testouterr_cmd sh {avail -t --no-indepth} OK $tserr set tserr "$mp1: quux/ quuxbar" testouterr_cmd sh {avail -t --no-indepth quux} OK $tserr set tserr "$mp1: quux/oth/(default) quux/sub/" testouterr_cmd sh {avail -t --no-indepth quux/} OK $tserr testouterr_cmd sh {avail -t --no-indepth quux/*} OK $tserr set tserr "$mp1: quux/oth/(default)" testouterr_cmd sh {avail -t --no-indepth quux/o} OK $tserr set tserr "" testouterr_cmd sh {avail -t --no-indepth quux/nok} OK $tserr testouterr_cmd sh {avail -t --no-indepth quux/no} OK $tserr # cache usage when mcookie_check is set to eval (same result as if option # is set to always unless for limited-acces elements that are lived checked) setenv_var MODULES_MCOOKIE_CHECK eval set tserr_avail1_mcookie [join $tserr_mcookie \n] testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1_mcookie set tserr_avail2_mcookie [join {foo/1.0 foo/2.0 foo/3.0 foo/4.0 foo/5.0 foo/6.0 foobar} \n] testouterr_cmd sh {avail -a -t -o foo} OK $tserr_avail2_mcookie testouterr_cmd_re sh whatis OK $tserr_whatis1 testouterr_cmd_re sh {whatis baz} OK $tserr_whatis2 testouterr_cmd sh {load bar} $ans_load1 {} set tserr_load2_mcookie "$err_magic'$mp1/foo/.modulerc'\n$err_contact [msg_load foo/1.0 $err_magicns'$mp1/foo/1.0'\n$err_contactns]" testouterr_cmd sh {load foo/1.0} ERR $tserr_load2_mcookie set tserr_load3_mcookie "$err_magic'$mp1/foo/.modulerc'\n$err_contact [msg_load foo/3.0 [moderr_minverreqns $mp1/foo/3.0 99]]" testouterr_cmd sh {load foo/3.0} ERR $tserr_load3_mcookie testouterr_cmd_re sh {load foo/5.0} ERR $tserr_load4 testouterr_cmd sh {load .hid} $ans_load5 {} setenv_var MODULES_MCOOKIE_CHECK always # cache usage when mcookie_version_check is disabled (same result as if # option is enabled unless for limited-access elements that are lived checked) setenv_var MODULES_MCOOKIE_VERSION_CHECK 0 # quux/nok/5.0 is not part of the results as it was already recorded as invalid in cache set tserr_avail1_mcookie_vers [join $tserr_mcookie_vers \n] testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1_mcookie_vers set tserr_avail2_mcookie_vers [join {foo/2.0 foo/3.0 foo/4.0 foo/5.0 foo/6.0 foobar} \n] testouterr_cmd sh {avail -a -t -o foo} OK $tserr_avail2_mcookie_vers set tserr_whatis1_mcookie_vers "$modlin [escre $mp1] $modlin \\s+bar/1.0: bar/1.0 \\s+bar/2.0: bar/2.0 \\s+baz/w s: baz/w s \\s+baz/w\"s: baz/w\"s \\s+baz/w#s: baz/w#s \\s+foo/2.0: foo/2.0 \\s+foo/3.0: foo \\s+foobar: foobar \\s+quux/oth/3.0: quux/oth/3.0 \\s+quux/oth/4.0: quux/oth/4.0 \\s+quux/sub/1.0: quux/sub/1.0 \\s+quux/sub/2.0: quux/sub/2.0 \\s+quuxbar: quuxbar \\s+quxa/1.0: quxa/1.0 \\s+quxb/1.0: quxb/1.0 \\s+quxc/1.0: quxc/1.0 \\s+quxd/1.0: quxd/1.0 \\s+quxe/1.0: quxe/1.0 \\s+w s/1.0: w s/1.0 \\s+w\"s/1.0: w\"s/1.0 \\s+w#s/1.0: w#s/1.0" testouterr_cmd_re sh whatis OK $tserr_whatis1_mcookie_vers testouterr_cmd_re sh {whatis baz} OK $tserr_whatis2 testouterr_cmd sh {load bar} $ans_load1 {} testouterr_cmd sh {load foo/1.0} ERR $tserr_load2 set ans_load3_mcookie_vers [list] lappend ans_load3_mcookie_vers [list set __MODULES_LMALTNAME bar/1.0&bar/default&bar] lappend ans_load3_mcookie_vers [list set __MODULES_LMPREREQ foo/3.0&bar] lappend ans_load3_mcookie_vers [list set _LMFILES_ $mp1/bar/1.0:$mp1/foo/3.0] lappend ans_load3_mcookie_vers [list set LOADEDMODULES bar/1.0:foo/3.0] lappend ans_load3_mcookie_vers [list set __MODULES_LMTAG bar/1.0&auto-loaded] lappend ans_load3_mcookie_vers [list ERR] set tserr_load3_mcookie_vers "$err_magic'$mp1/foo/.modulerc'\n$err_contact [msg_top_load foo/3.0 {} bar/1.0 {}]" testouterr_cmd sh {load foo/3.0} $ans_load3_mcookie_vers $tserr_load3_mcookie_vers testouterr_cmd_re sh {load foo/5.0} ERR $tserr_load4 testouterr_cmd sh {load .hid} $ans_load5 {} setenv_var MODULES_MCOOKIE_VERSION_CHECK 1 # second limited set (for others) change_file_perms $mp1/quux $no_or_perms restore_file_perms $mp1/foo restore_file_perms $mp1/.modulerc restore_file_perms $mp1/bar/.version change_file_perms $mp1/.version $no_or_perms change_file_perms $mp1/foo/1.0 $no_or_perms change_file_perms $mp1/foo/.modulerc $no_orx_perms change_file_perms $mp1/othhid/.deep $no_orx_perms change_file_perms $mp1/othhid2 $no_orx_perms change_file_perms $mp1/.hid/1.0 $no_or_perms # create file cache for test set tserr [msg_create $mp1cache] testouterr_cmd sh cachebuild OK $tserr testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1 testouterr_cmd_re sh {avail -a -l} OK $tserr_avail1_long testouterr_cmd sh {avail -a -t -o foo} OK $tserr_avail2 testouterr_cmd_re sh whatis OK $tserr_whatis1 testouterr_cmd_re sh {whatis baz} OK $tserr_whatis2 testouterr_cmd sh {load bar} $ans_load1 {} testouterr_cmd sh {load foo/1.0} ERR $tserr_load2 testouterr_cmd sh {load foo/3.0} ERR $tserr_load3 testouterr_cmd_re sh {load foo/5.0} ERR $tserr_load4 testouterr_cmd sh {load .hid} $ans_load5 {} restore_file_perms $mp1/quux restore_file_perms $mp1/quux/oth restore_file_perms $mp1/empty restore_file_perms $mp1/anotherempty restore_file_perms $mp1/quxa/.modulerc restore_file_perms $mp1/baz/.1.10 restore_file_perms $mp1/quxc/1.0 restore_file_perms $mp1/quxc/1.0~ restore_file_perms $mp1/.svn restore_file_perms $mp1/.sos/ignmod restore_file_perms $mp1/.version restore_file_perms $mp1/foo/1.0 restore_file_perms $mp1/foo/.modulerc restore_file_perms $mp1/othhid/.deep restore_file_perms $mp1/othhid2 restore_file_perms $mp1/.hid/1.0 # limit access to some files and dirs for all change_file_perms $mp1/foo $no_ar_perms change_file_perms $mp1/quux/oth $no_ax_perms change_file_perms $mp1/.modulerc $no_arx_perms change_file_perms $mp1/empty $no_orx_perms change_file_perms $mp1/anotherempty $no_ar_perms change_file_perms $mp1/bar/.version $no_ar_perms change_file_perms $mp1/quxa/.modulerc $no_arx_perms change_file_perms $mp1/baz/.1.10 $no_arx_perms change_file_perms $mp1/quxc/1.0 $no_arx_perms change_file_perms $mp1/quxc/1.0~ $no_arx_perms change_file_perms $mp1/.svn $no_arx_perms change_file_perms $mp1/.sos/ignmod $no_arx_perms # create file cache for test set tserr [msg_create $mp1cache] testouterr_cmd sh cachebuild OK $tserr set tserr {} set tserr_long {} set tserr_mcookie {} foreach f [lsort [array names file_arr]] { switch -glob -- $f { */.modulerc - */.version - foo/1.0 - foo/3.0 - quux/nok/5.0 -\ .modulerc - .version - foo/* - .git/ignmod - quux/SCCS/ignmod -\ {w s/1.0~} - foo/1.0,v - quxc/1.0~ - .svn/ignmod - .sos/ignmod {} empty/notamodule - empty/deep/notadeepmodule - quux/oth/* -\ baz/.1.10 - quxc/1.0 { lappend tserr_mcookie $f } {* *} { lappend tserr '$f' lappend tserr_long "'$f'.*\[0-9:\/ \]*" lappend tserr_mcookie '$f' } default { lappend tserr $f lappend tserr_long "$f.*\[0-9:\/ \]*" lappend tserr_mcookie $f } } } set tserr_avail1 [join $tserr \n] testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1 set tserr_avail1_long .*[join $tserr_long \n] testouterr_cmd_re sh {avail -a -l} OK $tserr_avail1_long set tserr_avail2 [join {foobar} \n] testouterr_cmd sh {avail -a -t -o foo} OK $tserr_avail2 set tserr_whatis1 "$modlin [escre $mp1] $modlin \\s+bar/1.0: bar/1.0 \\s+bar/2.0: bar/2.0 \\s+baz/w s: baz/w s \\s+baz/w\"s: baz/w\"s \\s+baz/w#s: baz/w#s \\s+foobar: foobar \\s+quux/sub/1.0: quux/sub/1.0 \\s+quux/sub/2.0: quux/sub/2.0 \\s+quuxbar: quuxbar \\s+quxa/1.0: quxa/1.0 \\s+quxb/1.0: quxb/1.0 \\s+quxd/1.0: quxd/1.0 \\s+quxe/1.0: quxe/1.0 \\s+w s/1.0: w s/1.0 \\s+w\"s/1.0: w\"s/1.0 \\s+w#s/1.0: w#s/1.0" testouterr_cmd_re sh whatis OK $tserr_whatis1 set tserr_whatis2 "$modlin [escre $mp1] $modlin \\s+baz/w s: baz/w s \\s+baz/w\"s: baz/w\"s \\s+baz/w#s: baz/w#s" testouterr_cmd_re sh {whatis baz} OK $tserr_whatis2 set ans_load1_b [list] lappend ans_load1_b [list set __MODULES_LMALTNAME bar/2.0&as|bar/default&as|bar/latest] lappend ans_load1_b [list set _LMFILES_ $mp1/bar/2.0] lappend ans_load1_b [list set LOADEDMODULES bar/2.0] testouterr_cmd sh {load bar} $ans_load1_b {} set tserr_load2_b "$err_path'foo/1.0'" testouterr_cmd sh {load foo/1.0} ERR $tserr_load2_b set tserr_load3_b "$err_path'foo/3.0'" testouterr_cmd sh {load foo/3.0} ERR $tserr_load3_b set tserr_load4_b "$err_path'foo/5.0'" testouterr_cmd_re sh {load foo/5.0} ERR $tserr_load4_b testouterr_cmd sh {load .hid} $ans_load5 {} # test indepth/noindepth resolution set tserr "$mp1: bar/ baz/ foobar quux/ quuxbar quxa/ quxb/ quxd/ quxe/ 'w s'/ w\"s/ w#s/" testouterr_cmd sh {avail -t --no-indepth} OK $tserr set tserr "$mp1: quux/ quuxbar" testouterr_cmd sh {avail -t --no-indepth quux} OK $tserr set tserr "$mp1: quux/sub/" testouterr_cmd sh {avail -t --no-indepth quux/} OK $tserr testouterr_cmd sh {avail -t --no-indepth quux/*} OK $tserr set tserr "" testouterr_cmd sh {avail -t --no-indepth quux/o} OK $tserr testouterr_cmd sh {avail -t --no-indepth quux/nok} OK $tserr testouterr_cmd sh {avail -t --no-indepth quux/no} OK $tserr # cache usage when mcookie_check is set to eval (same result as if option # is set to always unless for limited-acces elements that are lived resolved) setenv_var MODULES_MCOOKIE_CHECK eval set tserr_avail1_mcookie [join $tserr_mcookie \n] testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1_mcookie testouterr_cmd sh {avail -a -t -o foo} OK $tserr_avail2 testouterr_cmd_re sh whatis OK $tserr_whatis1 testouterr_cmd_re sh {whatis baz} OK $tserr_whatis2 testouterr_cmd sh {load bar} $ans_load1_b {} testouterr_cmd sh {load foo/1.0} ERR $tserr_load2_b testouterr_cmd sh {load foo/3.0} ERR $tserr_load3_b testouterr_cmd_re sh {load foo/5.0} ERR $tserr_load4_b testouterr_cmd sh {load .hid} $ans_load5 {} setenv_var MODULES_MCOOKIE_CHECK always # cache usage when mcookie_version_check is disabled (same result as if # option is enabled unless for limited-access elements that are lived checked) setenv_var MODULES_MCOOKIE_VERSION_CHECK 0 testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1 testouterr_cmd sh {avail -a -t -o foo} OK $tserr_avail2 testouterr_cmd_re sh whatis OK $tserr_whatis1 testouterr_cmd_re sh {whatis baz} OK $tserr_whatis2 testouterr_cmd sh {load bar} $ans_load1_b {} testouterr_cmd sh {load foo/1.0} ERR $tserr_load2_b testouterr_cmd sh {load foo/3.0} ERR $tserr_load3_b testouterr_cmd_re sh {load foo/5.0} ERR $tserr_load4_b testouterr_cmd sh {load .hid} $ans_load5 {} setenv_var MODULES_MCOOKIE_VERSION_CHECK 1 # second limited set (for all) change_file_perms $mp1/quux $no_ar_perms restore_file_perms $mp1/foo restore_file_perms $mp1/.modulerc restore_file_perms $mp1/bar/.version change_file_perms $mp1/.version $no_ar_perms change_file_perms $mp1/foo/1.0 $no_ar_perms change_file_perms $mp1/foo/.modulerc $no_arx_perms change_file_perms $mp1/othhid/.deep $no_arx_perms change_file_perms $mp1/othhid2 $no_arx_perms change_file_perms $mp1/.hid/1.0 $no_ar_perms # create file cache for test set tserr [msg_create $mp1cache] testouterr_cmd sh cachebuild OK $tserr set tserr {} set tserr_long {} foreach f [lsort [array names file_arr]] { switch -glob -- $f { */.modulerc - */.version - foo/1.0 - foo/3.0 - quux/nok/5.0 -\ empty/notamodule - empty/deep/notadeepmodule - .modulerc -\ .version - .git/ignmod - quux/SCCS/ignmod - {w s/1.0~} -\ foo/1.0,v - quxc/1.0~ - .svn/ignmod - .sos/ignmod {} foo/1.0 - quux/* - baz/.1.10 - quxc/1.0 - othhid/.deep/* -\ othhid2/* - .hid/1.0 {} {* *} { lappend tserr '$f' lappend tserr_long "'$f'.*\[0-9:\/ \]*" } default { lappend tserr $f lappend tserr_long "$f.*\[0-9:\/ \]*" } } } set tserr_avail1 [join $tserr \n] testouterr_cmd sh {avail -a -t -o } OK $tserr_avail1 set tserr_avail1_long .*[join $tserr_long \n] testouterr_cmd_re sh {avail -a -l} OK $tserr_avail1_long set tserr_avail2 [join {foo/2.0 foo/4.0 foo/5.0 foo/6.0 foobar} \n] testouterr_cmd sh {avail -a -t -o foo} OK $tserr_avail2 set tserr_whatis1 "$modlin [escre $mp1] $modlin \\s+bar/1.0: bar/1.0 \\s+bar/2.0: bar/2.0 \\s+baz/w s: baz/w s \\s+baz/w\"s: baz/w\"s \\s+baz/w#s: baz/w#s \\s+foo/2.0: foo/2.0 \\s+foobar: foobar \\s+quuxbar: quuxbar \\s+quxa/1.0: quxa/1.0 \\s+quxb/1.0: quxb/1.0 \\s+quxd/1.0: quxd/1.0 \\s+quxe/1.0: quxe/1.0 \\s+w s/1.0: w s/1.0 \\s+w\"s/1.0: w\"s/1.0 \\s+w#s/1.0: w#s/1.0" testouterr_cmd_re sh whatis OK $tserr_whatis1 set tserr_whatis2 "$modlin [escre $mp1] $modlin \\s+baz/w s: baz/w s \\s+baz/w\"s: baz/w\"s \\s+baz/w#s: baz/w#s" testouterr_cmd_re sh {whatis baz} OK $tserr_whatis2 testouterr_cmd sh {load bar} $ans_load1 {} set tserr_load2_c [err_permdenied $mp1/foo/1.0] testouterr_cmd sh {load foo/1.0} ERR $tserr_load2_c set tserr_load3_c "[moderr_minverreq $mp1/foo/3.0 99]" testouterr_cmd sh {load foo/3.0} ERR $tserr_load3_c set tserr_load4_c "[escre [msg_load foo/5.0 [msg_moderr {missing close-brace} if\ \{ $mp1/foo/5.0 2]]]" testouterr_cmd_re sh {load foo/5.0} ERR $tserr_load4_c set tserr_load5_c $err_path'.hid' testouterr_cmd sh {load .hid} ERR $tserr_load5_c restore_file_perms $mp1/quux restore_file_perms $mp1/quux/oth restore_file_perms $mp1/empty restore_file_perms $mp1/anotherempty restore_file_perms $mp1/quxa/.modulerc restore_file_perms $mp1/baz/.1.10 restore_file_perms $mp1/quxc/1.0 restore_file_perms $mp1/quxc/1.0~ restore_file_perms $mp1/.svn restore_file_perms $mp1/.sos/ignmod restore_file_perms $mp1/.version restore_file_perms $mp1/foo/1.0 restore_file_perms $mp1/foo/.modulerc restore_file_perms $mp1/othhid/.deep restore_file_perms $mp1/othhid2 restore_file_perms $mp1/.hid/1.0 # test potential double cache evaluation situation setenv_var MODULEPATH $mp2 file mkdir $mp2 set fid [open $mp2/foo w] puts $fid {#%Module if {[is-avail bar]} { module load bar } } close $fid create_dummy_modulefile $mp2/bar change_file_perms $mp2/foo $no_or_perms change_file_perms $mp2/bar $no_or_perms set tserr [msg_create $mp2cache] testouterr_cmd sh cachebuild OK $tserr set ans [list] lappend ans [list set __MODULES_LMPREREQ foo&bar] lappend ans [list set _LMFILES_ $mp2/bar:$mp2/foo] lappend ans [list set LOADEDMODULES bar:foo] lappend ans [list set __MODULES_LMTAG bar&auto-loaded] set tserr ".* DEBUG findModulesInCacheFile: cache file '[escre $mp2cache]' exists and is readable .* DEBUG findModulesInCacheFile: 0 elements are cached for '[escre $mp2]' DEBUG findModulesInCacheFile: 2 limited access files for '[escre $mp2]' DEBUG findModulesInCacheFile: 0 limited access dirs for '[escre $mp2]' .* DEBUG findModulesInCacheFile: found foo \\(1\\) .* DEBUG \\\[#1:load:foo\\\] findModulesInCacheFile: cache file '[escre $mp2cache]' has already been evaluated DEBUG \\\[#1:load:foo\\\] findModulesInCacheFile: 0 elements are cached for '[escre $mp2]' DEBUG \\\[#1:load:foo\\\] findModulesInCacheFile: 2 limited access files for '[escre $mp2]' DEBUG \\\[#1:load:foo\\\] findModulesInCacheFile: 0 limited access dirs for '[escre $mp2]' DEBUG \\\[#1:load:foo\\\] findModulesInCacheFile: found bar \\(1\\) .*" testouterr_cmd_re sh {load foo -D} $ans $tserr # also test that only matching limited-access module is checked set tserr ".* DEBUG findModulesInCacheFile: findModulesFromDirsAndFiles [escre $mp2] [escre $mp2]/foo 0 0 cache_arr modfile_indir hidden_list flimited_arr dlimited_arr .*" testouterr_cmd_re sh {avail foo -DD} OK $tserr restore_file_perms $mp2/foo restore_file_perms $mp2/bar file delete $mp2cache file delete $mp2/bar file delete $mp2/foo file delete $mp2 setenv_var MODULEPATH $mp1 # test symbol/tag resolution (with limited access rc for others) change_file_perms $mp1/quux/.modulerc $no_or_perms set tserr [msg_create $mp1cache] testouterr_cmd sh cachebuild OK $tserr set tserr "$mp1: quux/oth/(default) quux/oth/3.0(sym) quux/oth/4.0 quux/sub/1.0 quux/sub/2.0 quuxbar" testouterr_cmd sh {avail -t quux} OK $tserr # test symbol/tag resolution (with limited access rc for all) restore_file_perms $mp1/quux/.modulerc change_file_perms $mp1/quux/.modulerc $no_ar_perms set tserr [msg_create $mp1cache] testouterr_cmd sh cachebuild OK $tserr set tserr "$mp1: quux/oth/3.0 quux/oth/4.0 quux/sub/1.0 quux/sub/2.0 quuxbar" testouterr_cmd sh {avail -t quux} OK $tserr restore_file_perms $mp1/quux/.modulerc # test debug output setenv_var MODULEPATH $mp2 lassign [create_simple_module_setup $mp2] other_dir_list other_file_list array set other_file_arr $other_file_list change_file_perms $mp2/foo $no_orx_perms set tserr [msg_create $mp2cache] testouterr_cmd sh cachebuild OK $tserr set tserr ".* DEBUG findModulesInCacheFile: cache file '[escre $mp2]/.modulecache' exists and is readable .* DEBUG findModulesInCacheFile: 2 elements are cached for '[escre $mp2]' DEBUG findModulesInCacheFile: 0 limited access files for '[escre $mp2]' DEBUG findModulesInCacheFile: 1 limited access dirs for '[escre $mp2]' .* DEBUG findModulesInCacheFile: found foo/.modulerc foo/1.0 \\(2\\) .*" testouterr_cmd_re sh {avail -D -t foo/1.0} OK $tserr set tserr ".* DEBUG findModulesInCacheFile: cache file '[escre $mp2]/.modulecache' exists and is readable DEBUG setConf: cache_expiry_secs set to '0' DEBUG findModulesInCacheFile: execute-cachefile [escre $mp2]/.modulecache [escre $mp2] .* DEBUG findModulesInCacheFile: 2 elements are cached for '[escre $mp2]' DEBUG findModulesInCacheFile: 0 limited access files for '[escre $mp2]' DEBUG findModulesInCacheFile: 1 limited access dirs for '[escre $mp2]' .* DEBUG findModulesInCacheFile: found foo/.modulerc foo/1.0 \\(2\\) .*" testouterr_cmd_re sh {avail -DD -t foo/1.0} OK $tserr set tserr ".* TIMER findModulesInCacheFile [escre $mp2] foo 0 0 \\(.* ms\\) .* [escre $mp2]: foo/1.0 .*" testouterr_cmd_re sh {avail -D --timer -t foo/1.0} OK $tserr testouterr_cmd_re sh {avail -DD --timer -t foo/1.0} OK $tserr set tserr ".* Get modules: {} matching 'foo/1.0' in '' Evaluate cache file: '[escre $mp2cache]' Evaluate modulerc: '[escre $mp2]/foo/.modulerc' Get modules: {foo/1.0} matching 'foo/1.0' in '[escre $mp2]' [escre $mp2]: foo/1.0" testouterr_cmd_re sh {avail -T -t foo/1.0} OK $tserr file delete $mp2cache set tserr ".* Get modules: {} matching 'foo/1.0' in '' Evaluate modulerc: '[escre $mp2]/foo/.modulerc' Get modules: {foo/1.0} matching 'foo/1.0' in '[escre $mp2]' [escre $mp2]: foo/1.0" testouterr_cmd_re sh {avail -T -t foo/1.0} OK $tserr restore_file_perms $mp2/foo # # Cleanup # # delete generated cache file file delete $mp1cache file delete $mp2cache # delete created files and dirs delete_module_setup $mp1 [array names file_arr] $dir_list delete_module_setup $mp2 [array names other_file_arr] $other_dir_list reset_test_env }