##############################################################################
#   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{
#			Handling of bad modulepath
#		}C%
#
##############################################################################

#
# Variables for this test
#

set module "loc_rc6"

set file_modpath $::env(TESTSUITEDIR)/systest

set hide_perms "ugo-rx"

#
# Test global access to the modulefiles when modulepath is a regular file
#

setenv_path_var MODULEPATH $file_modpath

# nothing found
testouterr_cmd "sh" "whatis" "OK" ""
testouterr_cmd "sh" "avail" "OK" ""
testouterr_cmd "sh" "aliases" "OK" ""

#
# Test access to modulefile when modulepath is a regular file
#

# 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 it is not a directory
#

# normal disabling, as no directory access
lappend ans [list unsetpath MODULEPATH]
testouterr_cmd "sh" "unuse $file_modpath" $ans ""


#
# Cleanup
#

reset_test_env
