diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 7a0292677..72eb3fc20 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -57,7 +57,7 @@ body: id: output attributes: label: Output - description: The last lines the console printed, from the stage that failed down to the error. + description: The last lines the console printed, from the stage that failed down to the error. For the D3D12 runtime add -Log to play-nvidia.ps1 or play-d3d12.ps1 - the file is %LOCALAPPDATA%\Leonida\logs\play-*.log, and without -Log nothing is written there; its last 30 lines name the card (host wave lanes), the shader cache (shader preparation) and the error. render: text validations: required: true diff --git a/tests/test_docs_issue_template.py b/tests/test_docs_issue_template.py new file mode 100644 index 000000000..67349effd --- /dev/null +++ b/tests/test_docs_issue_template.py @@ -0,0 +1,34 @@ +"""The bug report template says how to get a D3D12 log. + + python -I tests/test_docs_issue_template.py + +Reports arrive with "Could not find a log file. I checked the expected log directory from the +documentation, but no log file was generated" (#3122's own output), because the runtime writes +nothing there until `-Log` is passed. The template asks for "the last lines the console +printed"; without the switch there are none to paste, so it now names the switch, the file and +the first lines worth reading. This reads the template only. No game files. +""" +import os +import unittest + +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +TEMPLATE = os.path.join(".github", "ISSUE_TEMPLATE", "bug_report.yml") +HINTS = ("-Log", "%LOCALAPPDATA%\\Leonida\\logs", "play-nvidia.ps1") + + +def missing_hints(template): + """The hints a report needs that `template` does not carry.""" + return [hint for hint in HINTS if hint not in template] + + +class BugReportTemplateTest(unittest.TestCase): + def test_the_output_field_says_how_to_get_a_log(self): + with open(os.path.join(ROOT, TEMPLATE), encoding="utf-8") as f: + self.assertEqual(missing_hints(f.read()), []) + + def test_a_template_without_the_hints_is_caught(self): + self.assertEqual(len(missing_hints("label: Output\ndescription: the last lines\n")), len(HINTS)) + + +if __name__ == "__main__": + unittest.main()