xref: /aosp_15_r20/external/cronet/third_party/libc++/src/test/libcxx/headers_in_modulemap.sh.py (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1# RUN: %{python} %s %{libcxx-dir}/utils %{include-dir}
2
3import sys
4
5sys.path.append(sys.argv[1])
6
7import pathlib
8import sys
9from libcxx.header_information import is_modulemap_header, is_header
10
11headers = list(pathlib.Path(sys.argv[2]).rglob("*"))
12modulemap = open(f"{sys.argv[2]}/module.modulemap").read()
13
14isHeaderMissing = False
15
16for header in headers:
17    if not is_header(header):
18        continue
19
20    header = header.relative_to(pathlib.Path(sys.argv[2])).as_posix()
21
22    if not is_modulemap_header(header):
23        continue
24
25    if not str(header) in modulemap:
26        print(f"Header {header} seems to be missing from the modulemap!")
27        isHeaderMissing = True
28
29if isHeaderMissing:
30    exit(1)
31