| 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: 2017/08/12 |
| 8 |
# Last Mod.: %U%, %G% |
| 9 |
# |
| 10 |
# Authors: Xavier Delaruelle, [email protected] |
| 11 |
# |
| 12 |
# Description: Testuite testsequence |
| 13 |
# Command: load, display, whatis, paths |
| 14 |
# Modulefiles: symlink, symlink2, brokenlink |
| 15 |
# Sub-Command: |
| 16 |
# |
| 17 |
# Comment: %C{ |
| 18 |
# Localization of filesystem symbolic link modulefiles |
| 19 |
# }C% |
| 20 |
# |
| 21 |
############################################################################## |
| 22 |
|
| 23 |
skip_if_quick_mode |
| 24 |
|
| 25 |
# cannot test symlinks if not supported on filesystem |
| 26 |
if {!$is_symlink_supported} { |
| 27 |
send_user "\tskipping symbolic link tests as they are not supported on filesystem\n" |
| 28 |
} else { |
| 29 |
|
| 30 |
set module_1 "symlink/0.9" |
| 31 |
set modulefile_1 "$modpath/$module_1" |
| 32 |
set modulefilere_1 "$modpathre/$module_1" |
| 33 |
|
| 34 |
set module_2 "symlink/1.2" |
| 35 |
set modulefile_2 "$modpath/$module_2" |
| 36 |
set modulefilere_2 "$modpathre/$module_2" |
| 37 |
|
| 38 |
set module_3 "symlink2/2.0" |
| 39 |
set modulefile_3 "$modpath/$module_3" |
| 40 |
set modulefilere_3 "$modpathre/$module_3" |
| 41 |
|
| 42 |
set module_4 "symlink3" |
| 43 |
set modulefile_4 "$modpath/$module_4" |
| 44 |
set modulefilere_4 "$modpathre/$module_4" |
| 45 |
|
| 46 |
set disp_sh "setenv\t\ttestsuite yes" |
| 47 |
set whatis_sh "module-whatis\t" |
| 48 |
set header "$modlin $modpathre $modlin" |
| 49 |
|
| 50 |
|
| 51 |
# |
| 52 |
# Test on filesystem symbolic link with valid target |
| 53 |
# |
| 54 |
|
| 55 |
set disp_2 "$modlin\n$modulefilere_2:\n\n${whatis_sh}loc_rc6/1.2\n$disp_sh\n$modlin" |
| 56 |
set what_1_2 "$header\n $module_1: loc_rc6/0.9\n $module_2: loc_rc6/1.2" |
| 57 |
|
| 58 |
# symbolic link name used (not targeted name) once loaded, displayed, etc |
| 59 |
set ans [list] |
| 60 |
if {[is_conf_enabled advversspec implicitdefault]} { |
| 61 |
lappend ans [list set __MODULES_LMALTNAME $module_2&symlink/default&symlink&symlink/new&al|symlink/1&al|symlink/bar&as|symlink/latest] |
| 62 |
} else { |
| 63 |
lappend ans [list set __MODULES_LMALTNAME $module_2&symlink/default&symlink&symlink/new&al|symlink/1&al|symlink/bar] |
| 64 |
} |
| 65 |
lappend ans [list set _LMFILES_ "$modulefile_2"] |
| 66 |
lappend ans [list set LOADEDMODULES "$module_2"] |
| 67 |
lappend ans [list set testsuite yes] |
| 68 |
test_cmd "sh" "load symlink" $ans |
| 69 |
testouterr_cmd_re "sh" "display symlink" "OK" "$disp_2" |
| 70 |
testouterr_cmd_re "sh" "whatis symlink" "OK" "$what_1_2" |
| 71 |
set ans [list] |
| 72 |
lappend ans [list text [list $modulefile_1 $modulefile_2]] |
| 73 |
test_cmd "sh" "paths symlink" $ans |
| 74 |
|
| 75 |
|
| 76 |
# |
| 77 |
# Test on filesystem symbolic link with valid target but issue on target module |
| 78 |
# |
| 79 |
|
| 80 |
set err_mag_3 "$err_magic'$modpath/symlink2/.modulerc'\n$err_contact" |
| 81 |
set err_magre_3 "$err_magic'$modpathre/symlink2/.modulerc'\n$err_contact" |
| 82 |
set disp_3 "$modlin\n$modulefilere_3:\n\n${whatis_sh}loc_rc5/2.0\n$disp_sh\n$modlin" |
| 83 |
set what_3 "$header\n $module_3: loc_rc5/2.0" |
| 84 |
|
| 85 |
set ans [list] |
| 86 |
if {[is_conf_enabled advversspec implicitdefault]} { |
| 87 |
lappend ans [list set __MODULES_LMALTNAME $module_3&as|symlink2/default&as|symlink2/latest] |
| 88 |
} |
| 89 |
lappend ans [list set _LMFILES_ "$modulefile_3"] |
| 90 |
lappend ans [list set LOADEDMODULES "$module_3"] |
| 91 |
lappend ans [list set testsuite yes] |
| 92 |
lappend ans [list ERR] |
| 93 |
testouterr_cmd "sh" "load symlink2" [if_implicitdefault $ans ERR] $err_mag_3[if_implicitdefault {} "\n$err_nodefault'symlink2'"] |
| 94 |
testouterr_cmd_re "sh" "display symlink2/2.0" "ERR" "$err_magre_3\n$disp_3" |
| 95 |
testouterr_cmd_re "sh" "whatis symlink2/2.0" "OK" "$what_3" |
| 96 |
|
| 97 |
set ans [list] |
| 98 |
lappend ans [list text $modulefile_3] |
| 99 |
testouterr_cmd "sh" "paths symlink2/2.0" $ans $err_mag_3 |
| 100 |
|
| 101 |
|
| 102 |
# |
| 103 |
# Test on filesystem symbolic link with nonexistent target |
| 104 |
# |
| 105 |
|
| 106 |
set err_found_4 "$err_file'$modulefile_4'" |
| 107 |
|
| 108 |
testouterr_cmd "sh" "load $module_4" "ERR" $err_found_4 |
| 109 |
testouterr_cmd "sh" "display $module_4" "ERR" $err_found_4 |
| 110 |
testouterr_cmd "sh" "whatis $module_4" "ERR" $err_found_4 |
| 111 |
|
| 112 |
set ans [list] |
| 113 |
lappend ans [list text ""] |
| 114 |
testouterr_cmd_re "sh" "paths $module_4" $ans "" |
| 115 |
|
| 116 |
|
| 117 |
# |
| 118 |
# Cleanup |
| 119 |
# |
| 120 |
|
| 121 |
reset_test_env |
| 122 |
|
| 123 |
} |