| 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/06 |
| 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 cache_buffer_bytes configuration option |
| 19 |
# }C% |
| 20 |
# |
| 21 |
############################################################################## |
| 22 |
|
| 23 |
skip_if_quick_mode |
| 24 |
|
| 25 |
# unset buffer size variable that may be set if module cache are prebuilt |
| 26 |
unsetenv_var MODULES_CACHE_BUFFER_BYTES |
| 27 |
|
| 28 |
# ensure avail tests are made using in depth mode |
| 29 |
setenv_var MODULES_AVAIL_INDEPTH 1 |
| 30 |
|
| 31 |
# generate content in modulepaths |
| 32 |
lassign [create_simple_module_setup $mp1] dir_list file_list |
| 33 |
array set file_arr $file_list |
| 34 |
|
| 35 |
setenv_var MODULEPATH $mp1 |
| 36 |
|
| 37 |
# create cache file |
| 38 |
set tserr [msg_create $mp1cache] |
| 39 |
testouterr_cmd sh cachebuild OK $tserr |
| 40 |
|
| 41 |
set tserr_avail "$mp1: |
| 42 |
bar/1.0 |
| 43 |
bar/2.0 |
| 44 |
foo/1.0" |
| 45 |
set ans_load [list] |
| 46 |
lappend ans_load [list set _LMFILES_ $mp1/bar/1.0] |
| 47 |
lappend ans_load [list set LOADEDMODULES bar/1.0] |
| 48 |
set tserr_load_debug1 ".* |
| 49 |
DEBUG \\\[cache:[escre $mp1cache]\\\] setConf: cache_buffer_bytes set to '1000000' |
| 50 |
.*" |
| 51 |
set tserr_load_debug2 ".* |
| 52 |
DEBUG \\\[cache:[escre $mp1cache]\\\] setConf: cache_buffer_bytes set to '32768' |
| 53 |
.*" |
| 54 |
|
| 55 |
|
| 56 |
# test small buffer size |
| 57 |
setenv_var MODULES_CACHE_BUFFER_BYTES 4096 |
| 58 |
testouterr_cmd sh {avail -t} OK $tserr_avail |
| 59 |
testouterr_cmd sh {load bar/1.0} $ans_load {} |
| 60 |
setenv_var MODULES_CACHE_BUFFER_BYTES 8192 |
| 61 |
testouterr_cmd sh {avail -t} OK $tserr_avail |
| 62 |
testouterr_cmd sh {load bar/1.0} $ans_load {} |
| 63 |
|
| 64 |
# test large buffer size |
| 65 |
setenv_var MODULES_CACHE_BUFFER_BYTES 262144 |
| 66 |
testouterr_cmd sh {avail -t} OK $tserr_avail |
| 67 |
testouterr_cmd sh {load bar/1.0} $ans_load {} |
| 68 |
setenv_var MODULES_CACHE_BUFFER_BYTES 1000000 |
| 69 |
testouterr_cmd sh {avail -t} OK $tserr_avail |
| 70 |
testouterr_cmd_re sh {load -D bar/1.0} $ans_load $tserr_load_debug1 |
| 71 |
|
| 72 |
# test erroneous buffer size |
| 73 |
setenv_var MODULES_CACHE_BUFFER_BYTES -1000 |
| 74 |
testouterr_cmd sh {avail -t} OK $tserr_avail |
| 75 |
testouterr_cmd_re sh {load -D bar/1.0} $ans_load $tserr_load_debug2 |
| 76 |
setenv_var MODULES_CACHE_BUFFER_BYTES 1024 |
| 77 |
testouterr_cmd sh {avail -t} OK $tserr_avail |
| 78 |
testouterr_cmd_re sh {load -D bar/1.0} $ans_load $tserr_load_debug2 |
| 79 |
setenv_var MODULES_CACHE_BUFFER_BYTES 10000000 |
| 80 |
testouterr_cmd sh {avail -t} OK $tserr_avail |
| 81 |
testouterr_cmd_re sh {load -D bar/1.0} $ans_load $tserr_load_debug2 |
| 82 |
setenv_var MODULES_CACHE_BUFFER_BYTES foo |
| 83 |
testouterr_cmd sh {avail -t} OK $tserr_avail |
| 84 |
testouterr_cmd_re sh {load -D bar/1.0} $ans_load $tserr_load_debug2 |
| 85 |
setenv_var MODULES_CACHE_BUFFER_BYTES {} |
| 86 |
testouterr_cmd sh {avail -t} OK $tserr_avail |
| 87 |
testouterr_cmd_re sh {load -D bar/1.0} $ans_load $tserr_load_debug2 |
| 88 |
|
| 89 |
|
| 90 |
# |
| 91 |
# Cleanup |
| 92 |
# |
| 93 |
|
| 94 |
file delete $mp1cache |
| 95 |
|
| 96 |
# delete created files and dirs |
| 97 |
delete_module_setup $mp1 [array names file_arr] $dir_list |
| 98 |
|
| 99 |
reset_test_env |