Debian Codegraph @

testsuite/modules.50-cmds/210-exit.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: 2006/02/13
8 # Last Mod.: %U%, %G%
9 #
10 # Authors: R.K. Owen, <[email protected]>
11 #
12 # Description: Testuite testsequence
13 # Command: load
14 # Modulefiles: exit/1.0,
15 # exit/2.0,
16 # exit/3.0, exit/4.0, loc_def/truedef
17 # Sub-Command:
18 #
19 # Comment: %C{
20 # Tries the Tcl "exit" to skip loading a module,
21 # but not affecting the other loaded modules.
22 # }C%
23 #
24 ##############################################################################
25
26 set mod1 "exit/1.0"
27 set mod2 "exit/2.0"
28 set mod3 "exit/3.0"
29 set mod4 "exit/4.0"
30
31 set mod1p "$modpath/$mod1"
32 set mod2pre "$modpathre/$mod2"
33 set mod3pre "$modpathre/$mod3"
34 set mod4pre "$modpathre/$mod4"
35
36 set introhelp "Module Specific Help for"
37 set warnnohelp "$warn_msgs: Unable to find ModulesHelp in"
38 set introtest "Module Specific Test for"
39 set warnnotest "$warn_msgs: Unable to find ModulesTest in"
40 set modpathheader "$modlin $modpathre $modlin"
41 set modnext "loc_def/truedef"
42 set modnextpre "$modpathre/$modnext"
43 set modnextwhatis "module named default test"
44
45 #
46 # set up an empty environment
47 #
48 set module ""
49 set modulefile ""
50 setenv_loaded_module $module $modulefile
51
52 #
53 # load
54 # For the different shells ...
55 #
56 set module "$mod1"
57 set modulefile "$mod1p"
58
59 lappend ans [list set _LMFILES_ $modulefile]
60 lappend ans [list set LOADEDMODULES $module]
61 lappend ans [list set testsuite1 yes]
62 lappend ans [list ERR]
63
64 #
65 # The tests
66 #
67
68 # different behavior than C-version: on Tcl-version exit code of the 'exit'
69 # command is not thrown as the modulecmd command exit value
70 test_cmd_re "ALL" "load $mod1 $mod2 $mod3" $ans
71
72 skip_if_quick_mode
73
74 test_cmd_re "ALL" "load $mod1 $mod3 $mod2" $ans
75
76 # tests that 'exit' does not inhibit next modulefile interpretations on non-load mode
77 testouterr_cmd_re "sh" "display $mod3 $modnext" "ERR" "$modlin\n$mod3pre:\n\nsetenv\t\ttestsuite3 no\n$modlin\n$modnextpre:\n\nmodule-whatis\t{$modnextwhatis}\n$modlin"
78 testouterr_cmd_re "sh" "whatis $mod3 $modnext" "ERR" "$modpathheader\n\\s+$modnext: $modnextwhatis"
79 # exit leads to no rendering of ModulesHelp or ModulesTest procs
80 testouterr_cmd_re "sh" "help $mod3 $modnext" "ERR" "$modlin\n$introhelp $mod3pre:\n\n$modlin\n$introhelp $modnextpre:\n\n$warnnohelp $modnextpre.\n$modlin"
81 testouterr_cmd_re "sh" "test $mod3 $modnext" "ERR" "$modlin\n$introtest $mod3pre:\n\n$modlin\n$introtest $modnextpre:\n\n$warnnotest $modnextpre.\n$modlin"
82
83 #
84 # Same tests with exit called from proc
85 #
86
87 test_cmd_re "ALL" "load $mod1 $mod4 $mod3" $ans
88
89 # tests that 'exit' does not inhibit next modulefile interpretations on non-load mode
90 testouterr_cmd_re "sh" "display $mod4 $modnext" "ERR" "$modlin\n$mod4pre:\n\nsetenv\t\ttestsuite4 no\n$modlin\n$modnextpre:\n\nmodule-whatis\t{$modnextwhatis}\n$modlin"
91 testouterr_cmd_re "sh" "whatis $mod4 $modnext" "ERR" "$modpathheader\n\\s+$modnext: $modnextwhatis"
92 # exit leads to no rendering of ModulesHelp or ModulesTest procs
93 testouterr_cmd_re "sh" "help $mod4 $modnext" "ERR" "$modlin\n$introhelp $mod4pre:\n\n$modlin\n$introhelp $modnextpre:\n\n$warnnohelp $modnextpre.\n$modlin"
94 testouterr_cmd_re "sh" "test $mod4 $modnext" "ERR" "$modlin\n$introtest $mod4pre:\n\n$modlin\n$introtest $modnextpre:\n\n$warnnotest $modnextpre.\n$modlin"
95
96 #
97 # Cleanup
98 #
99
100 reset_test_env