(args)
| 102 | |
| 103 | |
| 104 | def cmd_static(args) -> int: |
| 105 | instrumented: dict[str, set[str]] = defaultdict(set) |
| 106 | compiled: set[str] = set() |
| 107 | for lane, spec in {"asan": LANES["asan"], "tsan": LANES["tsan"]}.items(): |
| 108 | bdir = f"build/covmap-static-{lane}" |
| 109 | for argv in dry_commands(f"{bdir}/{spec['target']}", [f"BUILD_DIR={bdir}"]): |
| 110 | flags = " ".join(argv) |
| 111 | for a in argv: |
| 112 | if a.endswith(SRC_EXT) and os.path.isfile(os.path.join(ROOT, a)): |
| 113 | compiled.add(a) |
| 114 | if any(f in flags for f in ("-fsanitize=address", "-fsanitize=thread")): |
| 115 | instrumented[a].add(lane) |
| 116 | uninstrumented = sorted(s for s in compiled if not instrumented.get(s)) |
| 117 | lint_srcs = set(make_var("LINT_SRCS")) |
| 118 | static_skipped = sorted(s for s in compiled if s not in lint_srcs) |
| 119 | out = { |
| 120 | "translation_units": len(compiled), |
| 121 | "not_instrumented_by_any_dynamic_lane": uninstrumented, |
| 122 | "not_in_static_lanes": static_skipped, |
| 123 | "per_tu": {s: sorted(instrumented.get(s, ())) for s in sorted(compiled)}, |
| 124 | } |
| 125 | if args.json: |
| 126 | json.dump(out, sys.stdout, indent=1) |
| 127 | print() |
| 128 | return 0 |
| 129 | print(f"translation units in the test builds: {len(compiled)}") |
| 130 | print(f" instrumented by ASan+UBSan: {sum(1 for v in instrumented.values() if 'asan' in v)}" |
| 131 | f" by TSan: {sum(1 for v in instrumented.values() if 'tsan' in v)}") |
| 132 | print() |
| 133 | print(f" NOT instrumented by any dynamic lane ({len(uninstrumented)}):") |
| 134 | for s in uninstrumented: |
| 135 | print(f" {s}{' [vendored]' if is_vendored(s) else ''}") |
| 136 | print() |
| 137 | print(f" outside the static lanes' source list (cppcheck, clang-analyzer) ({len(static_skipped)}):") |
| 138 | vend = [s for s in static_skipped if is_vendored(s)] |
| 139 | own = [s for s in static_skipped if not is_vendored(s) and not s.startswith("tests/")] |
| 140 | print(f" vendored: {len(vend)} project: {len(own)}") |
| 141 | for s in own: |
| 142 | print(f" {s}") |
| 143 | return 0 |
| 144 | |
| 145 | |
| 146 | def find_llvm_tool(name: str, cc: str) -> str: |
nothing calls this directly
no test coverage detected