| 1 |
############################################################################## |
| 2 |
# Modules Revision 3.0 |
| 3 |
# Providing a flexible user environment |
| 4 |
# |
| 5 |
# File: modules.30-cache/%M% |
| 6 |
# Revision: %I% |
| 7 |
# First Edition: 2022/12/03 |
| 8 |
# Last Mod.: %U%, %G% |
| 9 |
# |
| 10 |
# Authors: Xavier Delaruelle, [email protected] |
| 11 |
# |
| 12 |
# Description: Testuite testsequence |
| 13 |
# Command: avail, whatis, load |
| 14 |
# Modulefiles: |
| 15 |
# Sub-Command: |
| 16 |
# |
| 17 |
# Comment: %C{ |
| 18 |
# Test ignore_cache configuration option |
| 19 |
# }C% |
| 20 |
# |
| 21 |
############################################################################## |
| 22 |
|
| 23 |
# ensure avail tests are made using in depth mode |
| 24 |
setenv_var MODULES_AVAIL_INDEPTH 1 |
| 25 |
|
| 26 |
# generate content in modulepaths |
| 27 |
lassign [create_simple_module_setup $mp1] dir_list file_list |
| 28 |
array set file_arr $file_list |
| 29 |
|
| 30 |
setenv_var MODULEPATH $mp1 |
| 31 |
|
| 32 |
# tests with empty cache file |
| 33 |
create_dummy_cachefile $mp1 |
| 34 |
|
| 35 |
set tserr_avail "bar/1.0 |
| 36 |
bar/2.0 |
| 37 |
foo/1.0" |
| 38 |
set tserr_whatis "$modlin [escre $mp1] $modlin |
| 39 |
\\s+foo/1.0: foo/1.0" |
| 40 |
set ans_load [list] |
| 41 |
lappend ans_load [list set _LMFILES_ $mp1/bar/1.0] |
| 42 |
lappend ans_load [list set LOADEDMODULES bar/1.0] |
| 43 |
|
| 44 |
# cache enabled |
| 45 |
testouterr_cmd sh {avail -t -o } OK {} |
| 46 |
# cache disabled |
| 47 |
testouterr_cmd sh {--ignore-cache avail -t -o } OK $tserr_avail |
| 48 |
|
| 49 |
# clean setup prior quitting if quick mode |
| 50 |
if {[is_quick_mode]} { |
| 51 |
file delete $mp1cache |
| 52 |
delete_module_setup $mp1 [array names file_arr] $dir_list |
| 53 |
} |
| 54 |
skip_if_quick_mode |
| 55 |
|
| 56 |
# cache enabled |
| 57 |
testouterr_cmd sh {load bar/1.0} ERR $err_path'bar/1.0' |
| 58 |
testouterr_cmd sh {whatis} OK {} |
| 59 |
|
| 60 |
setenv_var MODULES_IGNORE_CACHE 0 |
| 61 |
testouterr_cmd sh {avail -t -o } OK {} |
| 62 |
testouterr_cmd sh {load bar/1.0} ERR $err_path'bar/1.0' |
| 63 |
testouterr_cmd sh {whatis} OK {} |
| 64 |
|
| 65 |
# cache disabled |
| 66 |
testouterr_cmd sh {avail --ignore-cache -t -o } OK $tserr_avail |
| 67 |
testouterr_cmd_re sh {whatis --ignore-cache} OK $tserr_whatis |
| 68 |
testouterr_cmd sh {load bar/1.0 --ignore-cache} $ans_load {} |
| 69 |
|
| 70 |
setenv_var MODULES_IGNORE_CACHE 1 |
| 71 |
testouterr_cmd sh {avail -t -o } OK $tserr_avail |
| 72 |
testouterr_cmd sh {--ignore-cache avail -t -o } OK $tserr_avail |
| 73 |
testouterr_cmd_re sh {whatis} OK $tserr_whatis |
| 74 |
testouterr_cmd sh {load bar/1.0} $ans_load {} |
| 75 |
|
| 76 |
|
| 77 |
# |
| 78 |
# Cleanup |
| 79 |
# |
| 80 |
|
| 81 |
file delete $mp1cache |
| 82 |
|
| 83 |
# delete created files and dirs |
| 84 |
delete_module_setup $mp1 [array names file_arr] $dir_list |
| 85 |
|
| 86 |
reset_test_env |