Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions scripts/mbt/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class LinkModule:
include: list[str] # own members to include explicitly
dep_includes: dict # {dep_key: "*" | [member, ...]} for non-autocall deps
setcode: str = "" # SETCODE statement value, e.g. "AC(1)"
max_rc: int = 0 # max acceptable RC for final link (0 = strict)


@dataclass
Expand Down Expand Up @@ -210,6 +211,7 @@ def _parse(cls, data: dict) -> "ProjectConfig":
include=list(mod.get("include", ["@@CRT1", mod_name])),
dep_includes=dep_includes,
setcode=mod.get("setcode", ""),
max_rc=int(mod.get("max_rc", 0)),
))

# Source directories — partial override is allowed
Expand Down
3 changes: 1 addition & 2 deletions scripts/mvslink.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ def main() -> int:
_log_error(f"Failed to submit link job for {mod.name}: {e}")
return EXIT_BUILD

# Full link: RC=4 (informational warning) may be acceptable with LET
if result.rc > 4:
if result.rc > mod.max_rc:
log_file = _save_job_log(result, mod.name)
_log_error(f"{mod.name} link failed (RC={result.rc})")
_log(f"Job: {result.jobname} / {result.jobid}")
Expand Down
48 changes: 48 additions & 0 deletions tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def test_link_modules(self):
self.assertEqual(mod.options, ["RENT", "REUS"])
self.assertEqual(mod.include, ["@@CRT1", "HELLO"])
self.assertEqual(mod.setcode, "")
self.assertEqual(mod.max_rc, 0)

def test_artifacts(self):
self.assertFalse(self.config.artifact_headers)
Expand Down Expand Up @@ -332,5 +333,52 @@ def test_setcode_default_empty(self):
self.assertEqual(mod.setcode, "")


class TestLinkModuleMaxRc(unittest.TestCase):

def _write(self, content: str) -> Path:
self._tmp = tempfile.mkdtemp()
p = Path(self._tmp) / "project.toml"
p.write_text(content, encoding="utf-8")
return p

def tearDown(self):
import shutil
if hasattr(self, "_tmp"):
shutil.rmtree(self._tmp, ignore_errors=True)

def test_max_rc_default_zero(self):
toml = (
"[project]\nname=\"myapp\"\nversion=\"1.0.0\"\ntype=\"application\"\n"
"[mvs.build.datasets.ncalib]\n"
"suffix=\"NCALIB\"\ndsorg=\"PO\"\nrecfm=\"U\"\n"
"lrecl=0\nblksize=32760\nspace=[\"TRK\",5,2,5]\n"
"[mvs.build.datasets.syslmod]\n"
"suffix=\"LOAD\"\ndsorg=\"PO\"\nrecfm=\"U\"\n"
"lrecl=0\nblksize=32760\nspace=[\"TRK\",5,2,5]\n"
"[dependencies]\n\"mvslovers/crent370\" = \">=1.0.0\"\n"
"[link.module]\n"
"name=\"MYAPP\"\noptions=[\"RENT\"]\n"
)
c = ProjectConfig.load(self._write(toml))
self.assertEqual(c.link_modules[0].max_rc, 0)

def test_max_rc_parsed(self):
toml = (
"[project]\nname=\"myapp\"\nversion=\"1.0.0\"\ntype=\"application\"\n"
"[mvs.build.datasets.ncalib]\n"
"suffix=\"NCALIB\"\ndsorg=\"PO\"\nrecfm=\"U\"\n"
"lrecl=0\nblksize=32760\nspace=[\"TRK\",5,2,5]\n"
"[mvs.build.datasets.syslmod]\n"
"suffix=\"LOAD\"\ndsorg=\"PO\"\nrecfm=\"U\"\n"
"lrecl=0\nblksize=32760\nspace=[\"TRK\",5,2,5]\n"
"[dependencies]\n\"mvslovers/crent370\" = \">=1.0.0\"\n"
"[link.module]\n"
"name=\"MYAPP\"\noptions=[\"RENT\"]\n"
"max_rc=4\n"
)
c = ProjectConfig.load(self._write(toml))
self.assertEqual(c.link_modules[0].max_rc, 4)


if __name__ == "__main__":
unittest.main()