From 9698fa32db2c6c5415abe57cb26cee86cd08555e Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Fri, 14 Aug 2020 14:20:02 +0200 Subject: [PATCH] ts: test dot mod targetted by module-forbid in 20/{118,119} --- testsuite/etc/modulerc.hide | 4 ++++ .../modules.20-locate/118-forbid-all-opt.exp | 8 ++++++++ .../modules.20-locate/119-hide-cascading.exp | 15 +++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/testsuite/etc/modulerc.hide b/testsuite/etc/modulerc.hide index 8807c93a..89096563 100644 --- a/testsuite/etc/modulerc.hide +++ b/testsuite/etc/modulerc.hide @@ -138,6 +138,10 @@ if {[info exists env(TESTSUITE_HIDE1_CASC4_SET10)]} { module-forbid hide1/5.0 } +if {[info exists env(TESTSUITE_HIDE4_CASC2_SET1)]} { + module-forbid hide4 +} + # 20/115 module-forbid tests if {[info exists env(TESTSUITE_FORBID2_SET8)]} { module-forbid hide2@1.3 hide2@1.4 diff --git a/testsuite/modules.20-locate/118-forbid-all-opt.exp b/testsuite/modules.20-locate/118-forbid-all-opt.exp index ae007e4b..a4f2528e 100644 --- a/testsuite/modules.20-locate/118-forbid-all-opt.exp +++ b/testsuite/modules.20-locate/118-forbid-all-opt.exp @@ -83,6 +83,14 @@ nanfoo/nan -> nanfoo/1 testouterr_cmd sh {ml avail -a -t hide1@2:4} OK $mp:\nhide1/2.0\nhide1/2.1\nhide1/2.2\nhide1/3.0\nhide1/3.2\nhide1/4.0 testouterr_cmd_re sh {ml whatis -a hide3} ERR $err_path'hide3' +# test with dot named module declared forbidden +setenv_var TESTSUITE_HIDE4_CASC2_SET1 1 +testouterr_cmd sh {avail -a -t -C /.} OK "$mp: +extdfl/.1.3.3 +extdfl/.1.3.4 +nocase/.hidden" +unsetenv_var TESTSUITE_HIDE4_CASC2_SET1 + # cannot test access if cannot change file permission if {!$is_file_perms_editable} { send_user "\tskipping access tests as file permissions cannot be changed\n" diff --git a/testsuite/modules.20-locate/119-hide-cascading.exp b/testsuite/modules.20-locate/119-hide-cascading.exp index c981becf..2474fdeb 100644 --- a/testsuite/modules.20-locate/119-hide-cascading.exp +++ b/testsuite/modules.20-locate/119-hide-cascading.exp @@ -241,6 +241,21 @@ testouterr_cmd sh {avail -t hide1@5.0} OK {} unsetenv_var TESTSUITE_HIDE1_CASC4_SET10 +# dot named module targetted by module-forbid statement +# module-forbid wins over dot hiding +setenv_var TESTSUITE_HIDE4_CASC2_SET1 1 +testouterr_cmd sh {avail hide4} OK {} +testouterr_cmd sh {avail -t hide4/.1.0} OK {} +testouterr_cmd sh {load hide4} ERR $err_path'hide4' +set ans [list] +lappend ans [list setpath LOADEDMODULES hide4/.1.0] +lappend ans [list setpath _LMFILES_ $mp/hide4/.1.0] +testouterr_cmd sh {load hide4/.1.0} ERR [err_accessdenied hide4/.1.0] +testouterr_cmd sh {whatis hide4} ERR $err_path'hide4' +testouterr_cmd_re sh {whatis hide4/.1.0} ERR [err_accessdenied hide4/.1.0] +unsetenv_var TESTSUITE_HIDE4_CASC2_SET1 + + # # Cleanup #