Skip to content

Commit

Permalink
Better testing for downstream conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert McLay committed Mar 28, 2024
1 parent c92dc6f commit 86e7256
Show file tree
Hide file tree
Showing 11 changed files with 144 additions and 22 deletions.
File renamed without changes.
14 changes: 11 additions & 3 deletions rt/conflict/conflict.tdesc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ testdescript = {
runLmod purge #14
unsetMT
export MODULEPATH=$(testDir)/mf2/Core
export LMOD_CONFIG_DIR=$(testDir)/configDir
export LMOD_CONFIG_DIR=$(testDir)/ConfigDir
runLmod load base acme #15
runLmod save #16
runLmod restore #17
Expand All @@ -57,8 +57,16 @@ testdescript = {
runLmod purge #24
runLmod load acme #25
runLmod load D/1.1 #26
runLmod load D/1.3 #27
runLmod list #28
runLmod load D/3.2 #27
runLmod load D/1.3 #28
runLmod list #29
runLmod load E #30
runLmod load E/3.3 #31
runLmod list #32
runLmod load F #33
runLmod load F/4.1.4 #34
runLmod load F/3.1.4 #35
runLmod list #36
Expand Down
45 changes: 43 additions & 2 deletions rt/conflict/err.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,53 @@ lua ProjectDIR/src/lmod.in.lua shell --regression_testing load D/1.1
===========================
===========================
step 27
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load D/3.2
===========================
The following have been reloaded with a version change:
1) D/1.1 => D/3.2
===========================
step 28
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load D/1.3
===========================
Lmod has detected the following error: Cannot load module "D/1.3" because this module set a conflict: "acme/1.0"
===========================
step 28
step 29
lua ProjectDIR/src/lmod.in.lua shell --regression_testing list
===========================
Currently Loaded Modules:
1) acme/1.0 2) D/3.2
===========================
step 30
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load E
===========================
Lmod has detected the following error: Cannot load module "E" because this module set a conflict: "acme/1.0"
===========================
step 31
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load E/3.3
===========================
Lmod has detected the following error: Cannot load module "E/3.3" because this module set a conflict: "acme/1.0"
===========================
step 32
lua ProjectDIR/src/lmod.in.lua shell --regression_testing list
===========================
Currently Loaded Modules:
1) acme/1.0 2) D/3.2
===========================
step 33
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load F
===========================
===========================
step 34
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load F/4.1.4
===========================
===========================
step 35
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load F/3.1.4
===========================
Lmod has detected the following error: Cannot load module "F/3.1.4" because this module set a conflict: "acme/1.0"
===========================
step 36
lua ProjectDIR/src/lmod.in.lua shell --regression_testing list
===========================
Currently Loaded Modules:
1) acme/1.0 2) D/1.1
1) acme/1.0 2) D/3.2 3) F/4.1.4
1 change: 1 addition & 0 deletions rt/conflict/mf2/Core/D/3.2.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
setenv("D",myModuleVersion())
1 change: 1 addition & 0 deletions rt/conflict/mf2/Core/E/3.3.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
setenv("E",myModuleVersion())
1 change: 1 addition & 0 deletions rt/conflict/mf2/Core/F/3.1.4.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
setenv("F",myModuleVersion())
1 change: 1 addition & 0 deletions rt/conflict/mf2/Core/F/4.1.4.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
setenv("F",myModuleVersion())
1 change: 1 addition & 0 deletions rt/conflict/mf2/Core/acme/1.0.lua
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
conflict(between("D","1.1>","<3.2"))
conflict("E")
conflict("F/3.1.4")
85 changes: 77 additions & 8 deletions rt/conflict/out.txt

Large diffs are not rendered by default.

15 changes: 6 additions & 9 deletions src/MName.lua
Original file line number Diff line number Diff line change
Expand Up @@ -717,20 +717,17 @@ function M.downstreamConflictCk(self, mnameIn)
local snIn = mnameIn:sn()
dbg.start{"MName:downstreamConflictCk(snIn:", snIn,")"}

local have_range = nil
local sn = self:sn()
local result = false
if (snIn ~= sn) then
return result
end

have_range, result = l_rangeCk(self, mnameIn:version(), mnameIn:userName(), false)
local have_range, result = l_rangeCk(self, mnameIn:version(), mnameIn:userName(), false)
if (have_range) then
dbg.print{"2 result: ",result,"\n"}
dbg.fini( "MName:downstreamConflictCk")
return result
end

if (self:userName() == snIn or extractVersion(userName, sn) == mnameIn:version()) then
result = false
dbg.print{"self: ",self,"\n"}
dbg.print{"mnameIn: ",mnameIn,"\n"}
if (self:userName() == snIn or extractVersion(self:userName(), snIn) == mnameIn:version()) then
result = snIn
end

Expand Down
2 changes: 2 additions & 0 deletions src/MT.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1517,8 +1517,10 @@ function M.haveDSConflict(self, mnameIn)
local cT = self.__conflictT
local MName = require("MName")
for sn, vv in pairs(cT) do
dbg.print{"upstreamSn: ",sn,"\n"}
for i = 1,#vv do
local conflict_mname = vv[i]
dbg.print{"conflict_mname:userName(): ",conflict_mname:userName(),"\n"}
local snUpstream = conflict_mname:downstreamConflictCk(mnameIn)
if (snUpstream) then
return sn
Expand Down

0 comments on commit 86e7256

Please sign in to comment.