Path: blob/master/tests/python_build/validate_builders.py
20806 views
#!/usr/bin/env python312from __future__ import annotations34if __name__ != "__main__":5raise ImportError(f"{__name__} should not be used as a module.")67import os8import sys9from typing import Any, Callable1011sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../"))1213from gles3_builders import build_gles3_header14from glsl_builders import build_raw_header, build_rd_header1516FUNC_PATH_KWARGS: list[tuple[Callable[..., None], str, dict[str, Any]]] = [17(18build_gles3_header,19"tests/python_build/fixtures/gles3/vertex_fragment.out",20{"shader": "tests/python_build/fixtures/gles3/vertex_fragment.glsl"},21),22(23build_raw_header,24"tests/python_build/fixtures/glsl/compute.out",25{"shader": "tests/python_build/fixtures/glsl/compute.glsl"},26),27(28build_raw_header,29"tests/python_build/fixtures/glsl/vertex_fragment.out",30{"shader": "tests/python_build/fixtures/glsl/vertex_fragment.glsl"},31),32(33build_rd_header,34"tests/python_build/fixtures/rd_glsl/compute.out",35{"shader": "tests/python_build/fixtures/rd_glsl/compute.glsl"},36),37(38build_rd_header,39"tests/python_build/fixtures/rd_glsl/vertex_fragment.out",40{"shader": "tests/python_build/fixtures/rd_glsl/vertex_fragment.glsl"},41),42]434445def main() -> int:46ret = 04748for func, path, kwargs in FUNC_PATH_KWARGS:49if os.path.exists(out_path := os.path.abspath(path)):50with open(out_path, "rb") as file:51raw = file.read()52func(path, **kwargs)53with open(out_path, "rb") as file:54if raw != file.read():55ret += 156else:57func(path, **kwargs)58ret += 15960return ret616263sys.exit(main())646566