mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-24 12:48:13 +02:00
util: add very basic way to validate drirc files
This just checks for option names that don't exist. This is something that already happened in the past with RADV. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41700>
This commit is contained in:
parent
e685f8d6aa
commit
ccb669a05f
1 changed files with 17 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import argparse
|
|||
import os
|
||||
import re
|
||||
import sys
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
from enum import Enum
|
||||
from mako.template import Template
|
||||
|
|
@ -193,6 +194,22 @@ ${driver_prefix}_parse_dri_options(struct ${driver_prefix}_drirc *drirc,
|
|||
}
|
||||
"""
|
||||
|
||||
def drirc_validate(conf_paths, sections):
|
||||
declared = {opt.name for section in sections for opt in section.options}
|
||||
conf_names = set()
|
||||
for conf_path in conf_paths:
|
||||
tree = ET.parse(conf_path)
|
||||
for option in tree.iter('option'):
|
||||
name = option.get('name')
|
||||
if name:
|
||||
conf_names.add(name)
|
||||
missing = conf_names - declared
|
||||
if missing:
|
||||
print('ERROR: options used in conf but not declared:', file=sys.stderr)
|
||||
for name in sorted(missing):
|
||||
print(f' {name}', file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
def drirc_generate(cpath, hpath, driver_prefix, sections):
|
||||
environment = {
|
||||
'driver_prefix': driver_prefix,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue