| 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: 95/12/06 |
| 8 |
# Last Mod.: %U%, %G% |
| 9 |
# |
| 10 |
# Authors: Jens Hamisch, [email protected] |
| 11 |
# |
| 12 |
# Description: Testuite testsequence |
| 13 |
# Command: load |
| 14 |
# Modulefiles: whatis/lines, whatis/multiple, whatis/none |
| 15 |
# Modulefiles: whatis/single, whatis/string, bad |
| 16 |
# Sub-Command: |
| 17 |
# |
| 18 |
# Comment: %C{ |
| 19 |
# Tests the 'module whatis' command for success |
| 20 |
# Tests the 'module whatis' command for failure |
| 21 |
# }C% |
| 22 |
# |
| 23 |
############################################################################## |
| 24 |
|
| 25 |
# |
| 26 |
# Variables. This test forces a module load command. It will result in the |
| 27 |
# environment variables "_LMFILES_", "LOADEDMODULES" and "testsuite" to |
| 28 |
# be set up |
| 29 |
# |
| 30 |
|
| 31 |
set header "$modlin $modpathre $modlin" |
| 32 |
|
| 33 |
set module_1 "whatis/none" |
| 34 |
set module_2 "whatis/single" |
| 35 |
set module_3 "whatis/multiple" |
| 36 |
set module_4 "whatis/string" |
| 37 |
set module_5 "whatis/lines" |
| 38 |
set module_6 "NonExistent" |
| 39 |
set module_7 "bad" |
| 40 |
|
| 41 |
set whatis_2 " whatis/single" |
| 42 |
set whatis_3 " whatis/multiple" |
| 43 |
set whatis_4 " whatis/string" |
| 44 |
set whatis_5 " whatis/lines" |
| 45 |
set whatis_7 " bad/after" |
| 46 |
|
| 47 |
# |
| 48 |
# Test only for the csh |
| 49 |
# |
| 50 |
|
| 51 |
set ts_csh_1 "" |
| 52 |
set ts_csh_2 "$header\n$whatis_2: Testsuite-Modulefile" |
| 53 |
# different behavior than C-version: on Tcl-version multiple arguments provided on a single |
| 54 |
# module-whatis call produce a single module-whatis line, not one line per passed argument |
| 55 |
set ts_csh_3 "$header\n$whatis_3: Testsuite Whatis Modulefile" |
| 56 |
set ts_csh_4 "$header\n$whatis_4: Testsuite Whatis Modulefile" |
| 57 |
set ts_csh_5 "$header\n$whatis_5: Testsuite Whatis Modulefile\n$whatis_5: Second line of whatis tokens" |
| 58 |
set ts_csh_6 "$err_path'$module_6'" |
| 59 |
set ts_csh_7 "$header\n$whatis_7: erroneous module test" |
| 60 |
|
| 61 |
# |
| 62 |
# The tests |
| 63 |
# |
| 64 |
|
| 65 |
testouterr_cmd_re "csh" "--terse whatis $module_1" "OK" "$ts_csh_1" |
| 66 |
testouterr_cmd_re "csh" "--terse whatis $module_2" "OK" "$ts_csh_2" |
| 67 |
testouterr_cmd_re "csh" "--terse whatis $module_3" "OK" "$ts_csh_3" |
| 68 |
|
| 69 |
skip_if_quick_mode |
| 70 |
|
| 71 |
testouterr_cmd_re "csh" "--terse whatis $module_4" "OK" "$ts_csh_4" |
| 72 |
testouterr_cmd_re "csh" "--terse whatis $module_5" "OK" "$ts_csh_5" |
| 73 |
|
| 74 |
# command nickname tests |
| 75 |
testouterr_cmd_re "csh" "--terse wh $module_5" "OK" "$ts_csh_5" |
| 76 |
|
| 77 |
# setup MODULEPATH with a trailing slash and an empty dir element |
| 78 |
setenv_path_var MODULEPATH {} "$modpath/" |
| 79 |
testouterr_cmd_re "csh" "--terse whatis $module_1" "OK" "$ts_csh_1" |
| 80 |
|
| 81 |
# restore MODULEPATH |
| 82 |
setenv_path_var MODULEPATH $modpath |
| 83 |
|
| 84 |
|
| 85 |
# |
| 86 |
# the fail case, return value false |
| 87 |
# |
| 88 |
testouterr_cmd "csh" "whatis $module_6" "ERR" "$ts_csh_6" |
| 89 |
|
| 90 |
# first pattern does not match |
| 91 |
testouterr_cmd_re sh "whatis $module_6 $module_2" OK $ts_csh_2 |
| 92 |
|
| 93 |
# second pattern does not match |
| 94 |
testouterr_cmd_re sh "whatis $module_2 $module_6" OK $ts_csh_2 |
| 95 |
|
| 96 |
# no pattern match |
| 97 |
testouterr_cmd_re sh "whatis $module_6 unk" ERR $err_path'unk'\n$ts_csh_6 |
| 98 |
|
| 99 |
# one module unknown and one found but without whatis information |
| 100 |
testouterr_cmd_re sh "whatis $module_6 $module_1" OK {} |
| 101 |
|
| 102 |
# |
| 103 |
# test with erroneous modulefile |
| 104 |
# should not produce error message |
| 105 |
# |
| 106 |
testouterr_cmd_re "csh" "whatis $module_7" "OK" "$ts_csh_7" |
| 107 |
|
| 108 |
|
| 109 |
# |
| 110 |
# test when loaded environment is inconsistent |
| 111 |
# |
| 112 |
|
| 113 |
setenv_loaded_module [list foo bar] "/path/to/foo" |
| 114 |
|
| 115 |
# should not affect result |
| 116 |
testouterr_cmd_re "csh" "--terse whatis $module_5" "OK" "$ts_csh_5" |
| 117 |
|
| 118 |
|
| 119 |
# |
| 120 |
# Cleanup |
| 121 |
# |
| 122 |
|
| 123 |
reset_test_env |