Debian Codegraph @

testsuite/modules.61-coll/050-saverm.exp

raw
1 ##############################################################################
2 # Modules Release Tcl
3 # Providing a flexible user environment
4 #
5 # File: modules.61-coll/%M%
6 # Revision: %I%
7 # First Edition: 2016/08/09
8 # Last Mod.: %U%, %G%
9 #
10 # Authors: Xavier Delaruelle, [email protected]
11 #
12 # Description: Testuite testsequence
13 # Command:
14 # Modulefiles:
15 # Sub-Command:
16 #
17 # Comment: %C{
18 # Test the module 'saverm' command
19 # }C%
20 #
21 ##############################################################################
22
23
24 set cbadnerrmsg [err_coll_notfound $collbadn]
25 set cbadterrmsg [err_coll_notfound $colld $colltarget]
26 set c1fperrmsg "$error_msgs: Command does not remove collection specified as filepath"
27 set rmcderrmsg [couldnotopen_nofile $hometestdotmod/default]
28 set rmc1errmsg [couldnotopen_nofile $hometestdotmod/$coll1]
29 set rmc4ferrmsg [couldnotopen_nofile $hometestdotmod/$coll4f]
30 set rmc48errmsg [couldnotopen_nofile $hometestdotmod/$coll48]
31
32 #
33 # test removing nonexistent collection
34 #
35
36 # set home to directory where collections have been
37 # recorded during the 030-save tests. try the saverm
38 # command on these tests collections.
39 if {$verbose} {
40 send_user "\tSetup HOME = $hometestcoll\n"
41 }
42 set env(HOME) "$hometestcoll"
43
44 testouterr_cmd "ALL" "saverm $collbadn" "ERR" "$cbadnerrmsg"
45
46
47 #
48 # test removing default collection
49 #
50
51 # test only sh shell as this test does not produce shell output
52 testoutfile_cmd "sh" "saverm" "OK" "$hometestdotmod/default" "$rmcderrmsg"
53
54 skip_if_quick_mode
55
56 #
57 # test removing named collection
58 #
59
60 # test only sh shell as this test does not produce shell output
61 testoutfile_cmd "sh" "saverm $coll1" "OK" "$hometestdotmod/$coll1" "$rmc1errmsg"
62
63
64 #
65 # test removing collection specified as filepath
66 # should raise an error, saverm is not made to delete filepath
67 #
68
69 testouterr_cmd "ALL" "disable $coll1fp" "ERR" "$c1fperrmsg"
70
71
72 #
73 # test removing collection requiring an upcoming version of Modules
74 # test effect of mcookie configuration with this collection
75 #
76
77 file copy $coll48fp $hometestdotmod/$coll48
78 testoutfile_cmd sh "saverm $coll48" OK $hometestdotmod/$coll48 $rmc48errmsg
79
80 file copy $coll48fp $hometestdotmod/$coll48
81 setenv_var MODULES_MCOOKIE_CHECK eval
82 testoutfile_cmd sh "saverm $coll48" OK $hometestdotmod/$coll48 $rmc48errmsg
83 setenv_var MODULES_MCOOKIE_CHECK always
84
85 file copy $coll48fp $hometestdotmod/$coll48
86 setenv_var MODULES_MCOOKIE_VERSION_CHECK 0
87 testoutfile_cmd sh "saverm $coll48" OK $hometestdotmod/$coll48 $rmc48errmsg
88 setenv_var MODULES_MCOOKIE_VERSION_CHECK 1
89
90
91 #
92 # test removing named collection when MODULES_COLLECTION_TARGET is set
93 #
94
95 # setup environment state
96 if {$verbose} {
97 send_user "\tSetup MODULES_COLLECTION_TARGET = $colltarget\n"
98 }
99 set env(MODULES_COLLECTION_TARGET) "$colltarget"
100
101 # test only sh shell as this test does not produce shell output
102 testoutfile_cmd "sh" "disa $coll4" "OK" "$hometestdotmod/$coll4f" "$rmc4ferrmsg"
103
104
105 #
106 # test removing nonexistent default collection when
107 # MODULES_COLLECTION_TARGET is set
108 #
109
110 testouterr_cmd "ALL" "saverm" "ERR" "$cbadterrmsg"
111
112
113 #
114 # test unsetting HOME
115 #
116
117 if {$verbose} {
118 send_user "\tUnset HOME \n"
119 }
120 unset env(HOME)
121
122 testouterr_cmd "sh" "saverm" "ERR" $nohomeerrmsg
123
124
125 #
126 # Cleanup
127 #
128
129 reset_test_env