forked from nolanderc/glsl_analyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_parser.py
More file actions
42 lines (31 loc) · 1 KB
/
test_parser.py
File metadata and controls
42 lines (31 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import subprocess
from pathlib import Path
import pytest
import pytest_subtests
base_directory = Path(__file__).parent.resolve()
glsl_extensions = (
".glsl", ".vert", ".frag", ".geom",
".comp", ".tesc", ".tese", ".rgen",
".rint", ".rahit", ".rchit", ".rmiss",
".rcall", ".mesh", ".task"
)
@pytest.fixture(
params=("glsl-samples/well-formed/glslang/",)
)
def dir_with_test_files(request) -> Path:
return base_directory / Path(request.param)
def test_parser_in_directory(
subtests: pytest_subtests.SubTests,
dir_with_test_files: Path
):
for file in dir_with_test_files.iterdir():
if file.suffix not in glsl_extensions:
continue
with subtests.test(msg=str(file)):
output = subprocess.run(
args=("glsl_analyzer", "--parse-file", str(file)),
capture_output=True,
text=True
)
assert output.returncode == 0 and len(output.stderr) == 0, \
output.stderr