(context, destination, registry, tests, outcome, exit_code)
| 95 | |
| 96 | |
| 97 | def bundle(context, destination, registry, tests, outcome, exit_code): |
| 98 | metadata = json_read(destination / "meta.json") |
| 99 | require(isinstance(metadata, dict) and metadata.get("format") == 2 and metadata.get("admission") == "unverified", |
| 100 | "bundle format/admission marker") |
| 101 | profiles, tests_data = read(destination / "profiles.tsv"), read(destination / "tests.tsv") |
| 102 | expected_digests = {"image_sha256": context.runner_identity["sha256"], |
| 103 | "registry_sha256": digest(registry), |
| 104 | "profiles_sha256": digest(destination / "profiles.tsv"), |
| 105 | "tests_sha256": digest(destination / "tests.tsv")} |
| 106 | for key, expected in expected_digests.items(): |
| 107 | require(metadata.get(key) == expected, "metadata identity/digest mismatch: " + key) |
| 108 | tool = metadata.get("llvm_profdata", {}) |
| 109 | require(isinstance(tool, dict) and tool.get("path") == context.tool and tool.get("sha256") == context.tool_identity["sha256"] |
| 110 | and isinstance(tool.get("version"), str) and "22.1.8" in tool["version"], |
| 111 | "metadata native tool identity/version") |
| 112 | require(metadata.get("scope") == [SUITE], "unexpected collected registry scope") |
| 113 | outcomes = metadata.get("suites") |
| 114 | require(isinstance(outcomes, list) and len(outcomes) == 1, "suite outcome cardinality") |
| 115 | row = outcomes[0] |
| 116 | require(isinstance(row, dict) and row.get("suite") == SUITE |
| 117 | and isinstance(row.get("tests"), list) and len(row["tests"]) == len(tests) |
| 118 | and all(isinstance(test, str) for test in row["tests"]) and set(row["tests"]) == set(tests) |
| 119 | and row.get("outcome") == outcome and type(row.get("exit")) is int |
| 120 | and row["exit"] == exit_code, "suite outcome/expected-registry mismatch") |
| 121 | process = row.get("process", {}) |
| 122 | require(isinstance(process, dict) and process.get("argv") == [context.runner, SUITE] |
| 123 | and process.get("returncode") == exit_code and process.get("quiescent") is True, |
| 124 | "native process identity/status/custody receipt") |
| 125 | stdout = native_log(destination, process.get("stdout")) |
| 126 | stderr = native_log(destination, process.get("stderr")) |
| 127 | native_summary(stdout, failed=outcome == "failed") |
| 128 | if outcome == "failed": |
| 129 | require(b"coverage child fixture failed: setup_ok" in stderr, |
| 130 | "fixed native failure did not reach the actual fixture failure branch") |
| 131 | ids = profile_wire(profiles, context.runner_identity["sha256"], context.universe) |
| 132 | rows = test_rows(tests_data) |
| 133 | require(set(rows) == {(SUITE + ":" + test).encode() for test in ["*"] + tests}, |
| 134 | "producer lost or invented expected rows") |
| 135 | require(all(number < len(ids) for reasons, numbers in rows.values() for number in numbers), |
| 136 | "test row references unknown profile identity") |
| 137 | return rows, ids, metadata |
| 138 | |
| 139 | |
| 140 | def native_log(destination, record): |
no test coverage detected