mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-16 22:43:24 +09:00
[CI] (.github/workflows, docs/ci, MG_IntegrationTest/Harness, scripts/data): reuse build-linux for split
- build-linux and build-linux-split each probe the other's configure line with build_fingerprint.py on their own runner (disaggregation branches only); when it matches, build-linux-split skips its compile and the split consumers take build-linux's runtime and library - the consumers red when build-linux-split skipped but build-linux's guard did not agree, or when the link ratchet, now also run in build-linux, did not pass; a difference falls back to the old two builds, and dev is unchanged apart from the consumers also waiting for build-linux - the transport resolution check moves after 'Split lanes' and proves the IPC defaults from each passed entry's client log (split_log_paths.py ipc-config, canned tests); with both proven, Transport A/B and the non-strict split unit run are skipped as repeats - the test job carries REQUIRE_GPU and libegl-mesa0 on the three branches; skip census: arm-monolith, arm-inproc and unit-split become optional rows
This commit is contained in:
@@ -306,6 +306,72 @@ def require_green(document, junit_path, required):
|
||||
print(f"SplitLogPaths require-green: {len(by_name)} PASS, 0 skip, 0 failed, complete discovery")
|
||||
|
||||
|
||||
# The client's one-line IPC configuration (ConfigLoader, every non-monolith transport, INFO) and
|
||||
# the knobs an entry may pin in its own ENVIRONMENT instead of inheriting the lane's.
|
||||
IPC_LINE = "Config: IPC "
|
||||
IPC_PINS = {"strict": "MOBILEGL_IPC_STRICT_ERRORS", "role-split-state": "MOBILEGL_IPC_ROLE_SPLIT_STATE",
|
||||
"run-ahead": "MOBILEGL_IPC_RUN_AHEAD"}
|
||||
|
||||
|
||||
def entry_environment(test):
|
||||
env = {}
|
||||
for prop in test.get("properties", []):
|
||||
if prop.get("name") == "ENVIRONMENT":
|
||||
for item in prop.get("value") or []:
|
||||
key, _, value = item.partition("=")
|
||||
env[key] = value
|
||||
return env
|
||||
|
||||
|
||||
def ipc_config(document, junit_path, expected, assumed=()):
|
||||
"""Prove, from each passed entry's own client log, the IPC knobs the run resolved.
|
||||
|
||||
Every entry that passed and has a private log must show `key=value` on its last "Config: IPC"
|
||||
line, where value is the entry's own ENVIRONMENT pin when it has one and the expected value
|
||||
otherwise; monolith-pinned entries have no such line and are left out. Returns (code, summary):
|
||||
0 proven; 3 when the only mismatches are on `assumed` keys of entries that do not pin them (a
|
||||
default that changed); 1 for anything else, including no evidence at all."""
|
||||
passed = set()
|
||||
for case in ET.parse(junit_path).getroot().iter("testcase"):
|
||||
failed = case.find("failure") is not None or case.find("error") is not None
|
||||
skipped = case.find("skipped") is not None or case.get("status") in ("notrun", "disabled")
|
||||
if not failed and not skipped:
|
||||
passed.add(case.get("name"))
|
||||
problems, defaults, checked = [], [], []
|
||||
for test in document.get("tests", []):
|
||||
name = test["name"]
|
||||
env = entry_environment(test)
|
||||
transport = env.get("MOBILEGL_TRANSPORT", "")
|
||||
base = env.get("MOBILEGL_LOG_FILE_PATH", "")
|
||||
if name not in passed or transport == "monolith" or not base:
|
||||
continue
|
||||
client = Path(role_paths(base)[0])
|
||||
lines = [line for line in (client.read_text(errors="replace") if client.is_file() else "").splitlines()
|
||||
if IPC_LINE in line]
|
||||
if not lines:
|
||||
if transport == "inproc":
|
||||
problems.append(f"{name}: passed under inproc but {client} carries no '{IPC_LINE.strip()}' line")
|
||||
continue
|
||||
checked.append(name)
|
||||
for key, value in expected.items():
|
||||
want = env.get(IPC_PINS.get(key, ""), value)
|
||||
found = re.search(r"(?:^| )" + re.escape(key) + r"=(\S*)", lines[-1])
|
||||
got = found.group(1) if found else "<absent>"
|
||||
if got == want:
|
||||
continue
|
||||
row = f"{name}: {key}={got}, expected {want}"
|
||||
if key in assumed and IPC_PINS.get(key) not in env:
|
||||
defaults.append(row)
|
||||
else:
|
||||
problems.append(row)
|
||||
if not checked:
|
||||
problems.append("no passed entry left a 'Config: IPC' line, so nothing proves the configuration")
|
||||
summary = {"checked": len(checked), "expected": expected, "assumed": sorted(assumed),
|
||||
"problems": problems, "default_mismatches": defaults}
|
||||
code = 1 if problems else 3 if defaults else 0
|
||||
return code, summary
|
||||
|
||||
|
||||
VERIFY_ARMED_LINE = "MGPipe: verify armed"
|
||||
|
||||
|
||||
@@ -616,6 +682,23 @@ def main():
|
||||
if mode == "require-green":
|
||||
require_green(json.loads(Path(sys.argv[2]).read_text()), sys.argv[3], sys.argv[4:])
|
||||
return
|
||||
if mode == "ipc-config":
|
||||
# <lane.json> <junit> <summary.json> key=value... [--assumed k1,k2]
|
||||
args = sys.argv[5:]
|
||||
assumed = set()
|
||||
if "--assumed" in args:
|
||||
at = args.index("--assumed")
|
||||
assumed = {key for key in args[at + 1].split(",") if key}
|
||||
args = args[:at] + args[at + 2:]
|
||||
expected = dict(arg.split("=", 1) for arg in args)
|
||||
code, summary = ipc_config(json.loads(Path(sys.argv[2]).read_text()), sys.argv[3], expected, assumed)
|
||||
Path(sys.argv[4]).write_text(json.dumps(summary, indent=1) + "\n")
|
||||
for row in summary["problems"] + summary["default_mismatches"]:
|
||||
print(f"SplitLogPaths ipc-config: {row}")
|
||||
print(f"SplitLogPaths ipc-config: {summary['checked']} entr(ies) checked against "
|
||||
f"{' '.join(f'{k}={v}' for k, v in expected.items())}: "
|
||||
f"{['proven', '', '', 'a default differs'][code] if code != 1 else 'FAILED'}")
|
||||
sys.exit(code)
|
||||
selected = paths(json.loads(Path(sys.argv[2]).read_text()))
|
||||
selected = {name: path for name, path in selected.items() if re.search(sys.argv[3], name)}
|
||||
# The SAME exclusion run_control hands ctest -E. Without it this helper and ctest disagree
|
||||
|
||||
@@ -262,5 +262,79 @@ class VerifySplitArmProofTest(unittest.TestCase):
|
||||
self.proof()
|
||||
|
||||
|
||||
class IpcConfigProofTest(unittest.TestCase):
|
||||
"""ipc-config reads each passed entry's own client log for the knobs the run resolved."""
|
||||
|
||||
LINE = "Config: IPC ring=8MiB run-ahead={ra} present-credit=2 strict={st} audit=0 role-split-state={rs} surface=x"
|
||||
|
||||
def setUp(self):
|
||||
self.temp = tempfile.TemporaryDirectory()
|
||||
self.root = Path(self.temp.name)
|
||||
self.xml = self.root / "run.xml"
|
||||
|
||||
def tearDown(self):
|
||||
self.temp.cleanup()
|
||||
|
||||
def lane(self, rows):
|
||||
"""rows: (name, status, pins, log line or None)."""
|
||||
tests, suite = [], ET.Element("testsuite")
|
||||
for i, (name, status, pins, line) in enumerate(rows):
|
||||
base = self.root / f"{i}.log"
|
||||
if line is not None:
|
||||
(self.root / f"{i}.client.log").write_text("Config: MOBILEGL_TRANSPORT=inproc\n" + line + "\n")
|
||||
env = ["MOBILEGL_LOG_FILE_PATH=" + str(base)] + pins
|
||||
tests.append({"name": name, "properties": [{"name": "ENVIRONMENT", "value": env}]})
|
||||
case = ET.SubElement(suite, "testcase", name=name, status="run")
|
||||
if status == "skip":
|
||||
ET.SubElement(case, "skipped")
|
||||
if status == "fail":
|
||||
ET.SubElement(case, "failure")
|
||||
ET.ElementTree(suite).write(self.xml)
|
||||
return {"tests": tests}
|
||||
|
||||
def check(self, rows, expected=None, assumed=("role-split-state", "run-ahead")):
|
||||
expected = expected or {"strict": "0", "role-split-state": "1", "run-ahead": "1"}
|
||||
with contextlib.redirect_stdout(io.StringIO()):
|
||||
return helper.ipc_config(self.lane(rows), self.xml, expected, set(assumed))[0]
|
||||
|
||||
def inproc(self, ra="1", st="0", rs="1"):
|
||||
return ["MOBILEGL_TRANSPORT=inproc"], self.LINE.format(ra=ra, st=st, rs=rs)
|
||||
|
||||
def test_the_defaults_are_proven(self):
|
||||
pins, line = self.inproc()
|
||||
self.assertEqual(self.check([("A", "pass", pins, line), ("B", "skip", pins, None)]), 0)
|
||||
|
||||
def test_a_changed_default_is_exit_three(self):
|
||||
pins, line = self.inproc(rs="0")
|
||||
self.assertEqual(self.check([("A", "pass", pins, line)]), 3)
|
||||
|
||||
def test_an_unassumed_key_that_differs_is_red(self):
|
||||
pins, line = self.inproc(st="1")
|
||||
self.assertEqual(self.check([("A", "pass", pins, line)]), 1)
|
||||
|
||||
def test_a_passed_inproc_entry_without_the_line_is_red(self):
|
||||
pins, line = self.inproc()
|
||||
self.assertEqual(self.check([("A", "pass", pins, line), ("B", "pass", pins, None)]), 1)
|
||||
|
||||
def test_no_evidence_is_red(self):
|
||||
pins, _ = self.inproc()
|
||||
self.assertEqual(self.check([("A", "skip", pins, None)]), 1)
|
||||
|
||||
def test_an_entry_pin_overrides_the_expectation(self):
|
||||
pins, line = self.inproc(ra="0")
|
||||
self.assertEqual(self.check([("A", "pass", pins + ["MOBILEGL_IPC_RUN_AHEAD=0"], line)]), 0)
|
||||
self.assertEqual(self.check([("A", "pass", pins + ["MOBILEGL_IPC_RUN_AHEAD=1"], line)]), 1,
|
||||
"a pinned value the run did not honour is red, not a changed default")
|
||||
|
||||
def test_the_value_is_matched_whole(self):
|
||||
pins, line = self.inproc(ra="10")
|
||||
self.assertEqual(self.check([("A", "pass", pins, line)]), 3)
|
||||
|
||||
def test_monolith_pinned_entries_are_left_out(self):
|
||||
pins, line = self.inproc()
|
||||
rows = [("A", "pass", pins, line), ("M", "pass", ["MOBILEGL_TRANSPORT=monolith"], None)]
|
||||
self.assertEqual(self.check(rows), 0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user