(case, suite_dir, tool, environment, witnesses)
| 289 | |
| 290 | |
| 291 | def profile_controls(case, suite_dir, tool, environment, witnesses): |
| 292 | profiles = sorted(suite_dir.glob("*.profraw")) |
| 293 | if not profiles or len(profiles) > 64: |
| 294 | raise Infrastructure("unexpected finite profile inventory") |
| 295 | results = [] |
| 296 | for index, raw in enumerate(profiles): |
| 297 | if not regular_nonempty(raw): |
| 298 | raise Infrastructure("profile is not regular/nonempty: " + str(raw)) |
| 299 | merged = case / ("profile-%02d.profdata" % index) |
| 300 | record = run_process(case, "merge-%02d" % index, |
| 301 | [tool, "merge", "--instr", "--output=" + str(merged), str(raw)], environment) |
| 302 | require_process(record) |
| 303 | if not regular_nonempty(merged): |
| 304 | raise Infrastructure("matching profdata produced no valid indexed profile") |
| 305 | item = {"raw": str(raw), "merged": str(merged), "valid": True} |
| 306 | if raw.name in witnesses: |
| 307 | function = witnesses[raw.name] |
| 308 | shown = run_process(case, "count-%02d" % index, |
| 309 | [tool, "show", "--counts", "--function=" + function, str(merged)], environment) |
| 310 | require_process(shown) |
| 311 | item["function"] = function |
| 312 | item["function_count"] = exact_positive_count(read_log(case, shown, "stdout"), function) |
| 313 | results.append(item) |
| 314 | if set(witnesses) - {Path(item["raw"]).name for item in results}: |
| 315 | raise Infrastructure("expected genuine child profile is absent") |
| 316 | return results |
| 317 | |
| 318 | |
| 319 | def reducer_worker(): |
no test coverage detected