##############################################################################
#   Modules Revision 3.0
#   Providing a flexible user environment
#
#   File:		modules.50-cmds/%M%
#   Revision:		%I%
#   First Edition:	1995/12/06
#   Last Mod.:		%U%, %G%
#
#   Authors:		Jens Hamisch, Jens.Hamisch@Strawberry.COM
#
#   Description:	Testuite testsequence
#   Command:		load
#   Modulefiles:	uname
#   Sub-Command:
#
#   Comment:	%C{
#			Tests the 'uname' module command
#		}C%
#
##############################################################################

#
#  Variables. This test forces a module load command. It will result in the
#    environment variables "_LMFILES_", "LOADEDMODULES" and "testsuite" to
#    be set up
#

set module "uname"
set modulefile "$env(MODULEPATH)/$module"

#
#  For the different shells ...
#

set lmf "setenv _LMFILES_ $modulefile"
set lm "setenv LOADEDMODULES $module"
set ts "setenv testsuite "

#
#  The tests
#

regsub -all \# $u_version {\\#} u_version
switch -- $tcl_platform(os) {
    {FreeBSD} {
        regsub -all { $} $u_version {} u_version
    }
    {Darwin} {
        regsub -all {;} $u_version {\\;} u_version
    }
}
regsub -all { } $u_version {\\ } u_version
regsub -all {\(} $u_version {\\(} u_version
regsub -all {\)} $u_version {\\)} u_version
regsub -all {\(} $u_domainname {\\(} u_domainname
regsub -all {\)} $u_domainname {\\)} u_domainname
regsub -all {\(} $u_release {\\(} u_release
regsub -all {\)} $u_release {\\)} u_release

test_cmd "csh" "load $module/sysname" "$lm/sysname ;$lmf/sysname ;$ts$u_sysname ;"
test_cmd "csh" "load $module/nodename" "$lm/nodename ;$lmf/nodename ;$ts$u_nodename ;"
if { $u_domainname != "unknown" } {
	test_cmd "csh" "load $module/domain" "$lm/domain ;$lmf/domain ;$ts$u_domainname ;"
} else {
	test_cmd_re "csh" "load $module/domain" "$lm/domain ;$lmf/domain ;$ts.* ;"
}
test_cmd "csh" "load $module/release" "$lm/release ;$lmf/release ;$ts$u_release ;"
test_cmd "csh" "load $module/version" "$lm/version ;$lmf/version ;$ts$u_version ;"
test_cmd "csh" "load $module/machine" "$lm/machine ;$lmf/machine ;$ts$u_machine ;"

#
#  Cleanup
#

unset ts
unset lm
unset lmf

unset modulefile
unset module
