Debian Codegraph @

testsuite/modules.50-cmds/250-x-resource.exp

raw
1 ##############################################################################
2 # Modules Revision 3.0
3 # Providing a flexible user environment
4 #
5 # File: modules.50-cmds/%M%
6 # Revision: %I%
7 # First Edition: 2016/07/21
8 # Last Mod.: %U%, %G%
9 #
10 # Authors: Xavier Delaruelle
11 #
12 # Description: Testuite testsequence
13 # Command: load & unload
14 # Modulefiles: x-resource/1
15 # Sub-Command:
16 #
17 # Comment: %C{
18 # Tests the 'x-resource' module subcommand
19 # }C%
20 #
21 ##############################################################################
22
23 # ensure auto symbolic versions are not set for these tests
24 setenv_var MODULES_ADVANCED_VERSION_SPEC 0
25
26 #
27 # Variables. This test forces a module load then a module unload commands.
28 # It will result in the environment variables "_LMFILES_", "LOADEDMODULES"
29 # to be set up and in xrdb utility calls to be made. When unloading
30 # environment variables will be unset and new calls to xrdb will be made
31 # to clean x-resource properties from their values
32 #
33
34 set module "x-resource/1"
35 set modulefile "$modpath/$module"
36 set xresfile [regsub -all "\(\[.+?\]\)" "$env(TESTSUITEDIR)/home/.Xresources" {\\\1}]
37 set xresprop1 "my-other-prog\\*complex-ress-value"
38 set xresprop2 "my-prog\\*my-ress"
39 set xresprop3 "another-prog.one-prop"
40 set xresprop4 "another-prog.another-prop"
41 set xresprop5 "my-other-prog\\*my-other-ress"
42 set xresval1 "-fontname-bold-r-\\*-12-\\*-\\*-\\*-\\*-\\*"
43 set xresval2 "true"
44 set xresval5 "Fontname:style=Regular:size=10"
45
46
47 #
48 # load
49 # For the different shells ...
50 #
51
52 lappend ans [list xres $xresfile]
53 lappend ans [list xres $xresprop2 $xresval2]
54 lappend ans [list xres $xresprop5 $xresval5]
55 lappend ans [list xres $xresprop1 $xresval1]
56 lappend ans [list set LOADEDMODULES $module]
57 lappend ans [list set _LMFILES_ $modulefile]
58
59 lappend anscmd [list set _LMFILES_ $modulefile]
60 lappend anscmd [list set LOADEDMODULES $module]
61
62
63 #
64 # The load tests
65 #
66
67 # if error when testing X11 setup, will get an error not a loaded module
68 if {[info exists x11_warn]} {
69 testouterr_cmd "ALL" "load $module" "ERR" [msg_load $module $x11_warn]
70 } else {
71 foreach shell $supported_shells {
72 if {$shell in {cmd pwsh}} {
73 test_cmd_re $shell "load $module" $anscmd
74 } else {
75 test_cmd_re $shell "load $module" $ans
76 }
77 }
78 }
79
80 skip_if_quick_mode
81
82
83 # setup an empty path
84 if {$verbose} {
85 send_user "\tSetup PATH = \n"
86 }
87 set env(PATH) ""
88
89 # cannot find xrdb bin
90 testouterr_cmd "ALL" "load $module" "ERR" [msg_load $module $xrdb_warn]
91
92 # restore default testsuite path
93 if {$verbose} {
94 send_user "\tRestore PATH = $ORIG_PATH\n"
95 }
96 set env(PATH) $ORIG_PATH
97
98
99 #
100 # set-up a loaded environment
101 #
102 setenv_loaded_module $module $modulefile
103
104 #
105 # For the different shells ...
106 #
107
108 set ans [list]
109 lappend ans [list unxres $xresprop3 $xresfile]
110 lappend ans [list unxres $xresprop4 $xresfile]
111 lappend ans [list unxres $xresprop2]
112 lappend ans [list unxres $xresprop5]
113 lappend ans [list unxres $xresprop1]
114 lappend ans [list unset LOADEDMODULES]
115 lappend ans [list unset _LMFILES_]
116
117 set anscmd [list]
118 lappend anscmd [list unset _LMFILES_]
119 lappend anscmd [list unset LOADEDMODULES]
120
121 #
122 # The unload tests
123 #
124
125 # if error when testing X11 setup, will get an error not a loaded module
126 if {[info exists x11_warn]} {
127 testouterr_cmd "ALL" "unload $module" "ERR" [msg_unload $module $x11_warn]
128 } else {
129 foreach shell $supported_shells {
130 if {$shell in {cmd pwsh}} {
131 test_cmd_re $shell "unload $module" $anscmd
132 } else {
133 test_cmd_re $shell "unload $module" $ans
134 }
135 }
136 }
137
138 # setup an empty path
139 if {$verbose} {
140 send_user "\tSetup PATH = \n"
141 }
142 set env(PATH) ""
143
144 # cannot find xrdb bin
145 testouterr_cmd "ALL" "unload $module" "ERR" [msg_unload $module $xrdb_warn]
146
147 # restore default testsuite path
148 if {$verbose} {
149 send_user "\tRestore PATH = $ORIG_PATH\n"
150 }
151 set env(PATH) $ORIG_PATH
152
153
154 #
155 # Cleanup
156 #
157
158 reset_test_env