(args)
| 524 | |
| 525 | |
| 526 | def collect(args): |
| 527 | evidence = None |
| 528 | try: |
| 529 | if os.name != "posix" or not all(hasattr(os, name) for name in |
| 530 | ("O_NOFOLLOW", "O_DIRECTORY", "killpg", "set_blocking")): |
| 531 | _error("unsupported", "format2 requires POSIX owned process-group custody") |
| 532 | for name in ("timeout", "max_output_bytes", "max_total_output_bytes", "max_profile_bytes", "max_total_profile_bytes", |
| 533 | "max_profile_files", "conversion_timeout", "reduction_timeout", "max_map_bytes"): |
| 534 | value = getattr(args, name) |
| 535 | if type(value) is not int or value <= 0 or value > sys.maxsize // 2: |
| 536 | _error("input", "resource limits must be positive bounded integers") |
| 537 | if not args.registry or not args.llvm_bin: |
| 538 | _error("input", "format2 requires --registry and explicit --llvm-bin") |
| 539 | runner = os.path.realpath(os.path.abspath(args.runner)) |
| 540 | tool = os.path.realpath(os.path.join(os.path.abspath(args.llvm_bin), "llvm-profdata")) |
| 541 | root = os.path.abspath(args.root or os.path.join(os.path.dirname(__file__), "..", "..")) |
| 542 | root_fd = _directory(root) |
| 543 | os.close(root_fd) |
| 544 | image = _identity(runner) |
| 545 | tool_identity = _identity(tool) |
| 546 | registry_path = os.path.abspath(args.registry) |
| 547 | registry, registry_digest, registry_bytes = _registry(registry_path, image) |
| 548 | # Reject explicit scope errors before any runner/tool action. |
| 549 | _scope(registry, args.suite, set(registry)) |
| 550 | evidence = Evidence(args.out, args) |
| 551 | registry_snapshot = evidence.write("evidence/registry.json", registry_bytes) |
| 552 | environment = _environment() |
| 553 | environment["LLVM_PROFILE_FILE"] = os.devnull |
| 554 | version_record, version = _run(evidence, "tool-version", [tool, "--version"], environment, |
| 555 | args.conversion_timeout, root) |
| 556 | _required(version_record) |
| 557 | if not re.search(rb"LLVM version 22\.1\.8(?:\s|$)", version): |
| 558 | _error("unsupported", "only observed LLVM 22.1.8 proftext transport is supported") |
| 559 | listing_path = os.path.join(evidence.path, "listing.profraw") |
| 560 | listing_env = dict(environment, LLVM_PROFILE_FILE=listing_path) |
| 561 | listed, listing = _run(evidence, "list-suites", [runner, "--list-suites"], listing_env, |
| 562 | args.timeout, root, watch_raw=True) |
| 563 | _required(listed) |
| 564 | try: |
| 565 | available = listing.decode("utf-8", "strict").splitlines() |
| 566 | except UnicodeError: |
| 567 | _error("input", "native suite list is not UTF-8") |
| 568 | if not available or any(not name for name in available) or len(set(available)) != len(available): |
| 569 | _error("input", "native suite list is empty or ambiguous") |
| 570 | for name in available: |
| 571 | _identifier(name, suite=True) |
| 572 | selected = _scope(registry, args.suite, set(available)) |
| 573 | evidence.allowed_suites = set(selected) |
| 574 | enumeration = _convert(evidence, tool, listing_path, "enumeration", environment, root) |
| 575 | evidence.inventory() |
| 576 | suite_env = dict(environment, CBM_TEST_COVERAGE_DIR=os.path.join(evidence.path, "raw")) |
| 577 | outcomes = [] |
| 578 | expected = [] |
| 579 | failed = False |
| 580 | for index, suite in enumerate(selected): |
| 581 | record, _ = _run(evidence, "suite-%06d" % index, [runner, suite], suite_env, |
| 582 | args.timeout, root, watch_raw=True) |
| 583 | if record["failure"] not in (None, "timeout") or not record["quiescent"]: |
no test coverage detected