##############################################################################
#   Modules Revision 3.2.8
#   Providing a flexible user environment
#
#   First Edition:	2010/09/13
#
#   Authors:		R.K. Owen, rk@owen.sj.ca.us
#
#   Description:	Deep modulefile directories
#
##############################################################################

if [info exists env(TESTSUITEDIR)] {
    set	saved_modpath $modpath
    set	saved_modpathre $modpathre
    set	modpath	"$env(TESTSUITEDIR)/modulefiles.deep"
    set modpathre [regsub -all "\(\[.+?\]\)" $modpath {\\\1}]
    setenv_path_var MODULEPATH $saved_modpath $modpath
} else {
    send_user "\n\n\nFATAL: Please set the TESTSUITEDIR env var first\n\n\n"
    exit
}

set cplain	"plain"
set iplain0	"plain"
set oplain0	"plain/dir2/2.0"
set iplain1	"plain/dir1"
set oplain1	"plain/dir1/2.0"

set cmodulerc	"modulerc"
set imodulerc0	"modulerc"
set omodulerc0	"modulerc/dir1/1.0"
set omodulerc0alt "$omodulerc0&$cmodulerc/dir1/default&$cmodulerc/dir1&$cmodulerc/default&$cmodulerc"
set imodulerc1	"modulerc/dir2"
set omodulerc1	"modulerc/dir2/1.0/rc1"
set omodulerc1alt "$omodulerc1&modulerc/dir2/1.0/default&modulerc/dir2/1.0&modulerc/dir2/default&modulerc/dir2&modulerc/foo&modulerc/dir2/foo&modulerc/dir2/1.0/foo"
set imodulerc2	"modulerc/dir2/2.0"
set omodulerc2	"modulerc/dir2/2.0"

set cversion	"version"
set iversion0	"version"
set oversion0	"version/dir1/1.0"
set oversion0alt "$oversion0&version/dir1/default&version/dir1&version/default&version"
set iversion1	"version/dir2"
set oversion1	"version/dir2/2.0/rc1"
set oversion1alt "$oversion1&version/dir2/2.0/default&version/dir2/2.0&version/dir2/default&version/dir2"
set iversion2	"version/dir2/1.0"
set oversion2	"version/dir2/1.0"

set cload	"modload"
set iload0	"modload"
set oload0	"modload/dir2/3.0"
set oload0alt "$oload0&modload/dir2/md3"
set osload0	"md3"
set rload0	"dir2/3.0"
set rload0alt "$rload0&dir2/d3"
set rsload0	"d3"
set iload1	"modload/dir2"
set oload1	"modload/dir2/3.0"
set oload1alt "$oload1&modload/dir2/md3"
set osload1	"md3"
set rload1	"dir2/3.0"
set rload1alt "$rload1&dir2/d3"
set rsload1	"d3"
set iload2	"modload/dir2/1.0"
set oload2	"modload/dir2/1.0"
set oload2alt "$oload2&modload/dir2/md1"
set osload2	"md1"
set rload2	"dir2/1.0"
set rload2alt "$rload2&dir2/d1"
set rsload2	"d1"

set calias  "modalias"
set ialias0	"modalias"
set oalias0	"modalias/3.0"
set oalias0alt	"modalias/3.0&al|modalias/dir2/3.0"
set ialias1	"modalias/1.0"
set oalias1	"modalias/dir1/1.0"
set oalias1alt	"modalias/dir1/1.0&al|modalias/1.0"
set ialias2	"modalias/dir1/2.0"
set oalias2	"modalias/dir2/2.0"
set oalias2alt	"modalias/dir2/2.0&al|modalias/dir1/2.0"
set ialias3	"modalias/dir2/3.0"
set oalias3	"modalias/3.0"
set oalias3alt	$oalias0alt

set csym  "modsym"
set isym0 "modsym"
set osym0 "modsym/dir2/2.0"
set osym0alt "modsym/dir2/2.0&modsym/dir2/3.0"
set isym1 "modsym/dir1/3.0"
set osym1 "modsym/dir1/1.0"
set osym1alt "modsym/dir1/1.0&modsym/dir1/3.0"
set isym2 "modsym/dir2/3.0"
set osym2 "modsym/dir2/2.0"
set osym2alt "modsym/dir2/2.0&modsym/dir2/3.0"

set cvirt  "modvirt"
set pvirt  "$modpath/$cvirt/.common"
set pvirtre "$modpathre/$cvirt/.common"
set ivirt0 "modvirt"
set ovirt0 "modvirt/3.0"
set ovirt0alt "modvirt/3.0&al|modvirt/dir2/3.0&al|modvirt/dir0/sub1/5.0"
set ivirt1 "modvirt/1.0"
set ovirt1 "modvirt/dir1/1.0"
set ovirt1alt "modvirt/dir1/1.0&al|modvirt/1.0"
set ivirt2 "modvirt/dir1/2.0"
set ovirt2 "modvirt/dir2/2.0"
set ovirt2alt "modvirt/dir2/2.0&al|modvirt/dir1/2.0"
set ivirt3 "modvirt/dir2/3.0"
set ovirt3 "modvirt/3.0"
set ovirt3alt $ovirt0alt
set ivirt4 "modvirt/dir1"
set ovirt4 "modvirt/dir2/2.0"
set ovirt4alt $ovirt2alt
set ivirt5 "modvirt/dir2"
set ovirt5 "modvirt/3.0"
set ovirt5alt $ovirt0alt
set ivirt6 "modvirt/dir0/sub1/4.0"
set ovirt6 "modvirt/dir0/sub1/4.0"
set ivirt7 "modvirt/dir0/sub1"
set ovirt7 "modvirt/dir0/sub1/6.0"
set ivirt8 "modvirt/dir0"
set ovirt8 "modvirt/dir0/sub1/6.0"

set cdalias  "moddalias"
set idalias0 "moddalias"
set odalias0 "moddalias/dir1/1"
set odalias0alt $odalias0&al|$cdalias
set idalias1 "moddalias/dir1"
set odalias1 "moddalias/dir1/1"
set odalias1alt $odalias1&al|$cdalias

set cbadvers "badmodvers"
set ibadvers0 "badmodvers"
set obadvers0 "badmodvers/foo"
set ibadvers1 "badmodvers/dir1"
set obadvers1 "badmodvers/dir1/2.0"

# save specific test env
save_test_env
