Skip to content

Commit 1255f5b

Browse files
committed
Add test possibility to check the structure of the index.qhp file
Check the structure of the index.qhp file by means ok xmllint
1 parent 15dae50 commit 1255f5b

File tree

2 files changed

+29
-11
lines changed

2 files changed

+29
-11
lines changed

.github/workflows/build_cmake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ jobs:
341341
set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON")
342342
343343
execute_process(
344-
COMMAND cmake --build build --target tests TEST_FLAGS="--xml --xmlxsd --xhtml --docbook --rtf"
344+
COMMAND cmake --build build --target tests TEST_FLAGS="--xml --xmlxsd --xhtml --qhp --docbook --rtf"
345345
RESULT_VARIABLE result
346346
)
347347
if (NOT result EQUAL 0)

testing/runtests.py

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ def prepare_test(self):
161161
print('DOCBOOK_OUTPUT=%s/docbook' % self.test_out, file=f)
162162
else:
163163
print('GENERATE_DOCBOOK=NO', file=f)
164-
if (self.args.xhtml):
164+
if (self.args.qhp):
165+
print('GENERATE_QHP=YES', file=f)
166+
if (self.args.xhtml or self.args.qhp):
165167
print('GENERATE_HTML=YES', file=f)
166168
# HTML_OUTPUT can also have been set locally
167169
print('HTML_OUTPUT=%s/html' % self.test_out, file=f)
@@ -275,6 +277,7 @@ def perform_test(self,testmgr):
275277

276278
failed_xml=False
277279
failed_html=False
280+
failed_qhp=False
278281
failed_latex=False
279282
failed_docbook=False
280283
failed_rtf=False
@@ -443,7 +446,7 @@ def perform_test(self,testmgr):
443446
elif not self.args.keep:
444447
shutil.rmtree(docbook_output,ignore_errors=True)
445448

446-
if (self.args.xhtml):
449+
if (self.args.xhtml or self.args.qhp):
447450
html_output='%s/html' % self.test_out
448451
if (sys.platform == 'win32'):
449452
redirx=' 2> %s/temp >nul:'%html_output
@@ -462,10 +465,23 @@ def perform_test(self,testmgr):
462465
xmllint_out = self.cleanup_xmllint(xmllint_out)
463466
if xmllint_out:
464467
xmllint_out = clean_header(xmllint_out)
465-
if xmllint_out:
466-
msg += (xmllint_out,)
467-
failed_html=True
468-
elif not self.args.keep:
468+
if xmllint_out:
469+
msg += (xmllint_out,)
470+
failed_html=True
471+
472+
failed_qhp=False
473+
if not failed_html:
474+
check_file = "%s/index.qhp"%(html_output)
475+
exe_string = '%s --noout %s' % (self.args.xmllint,check_file)
476+
exe_string1 = exe_string
477+
exe_string += ' %s' % (redirx)
478+
exe_string += ' %s more "%s/temp"' % (separ,html_output)
479+
xmllint_out = xpopen(exe_string,exe_string1,getStderr=True)
480+
xmllint_out = self.cleanup_xmllint(xmllint_out)
481+
if xmllint_out:
482+
msg += (xmllint_out,)
483+
failed_qhp=True
484+
if not failed_html and not failed_qhp and not self.args.keep:
469485
shutil.rmtree(html_output,ignore_errors=True)
470486
if (self.args.pdf):
471487
failed_latex=False
@@ -508,7 +524,7 @@ def perform_test(self,testmgr):
508524
if failed_warn:
509525
msg += (warnings,)
510526

511-
if failed_warn or failed_xml or failed_html or failed_latex or failed_docbook or failed_rtf or failed_xmlxsd:
527+
if failed_warn or failed_xml or failed_html or failed_qhp or failed_latex or failed_docbook or failed_rtf or failed_xmlxsd:
512528
testmgr.ok(False,self.test_name,msg)
513529
return False
514530

@@ -534,7 +550,7 @@ def __init__(self,args,tests):
534550
self.num_tests = len(tests)
535551
self.count=1
536552
self.passed=0
537-
if self.args.xhtml:
553+
if (self.args.xhtml or self.args.qhp):
538554
self.prepare_dtd()
539555
print('1..%d' % self.num_tests)
540556

@@ -573,7 +589,7 @@ def perform_tests(self):
573589
passed = p.map(do_generation_work, dl)
574590
self.passed = sum(passed)
575591
res=self.result()
576-
if self.args.xhtml and self.args.inputdir!='.' and not res and not self.args.keep:
592+
if (self.args.xhtml or self.args.qhp) and self.args.inputdir!='.' and not res and not self.args.keep:
577593
shutil.rmtree("dtd",ignore_errors=True)
578594
return 0 if self.args.updateref else res
579595

@@ -627,6 +643,8 @@ def main():
627643
'create docbook output and check with xmllint',action="store_true")
628644
parser.add_argument('--xhtml',help=
629645
'create xhtml output and check with xmllint',action="store_true")
646+
parser.add_argument('--qhp',help=
647+
'create qhp output and check with xmllint',action="store_true")
630648
parser.add_argument('--xmlxsd',help=
631649
'create xml output and check with xmllint against xsd',action="store_true")
632650
parser.add_argument('--pdf',help='create LaTeX output and create pdf from it',
@@ -647,7 +665,7 @@ def main():
647665
args = parser.parse_args(test_flags + sys.argv[1:])
648666

649667
# sanity check
650-
if (not args.xml) and (not args.pdf) and (not args.xhtml) and (not args.docbook and (not args.rtf) and (not args.xmlxsd)):
668+
if (not args.xml) and (not args.pdf) and (not args.xhtml) and (not args.qhp) and (not args.docbook and (not args.rtf) and (not args.xmlxsd)):
651669
args.xml=True
652670
if (not args.updateref is None) and (args.ids is None) and (args.all is None):
653671
parser.error('--updateref requires either --id or --all')

0 commit comments

Comments
 (0)