Path: blob/master/tests/python_build/validate_builders.py
10277 views
#!/usr/bin/env python31from __future__ import annotations23if __name__ != "__main__":4raise ImportError(f"{__name__} should not be used as a module.")56import os7import sys8from typing import Any, Callable910sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../"))1112from gles3_builders import build_gles3_header13from glsl_builders import build_raw_header, build_rd_header1415FUNC_PATH_KWARGS: list[tuple[Callable[..., None], str, dict[str, Any]]] = [16(17build_gles3_header,18"tests/python_build/fixtures/gles3/vertex_fragment.out",19{"shader": "tests/python_build/fixtures/gles3/vertex_fragment.glsl"},20),21(22build_raw_header,23"tests/python_build/fixtures/glsl/compute.out",24{"shader": "tests/python_build/fixtures/glsl/compute.glsl"},25),26(27build_raw_header,28"tests/python_build/fixtures/glsl/vertex_fragment.out",29{"shader": "tests/python_build/fixtures/glsl/vertex_fragment.glsl"},30),31(32build_rd_header,33"tests/python_build/fixtures/rd_glsl/compute.out",34{"shader": "tests/python_build/fixtures/rd_glsl/compute.glsl"},35),36(37build_rd_header,38"tests/python_build/fixtures/rd_glsl/vertex_fragment.out",39{"shader": "tests/python_build/fixtures/rd_glsl/vertex_fragment.glsl"},40),41]424344def main() -> int:45ret = 04647for func, path, kwargs in FUNC_PATH_KWARGS:48if os.path.exists(out_path := os.path.abspath(path)):49with open(out_path, "rb") as file:50raw = file.read()51func(path, **kwargs)52with open(out_path, "rb") as file:53if raw != file.read():54ret += 155else:56func(path, **kwargs)57ret += 15859return ret606162sys.exit(main())636465