Debian Codegraph @

testsuite/modulefiles/spread/5.0

raw
1 #%Module1.0
2
3 ##############################################################################
4 # Modules Revision 3.0
5 # Providing a flexible user environment
6 #
7 # File: spread/%M%
8 # Revision: %I%
9 # First Edition: 2017/06/21
10 # Last Mod.: %U%, %G%
11 #
12 # Authors: Xavier Delaruelle, [email protected]
13 #
14 # Description: Testuite modulefile
15 # Command:
16 # Sub-Command:
17 #
18 # Invocation: load @M@, unload @M@, switch @M@ @M@,
19 # help @M@, display @M@, test @M@, whatis @M@
20 # Result: %R{
21 # }R%
22 # Comment: %C{
23 # Test how variable and procedure definitions spread from
24 # one modulefile interpretation to another one when these
25 # interpretations are cascaded.
26 # }C%
27 #
28 ##############################################################################
29
30
31 # test if specific or overridden pre-existing variables have spread here
32 if {[info exists spread]} {
33 puts stderr "variable spread exists"
34 }
35 if {$tcl_version eq "test"} {
36 puts stderr "variable tcl_version equals test"
37 }
38 if {[array exists spread_array]} {
39 puts stderr "array variable spread_array exists"
40 }
41 if {$tcl_platform(osVersion) eq "test"} {
42 puts stderr "variable tcl_platform(osVersion) equals test"
43 }
44 if {[llength $auto_path] <= 1} {
45 puts stderr "variable auto_path has lost elements"
46 }
47 if {[lsearch -exact $auto_path $env(TESTSUITEDIR)] > -1} {
48 puts stderr "variable auto_path contains $env(TESTSUITEDIR)"
49 }
50
51 # test if specific or overridden interpreter alias command have spread here
52 set existing_proc [lindex [info procs] 0]
53 # test if first proc defined has been altered
54 if {[info procs $existing_proc] ne $existing_proc} {
55 puts stderr "procedure $existing_proc does not exist"
56 # env variable spread across interpretation and even between interpreters
57 } elseif {[info exists env(spreadcasc)] && [$existing_proc] ne "spreadcasc"} {
58 puts stderr "procedure $existing_proc has not been altered"
59 }
60 if {[info procs spread_proc] eq "spread_proc"} {
61 puts stderr "procedure spread_proc exists"
62 }
63 if {[info procs ModulesHelp] eq "ModulesHelp"} {
64 puts stderr "procedure ModulesHelp exists"
65 }
66 if {[info procs ModulesTest] eq "ModulesTest"} {
67 puts stderr "procedure ModulesTest exists"
68 }
69 if {[info procs ModulesDisplay] eq "ModulesDisplay"} {
70 puts stderr "procedure ModulesDisplay exists"
71 }
72 if {[info procs module-version] eq "module-version"} {
73 puts stderr "procedure module-version exists"
74 }
75
76
77 # define specific variables or override value in pre-existing variables
78 set spread "yes"
79 set tcl_version "test"
80 array set spread_array [list "yes" 1]
81 set tcl_platform(osVersion) "test"
82 lappend auto_path $env(TESTSUITEDIR)
83 set env(spreadcasc) "yes"
84
85 # define specific procs or override interpreter alias command
86 # override first proc defined
87 proc $existing_proc {args} {
88 return "spreadcasc"
89 }
90 proc spread_proc {text} {
91 puts stderr "spread_proc: $text"
92 }
93 proc ModulesHelp {} {
94 puts stderr "spread"
95 }
96 proc ModulesTest {} {
97 puts stderr "spread"
98 return 1
99 }
100 proc ModulesDisplay {} {
101 puts stderr "spread"
102 }
103 proc module-version {args} {
104 puts stderr "spread"
105 }
106
107 setenv testspread "yes"
108
109 module load spread/6.0
110
111 # test if specific or overridden pre-existing variables are still there
112 # after cascaded interpretation
113 if {![info exists spread]} {
114 puts stderr "variable spread has been reset"
115 }
116 if {$tcl_version ne "test"} {
117 puts stderr "variable tcl_version has been reset"
118 }
119 if {![array exists spread_array]} {
120 puts stderr "array variable spread_array has been reset"
121 }
122 if {$tcl_platform(osVersion) ne "test"} {
123 puts stderr "variable tcl_platform(osVersion) has been reset"
124 }
125
126 # test if specific or overridden interpreter alias command are still there
127 # after cascaded interpretation
128 # test if first proc defined has been altered
129 if {[info procs $existing_proc] ne $existing_proc} {
130 puts stderr "procedure $existing_proc does not exist"
131 # env variable spread across interpretation and even between interpreters
132 } elseif {[info exists env(spreadcasc)] && [$existing_proc] ne "spreadcasc"} {
133 puts stderr "procedure $existing_proc has been reset"
134 }
135 if {[info procs spread_proc] ne "spread_proc"} {
136 puts stderr "procedure spread_proc has been reset"
137 }
138 if {[info procs ModulesHelp] ne "ModulesHelp"} {
139 puts stderr "procedure ModulesHelp has been reset"
140 }
141 if {[info procs ModulesTest] ne "ModulesTest"} {
142 puts stderr "procedure ModulesTest has been reset"
143 }
144 if {[info procs ModulesDisplay] ne "ModulesDisplay"} {
145 puts stderr "procedure ModulesDisplay has been reset"
146 }
147 if {[info procs module-version] ne "module-version"} {
148 puts stderr "procedure module-version has been reset"
149 }
150