############################################################################## # Modules Revision 3.0 # Providing a flexible user environment # # File: modules.20-locate/%M% # Revision: %I% # First Edition: 2017/05/27 # Last Mod.: %U%, %G% # # Authors: Xavier Delaruelle, xavier.delaruelle@cea.fr # # Description: Testuite testsequence # Command: use, unuse, load, display, whatis, avail, aliases # Modulefiles: # Sub-Command: # # Comment: %C{ # Modulepath handling when access rights to get to it does not # allow it # }C% # ############################################################################## # 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" } else { # # Variables for this test # set module "loc_rc6" set hide_perms "ugo-rx" # # Test enabling modulepath when access not granted to it # unsetenv_path_var MODULEPATH change_file_perms $modpath $hide_perms # normal enabling, as no directory access lappend ans [list set MODULEPATH $modpath] testouterr_cmd "sh" "use $modpath" $ans "" setenv_path_var MODULEPATH $modpath # # Test global access to the modulefiles of a modulepath when access not # granted on this modulepath # # no test if files or dirs in a locked directory are still readable on this system if {!$is_locked_dir_file_readable} { # nothing found testouterr_cmd "sh" "whatis" "OK" "" testouterr_cmd "sh" "avail" "OK" "" testouterr_cmd "sh" "aliases" "OK" "" } restore_file_perms $modpath skip_if_quick_mode change_file_perms $modpath $hide_perms # # Test access to modulefile when access not granted on modulepath # # different result if a file in a locked directory still readable on this system if {$is_locked_dir_file_readable} { setenv_var MODULES_ADVANCED_VERSION_SPEC 1 set lm "$module/1.2" set lmf "$modpath/$lm" set lmfre "$modpathre/$lm" set ans [list] lappend ans [list set __MODULES_LMALTNAME $lm&loc_rc6/default&loc_rc6&loc_rc6/new&al|loc_rc6/1&al|loc_rc6/bar&as|loc_rc6/latest] lappend ans [list set _LMFILES_ $lmf] lappend ans [list set LOADEDMODULES $lm] lappend ans [list set testsuite yes] testouterr_cmd "sh" "load $module" $ans "" testouterr_cmd_re "sh" "display $module" "OK" "$modlin\n$lmfre:\n\nmodule-whatis\t$lm\nsetenv\t\ttestsuite yes\n$modlin" testouterr_cmd_re "sh" "whatis $module" "OK" "$modlin $modpathre $modlin\n\\s+$module/0.9: $module/0.9\n\\s+$lm: $lm" unset lm unset lmf unset lmfre unsetenv_var MODULES_ADVANCED_VERSION_SPEC } else { # nothing found testouterr_cmd "sh" "load $module" "ERR" "$err_path'$module'" testouterr_cmd "sh" "display $module" "ERR" "$err_path'$module'" testouterr_cmd "sh" "whatis $module" "ERR" "$err_path'$module'" testouterr_cmd "sh" "avail -t $module" "OK" "" } # # Test disabling modulepath when access not granted to it # # normal disabling, as no directory access set ans [list] lappend ans [list unset MODULEPATH] testouterr_cmd "sh" "unuse $modpath" $ans "" restore_file_perms $modpath # # Cleanup # reset_test_env }