(self, case, registry, runner=None, destination=None, llvm_bin=None,
extra=None, poison=False, fault=False)
| 47 | return path |
| 48 | |
| 49 | def collect(self, case, registry, runner=None, destination=None, llvm_bin=None, |
| 50 | extra=None, poison=False, fault=False): |
| 51 | destination = destination or (case / "bundle") |
| 52 | runner = str(runner or self.runner) |
| 53 | arguments = ["--format", "2", "--runner", runner, "--registry", str(registry), |
| 54 | "--out", str(destination), "--llvm-bin", str(llvm_bin or Path(self.tool).parent), |
| 55 | "--timeout", "70"] + (extra or []) |
| 56 | argv = [sys.executable, self.collector] + arguments |
| 57 | if fault: |
| 58 | adapter = str(Path(__file__).with_name("coverage_live_v2_fault.py")) |
| 59 | argv = [sys.executable, adapter, self.collector, self.runner, SUITE, |
| 60 | str(case / "native-fault.json")] + arguments |
| 61 | env = clean_env() |
| 62 | env["PYTHONDONTWRITEBYTECODE"] = "1" |
| 63 | env["LLVM_PROFILE_FILE"] = os.devnull |
| 64 | sentinel = None |
| 65 | if poison: |
| 66 | poison_root = case / "caller-coverage" |
| 67 | poison_root.mkdir() |
| 68 | sentinel = poison_root / "sentinel" |
| 69 | sentinel.write_bytes(b"caller coverage is not the collection destination\n") |
| 70 | only_file = case / "caller-selection.txt" |
| 71 | only_file.write_text("nonexistent_suite:nonexistent_test\n", encoding="utf-8") |
| 72 | env.update(CBM_TEST_COVERAGE_DIR=str(poison_root), |
| 73 | CBM_TEST_ONLY="nonexistent_suite:nonexistent_test", CBM_TEST_ONLY_FILE=str(only_file)) |
| 74 | process = self.processes.run(case.name, argv, env, timeout=600) |
| 75 | if sentinel is not None: |
| 76 | require(list(sentinel.parent.iterdir()) == [sentinel] |
| 77 | and sentinel.read_bytes() == b"caller coverage is not the collection destination\n", |
| 78 | "collector used or changed inherited caller coverage directory") |
| 79 | return process, destination |
| 80 | |
| 81 | |
| 82 | def fresh_output(value): |
no test coverage detected