File: 031-append.exp

package info (click to toggle)
modules 5.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 20,572 kB
  • sloc: exp: 46,525; sh: 5,261; tcl: 3,182; makefile: 1,355; ansic: 466; python: 251; csh: 201; perl: 47; ruby: 44
file content (99 lines) | stat: -rw-r--r-- 2,245 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
##############################################################################
#   Modules Revision 3.0
#   Providing a flexible user environment
#
#   File:		modules.10-use/%M%
#   Revision:		%I%
#   First Edition:	95/12/06
#   Last Mod.:		%U%, %G%
#
#   Authors:		Jens Hamisch, Jens.Hamisch@Strawberry.COM
#
#   Description:	Testuite testsequence
#   Command:		use -append
#   Sub-Command:
#
#   Comment:	%C{
#			Check appending a new path to the current lists of
#			module paths.
#		}C%
#
##############################################################################

skip_if_quick_mode

#
# Variables for this test
#

set path "$modpath.2"
set badpath "$modpath.bad"
set mod_path "$modpath:$path"
set loaded_path "$modpath"

set use	"use --append"

#
# The tests ...
#

lappend ans [list set MODULEPATH $mod_path]
test_cmd_re "ALL" "$use $path" $ans

#
# test if use non-existent modulefile directory
#

set ans [list]
lappend ans [list set MODULEPATH $modpath:$badpath]
testouterr_cmd_re "ALL" "$use $badpath" $ans {}

#
# test with uninitialized MODULEPATH
#

unsetenv_path_var MODULEPATH

set ans [list]
lappend ans [list set MODULEPATH $path]
test_cmd_re "ALL" "$use $path" $ans

setenv_path_var MODULEPATH $modpath

#
# test with already loaded path
# re-export (C version does no modification)
#
set ans [list]
lappend ans [list set MODULEPATH $loaded_path]
test_cmd "ALL" "$use $loaded_path" $ans


#
# Test usage of variable reference
#

set ans [list]
lappend ans [list set MODULEPATH $modpath:\$TESTSUITEDIR/modulefiles.2]
testouterr_cmd "sh" "$use \$TESTSUITEDIR/modulefiles.2" $ans {}

setenv_path_var MODULEPATH $modpath \$TESTSUITEDIR/modulefiles.2
testouterr_cmd "sh" "$use \$TESTSUITEDIR/modulefiles.2" $ans {}

set ans [list]
lappend ans [list set MODULEPATH $modpath:\$TESTSUITEDIR/modulefiles.2:$env(TESTSUITEDIR)/modulefiles.2]
testouterr_cmd "sh" "$use $env(TESTSUITEDIR)/modulefiles.2" $ans {}

setenv_path_var MODULEPATH $env(TESTSUITEDIR)/modulefiles.2 $modpath
set ans [list]
lappend ans [list set MODULEPATH $env(TESTSUITEDIR)/modulefiles.2:$modpath:\$TESTSUITEDIR/modulefiles.2]
testouterr_cmd "sh" "$use \$TESTSUITEDIR/modulefiles.2" $ans {}

setenv_path_var MODULEPATH $modpath


#
# Cleanup
#

reset_test_env