Skip to content

Commit b1b4096

Browse files
committed
ts: test restore subcmd with stash collections
1 parent c3d06a6 commit b1b4096

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
##############################################################################
2+
# Modules Revision 3.0
3+
# Providing a flexible user environment
4+
#
5+
# File: modules.70-maint/%M%
6+
# Revision: %I%
7+
# First Edition: 2022/10/06
8+
# Last Mod.: %U%, %G%
9+
#
10+
# Authors: Xavier Delaruelle, [email protected]
11+
#
12+
# Description: Testuite testsequence
13+
# Command: restore
14+
# Modulefiles: foo, bar
15+
# Sub-Command:
16+
#
17+
# Comment: %C{
18+
# Test restore sub-command with stash collections
19+
# }C%
20+
#
21+
##############################################################################
22+
23+
skip_if_quick_mode
24+
25+
set mp $modpath.3
26+
setenv_path_var MODULEPATH $mp
27+
28+
set collhome $env(HOME)/.module
29+
set stash_basic_content "module use --append $mp
30+
module load foo/1.0
31+
module load bar/1.0\n"
32+
33+
34+
# basic restore of stash collection
35+
create_stash_coll $stash_basic_content
36+
set last_stash_file [get_last_stash_coll]
37+
set last_stash [file tail $last_stash_file]
38+
39+
set ans [list]
40+
lappend ans [list set _LMFILES_ $mp/foo/1.0:$mp/bar/1.0]
41+
lappend ans [list set LOADEDMODULES foo/1.0:bar/1.0]
42+
set tserr [msg_load {foo/1.0}]\n[msg_load {bar/1.0}]
43+
testouterr_cmd sh "restore $last_stash" $ans $tserr
44+
testouterr_cmd sh "restore $last_stash_file" $ans $tserr
45+
46+
delete_last_stash_coll
47+
48+
49+
# stash collection from current target
50+
setenv_var MODULES_COLLECTION_TARGET foo
51+
create_stash_coll $stash_basic_content
52+
set last_stash_file [get_last_stash_coll]
53+
set last_stash_with_target [file tail $last_stash_file]
54+
set last_stash [file rootname $last_stash_with_target]
55+
56+
testouterr_cmd sh "restore $last_stash" $ans $tserr
57+
testouterr_cmd sh "restore $last_stash_file" $ans $tserr
58+
testouterr_cmd sh "restore $last_stash_with_target" ERR [err_coll_notfound $last_stash_with_target foo]
59+
60+
# stash collection from foreign target
61+
setenv_var MODULES_COLLECTION_TARGET bar
62+
63+
testouterr_cmd sh "restore $last_stash" ERR [err_coll_notfound $last_stash bar]
64+
testouterr_cmd sh "restore $last_stash_file" $ans $tserr
65+
testouterr_cmd sh "restore $last_stash_with_target" ERR [err_coll_notfound $last_stash_with_target bar]
66+
67+
# stash collection from foreign no target
68+
unsetenv_var MODULES_COLLECTION_TARGET
69+
70+
testouterr_cmd sh "restore $last_stash" ERR [err_coll_notfound $last_stash]
71+
testouterr_cmd sh "restore $last_stash_file" $ans $tserr
72+
testouterr_cmd sh "restore $last_stash_with_target" $ans $tserr
73+
74+
delete_last_stash_coll
75+
76+
77+
#
78+
# Cleanup
79+
#
80+
81+
file delete $collhome
82+
83+
reset_test_env

0 commit comments

Comments
 (0)