Debian Codegraph @

testsuite/modules.20-locate/171-multidefault.exp

raw
1 ##############################################################################
2 # Modules Revision 3.0
3 # Providing a flexible user environment
4 #
5 # File: modules.20-locate/%M%
6 # Revision: %I%
7 # First Edition: 2026/08/14
8 # Last Mod.: %U%, %G%
9 #
10 # Authors: Xavier Delaruelle, [email protected]
11 #
12 # Description: Testuite testsequence
13 # Command: load, display
14 # Modulefiles: loc_edm1
15 # Sub-Command:
16 #
17 # Comment: %C{
18 # Check that a partial version query resolved through the
19 # extended_default mechanism, which ends up matching several
20 # available versions, correctly prefers the version
21 # explicitly set as 'default' over the highest matching one,
22 # whether the implicit_default option is enabled or disabled
23 # }C%
24 #
25 ##############################################################################
26
27 # skip tests if extended_default or implicit_default option could not be
28 # overridden
29 if {[is_config_locked extended_default] || [is_config_locked\
30 implicit_default]} {
31 send_user "\tskipping tests as extended_default or implicit_default\
32 could not be overridden\n"
33 } else {
34
35 # use a dedicated modulepath so this new fixture does not affect other tests
36 # that enumerate the whole content of the default modulepath
37 setenv_path_var MODULEPATH $modpath.4
38
39 setenv_var MODULES_EXTENDED_DEFAULT 1
40
41 set module "loc_edm1"
42 set module_default "$module/1.0.1"
43 set modulefile_default "$modpath.4/$module_default"
44 set modulefilere_default "$modpathre.4/$module_default"
45
46 #
47 # loc_edm1 holds two sibling versions, 1.0.1 and 1.0.2, with 1.0.1 explicitly
48 # set as 'default' through a '.version' file. A partial version query like
49 # '1.0' matches both versions through extended_default: the resolution must
50 # pick the explicitly defined default (1.0.1) rather than 1.0.2, which would
51 # be selected if only the highest matching version was considered. This must
52 # hold whether implicit_default is enabled or disabled
53 #
54
55 foreach implicitdefault {1 0} {
56
57 setenv_var MODULES_IMPLICIT_DEFAULT $implicitdefault
58
59 set ans [list]
60 lappend ans [list set __MODULES_LMALTNAME\
61 $module_default&$module/default&$module]
62 lappend ans [list set _LMFILES_ $modulefile_default]
63 lappend ans [list set LOADEDMODULES $module_default]
64
65 test_cmd "sh" "load $module/1.0" $ans
66
67 testouterr_cmd_re "sh" "display $module/1.0" "OK"\
68 "$modlin\n$modulefilere_default:\n\nmodule-whatis\\s+$module_default\n$modlin"
69
70 }
71
72 #
73 # Cleanup
74 #
75
76 reset_test_env
77
78 }