driconf: add DTD to allow the drirc xml (00-mesa-defaults.conf) to be validated
authorEric Engestrom <eric.engestrom@intel.com>
Tue, 26 Feb 2019 12:32:04 +0000 (12:32 +0000)
committerEric Engestrom <eric.engestrom@intel.com>
Thu, 28 Feb 2019 17:30:44 +0000 (17:30 +0000)
This DTD can be used to validate the drirc xml:
$ xmllint --noout --valid 00-mesa-defaults.conf

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/util/00-mesa-defaults.conf
src/util/meson.build

index f5405a0da841a6982d9336cfbab3d6b0e71b166b..320de83a6196782010237e4a46aded5201b6d46a 100644 (file)
@@ -1,3 +1,4 @@
+<?xml version="1.0" standalone="yes"?>
 <!--
 
 ============================================
@@ -27,6 +28,18 @@ TODO: document the other workarounds.
 
 -->
 
+<!DOCTYPE driconf [
+   <!ELEMENT driconf      (device+)>
+   <!ELEMENT device       (application+)>
+   <!ATTLIST device       driver CDATA #IMPLIED>
+   <!ELEMENT application  (option+)>
+   <!ATTLIST application  name CDATA #REQUIRED
+                          executable CDATA #REQUIRED>
+   <!ELEMENT option       EMPTY>
+   <!ATTLIST option       name CDATA #REQUIRED
+                          value CDATA #REQUIRED>
+]>
+
 <driconf>
     <!-- Please always enable app-specific workarounds for all drivers and
          screens. -->
index 397c2228129230f7d663e67b40558949fe82a82c..4f64681f191a9a3b0a55fae58e9d2b907f693a92 100644 (file)
@@ -100,7 +100,21 @@ files_mesa_util = files(
   'vma.h',
 )
 
-install_data('00-mesa-defaults.conf', install_dir : join_paths(get_option('datadir'), 'drirc.d'))
+files_drirc = files('00-mesa-defaults.conf')
+
+install_data(files_drirc, install_dir : join_paths(get_option('datadir'), 'drirc.d'))
+
+if with_tests
+  prog_xmllint = find_program('xmllint', required : false, native : true)
+  if prog_xmllint.found()
+    test(
+      'drirc xml validation',
+      prog_xmllint,
+      args : ['--noout', '--valid', files_drirc],
+      suite : ['util'],
+    )
+  endif
+endif
 
 files_xmlconfig = files(
   'xmlconfig.c',