Skip to content

Commit a124745

Browse files
committed
ts: adapt 50/400 tests when install manpath is default
Fix source-sh tests in 50/400 test case to adapt expected value set to MANPATH variable when the installed MANPATH value set at configure step is included in the default MANPATH value set for test. Fixes #549
1 parent 5ccaf0f commit a124745

File tree

1 file changed

+30
-16
lines changed

1 file changed

+30
-16
lines changed

testsuite/modules.50-cmds/400-source-sh.exp

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,12 +1612,26 @@ if {$install_setmanpath eq {y}} {
16121612
} else {
16131613
set mandirenc $install_mandir
16141614
}
1615-
if {$install_appendmanpath eq {y}} {
1616-
set updatedmanpath $default_manpath:$install_mandir
1617-
set lmsourceshpath "append-path MANPATH $mandirenc|"
1618-
} else {
1619-
set updatedmanpath $install_mandir:$default_manpath
1620-
set lmsourceshpath "prepend-path MANPATH $mandirenc|"
1615+
set updated_manpath_list [split $default_manpath :]
1616+
set is_default_manpath_updated 0
1617+
foreach install_manpath_elt [split $install_mandir :] {
1618+
if {$install_manpath_elt ni $updated_manpath_list} {
1619+
if {$install_appendmanpath eq {y}} {
1620+
lappend updated_manpath_list $install_manpath_elt
1621+
} else {
1622+
set updated_manpath_list [linsert $updated_manpath_list 0 $install_manpath_elt]
1623+
}
1624+
set is_default_manpath_updated 1
1625+
}
1626+
}
1627+
set updatedmanpath [join $updated_manpath_list :]
1628+
1629+
if {$is_default_manpath_updated} {
1630+
if {$install_appendmanpath eq {y}} {
1631+
set lmsourceshpath "append-path MANPATH $mandirenc|"
1632+
} else {
1633+
set lmsourceshpath "prepend-path MANPATH $mandirenc|"
1634+
}
16211635
}
16221636
}
16231637
# setup PATH without Modules bin location
@@ -1647,13 +1661,13 @@ if {$install_versioning eq {y}} {
16471661
lappend ans [list set MODULE_VERSION_STACK $install_version]
16481662
}
16491663
# MANPATH is set before PATH if the latter is appended and not the former
1650-
if {$install_setmanpath eq {y} && $install_appendbinpath eq {y} && $install_appendmanpath eq {n}} {
1664+
if {$install_setmanpath eq {y} && $install_appendbinpath eq {y} && $install_appendmanpath eq {n} && $is_default_manpath_updated} {
16511665
lappend ans [list set MANPATH $updatedmanpath]
16521666
}
16531667
if {$install_setbinpath eq {y}} {
16541668
lappend ans [list set PATH $updatedpath]
16551669
}
1656-
if {$install_setmanpath eq {y} && ($install_appendbinpath eq {n} || $install_appendmanpath eq {y})} {
1670+
if {$install_setmanpath eq {y} && ($install_appendbinpath eq {n} || $install_appendmanpath eq {y}) && $is_default_manpath_updated} {
16571671
lappend ans [list set MANPATH $updatedmanpath]
16581672
}
16591673
lappend ans [list set _LMFILES_ $mp/source-sh/1]
@@ -1703,7 +1717,7 @@ set extratserr {}
17031717
set tserr "-------------------------------------------------------------------
17041718
$mp/source-sh/1:\n\n"
17051719
set tserr_path {}
1706-
if {$install_setmanpath eq {y}} {
1720+
if {$install_setmanpath eq {y} && $is_default_manpath_updated} {
17071721
if {$install_appendmanpath eq {y}} {
17081722
append tserr_path "append-path\tMANPATH $mandirenc\n"
17091723
} else {
@@ -1754,13 +1768,13 @@ if {$install_versioning eq {y}} {
17541768
lappend ans [list set MODULE_VERSION_STACK $install_version]
17551769
}
17561770
# MANPATH is set before PATH if the latter is appended and not the former
1757-
if {$install_setmanpath eq {y} && $install_appendbinpath eq {y} && $install_appendmanpath eq {n}} {
1771+
if {$install_setmanpath eq {y} && $install_appendbinpath eq {y} && $install_appendmanpath eq {n} && $is_default_manpath_updated} {
17581772
lappend ans [list set MANPATH $updatedmanpath]
17591773
}
17601774
if {$install_setbinpath eq {y}} {
17611775
lappend ans [list set PATH $updatedpath]
17621776
}
1763-
if {$install_setmanpath eq {y} && ($install_appendbinpath eq {n} || $install_appendmanpath eq {y})} {
1777+
if {$install_setmanpath eq {y} && ($install_appendbinpath eq {n} || $install_appendmanpath eq {y}) && $is_default_manpath_updated} {
17641778
lappend ans [list set MANPATH $updatedmanpath]
17651779
}
17661780
lappend ans [list set _LMFILES_ $mp/source-sh/1]
@@ -1792,13 +1806,13 @@ if {$install_versioning eq {y}} {
17921806
lappend ans [list set MODULE_VERSION_STACK $install_version]
17931807
}
17941808
# MANPATH is set before PATH if the latter is appended and not the former
1795-
if {$install_setmanpath eq {y} && $install_appendbinpath eq {y} && $install_appendmanpath eq {n}} {
1809+
if {$install_setmanpath eq {y} && $install_appendbinpath eq {y} && $install_appendmanpath eq {n} && $is_default_manpath_updated} {
17961810
lappend ans [list set MANPATH $updatedmanpath]
17971811
}
17981812
if {$install_setbinpath eq {y}} {
17991813
lappend ans [list set PATH $updatedpath]
18001814
}
1801-
if {$install_setmanpath eq {y} && ($install_appendbinpath eq {n} || $install_appendmanpath eq {y})} {
1815+
if {$install_setmanpath eq {y} && ($install_appendbinpath eq {n} || $install_appendmanpath eq {y}) && $is_default_manpath_updated} {
18021816
lappend ans [list set MANPATH $updatedmanpath]
18031817
}
18041818
lappend ans [list set _LMFILES_ $modpath/setenv/1.0:$mp/source-sh/1]
@@ -1829,19 +1843,19 @@ setenv_var MODULES_COLLECTION_TARGET bar
18291843
if {$install_setbinpath eq {y}} {
18301844
setenv_var PATH $updatedpath
18311845
}
1832-
if {$install_setmanpath eq {y}} {
1846+
if {$install_setmanpath eq {y} && $is_default_manpath_updated} {
18331847
setenv_var MANPATH $updatedmanpath
18341848
}
18351849
setenv_var __MODULES_LMSOURCESH source-sh/1\&bash\ testsuite/example/sh-to-mod.sh\|${lmsourceshpath}setenv\ MODULES_COLLECTION_TARGET\ bar\|setenv\ testsuite\ yes
18361850
set ans [list]
18371851
# MANPATH is set before PATH if the latter is appended and not the former
1838-
if {$install_setmanpath eq {y} && $install_appendbinpath eq {y} && $install_appendmanpath eq {n}} {
1852+
if {$install_setmanpath eq {y} && $install_appendbinpath eq {y} && $install_appendmanpath eq {n} && $is_default_manpath_updated} {
18391853
lappend ans [list set MANPATH $default_manpath]
18401854
}
18411855
if {$install_setbinpath eq {y}} {
18421856
lappend ans [list set PATH $default_path]
18431857
}
1844-
if {$install_setmanpath eq {y} && ($install_appendbinpath eq {n} || $install_appendmanpath eq {y})} {
1858+
if {$install_setmanpath eq {y} && ($install_appendbinpath eq {n} || $install_appendmanpath eq {y}) && $is_default_manpath_updated} {
18451859
lappend ans [list set MANPATH $default_manpath]
18461860
}
18471861
lappend ans [list unset _LMFILES_]

0 commit comments

Comments
 (0)