[igt-dev] [PATCH i-g-t v2 12/19] testplan/meson.build: add targets to build Xe test documentation

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Fri Mar 10 19:41:18 UTC 2023


From: Mauro Carvalho Chehab <mchehab at kernel.org>

Produce documentation from igt_doc.py markups inside the Xe driver
at build time.

Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>
Acked-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
 docs/testplan/meson.build | 59 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 docs/testplan/meson.build

diff --git a/docs/testplan/meson.build b/docs/testplan/meson.build
new file mode 100644
index 0000000000..11c0857330
--- /dev/null
+++ b/docs/testplan/meson.build
@@ -0,0 +1,59 @@
+testplan_title = 'IGT test plans'
+
+build_testplan = get_option('testplan')
+build_sphinx = get_option('sphinx')
+
+rst2html = find_program('rst2html-3', 'rst2html', required : build_testplan)
+sphinx = find_program('sphinx-build', required: build_sphinx)
+
+stylesheet = meson.current_source_dir() + '/testplan.css'
+
+test_dict = { 'xe_tests': {
+                 'input': xe_test_config, 'extra_args': []
+              }
+            }
+
+if igt_doc_script.found()
+    foreach testplan, fields: test_dict
+        rst = custom_target(testplan + '.rst',
+                            build_by_default : true,
+                            command : [ igt_doc_script, '--config', '@INPUT@', '--rest', '@OUTPUT@' ] + fields['extra_args'],
+                            depends : test_executables,
+                            input : fields['input'],
+                            output : testplan + '.rst'
+                            )
+
+        if rst2html.found()
+            custom_target(testplan + '.html',
+                          build_by_default : true,
+                          command : [ rst2html, '--stylesheet=' + stylesheet, '--field-name-limit=0', '@INPUT@', '@OUTPUT@' ],
+                          input : rst,
+                          output : testplan + '.html'
+                          )
+        endif
+    endforeach
+endif
+
+if sphinx.found()
+    if gen_rst_index.found()
+        sphinx_out_dir = meson.current_build_dir()+ '/indexed_html'
+
+        index_rst = custom_target('index.rst',
+                                build_by_default : true,
+                                command : [ gen_rst_index, testplan_title, test_dict.keys(), meson.current_build_dir()],
+                                input : rst,
+                                output : 'index.rst'
+                                )
+
+        custom_target('index.html',
+                    build_by_default : true,
+                    command : [ 'sphinx-build', '-c', meson.current_source_dir(), meson.current_build_dir(), sphinx_out_dir],
+                    input : index_rst,
+                    output : 'index.html'
+                    )
+    endif
+endif
+
+build_info += 'Build ReST test documentation: @0@'.format(igt_doc_script.found())
+build_info += 'Build simple html testplan documentation: @0@'.format(rst2html.found())
+build_info += 'Build indexed html testplan documentation: @0@'.format(sphinx.found())
-- 
2.34.1



More information about the igt-dev mailing list