Cmake export xhtml tests: load dtd if checking ouput with xmllint

This commit is contained in:
Kornel Benko 2020-09-20 11:47:04 +02:00
parent b814c4fda7
commit 758775ac92
3 changed files with 44 additions and 28 deletions

View File

@ -12,6 +12,7 @@ my %errors = ();
if (open(FI, $file)) { if (open(FI, $file)) {
my $line = 0; my $line = 0;
my %entities = ();
my $saxchartoprint = 0; my $saxchartoprint = 0;
while(my $l = <FI>) { while(my $l = <FI>) {
$line++; $line++;
@ -66,6 +67,21 @@ if (open(FI, $file)) {
$saxchartoprint = 3; $saxchartoprint = 3;
} }
} }
elsif ($l =~ /: parser error :\s+(.*)$/) {
my $err = $1;
$errors{$err} = $errmsg;
if ($errmsg =~ /Entity\s+'([a-zA-Z0-9]+)'\s+not defined/) {
my $entity = $1;
if (! defined($entities{$entity})) {
$entities{$entity} = 1;
print "$errmsg\n";
}
}
else {
print "$l\n";
die("Unknown error $l");
}
}
elsif ($saxchartoprint > 0) { elsif ($saxchartoprint > 0) {
$saxchartoprint--; $saxchartoprint--;
if ($l =~ /^SAX.characters\(([^\)]+)\)/) { if ($l =~ /^SAX.characters\(([^\)]+)\)/) {
@ -74,4 +90,7 @@ if (open(FI, $file)) {
} }
} }
} }
if (keys %errors) {
exit(1);
}
exit(0); exit(0);

View File

@ -230,7 +230,7 @@ else()
message(STATUS "Expected result file \"${result_file_name}\" exists") message(STATUS "Expected result file \"${result_file_name}\" exists")
if (extension MATCHES "^x(ht)?ml$") if (extension MATCHES "^x(ht)?ml$")
if (format MATCHES "xhtml") if (format MATCHES "xhtml")
set(xmllint_params --sax --html --valid) set(xmllint_params --loaddtd --noout)
set(executable_ ${XMLLINT_EXECUTABLE}) set(executable_ ${XMLLINT_EXECUTABLE})
else() else()
set(xmllint_params) set(xmllint_params)
@ -250,7 +250,8 @@ else()
Summary(_err "Checking \"${result_file_name}\" with xmlParser.pl") Summary(_err "Checking \"${result_file_name}\" with xmlParser.pl")
endif() endif()
if (XMLLINT_EXECUTABLE) if (XMLLINT_EXECUTABLE)
message(STATUS "Calling: " ${executable_} ${xmllint_params} " ${result_file_name}") string(REPLACE ";" " " xmllint_params2 " ${xmllint_params}")
message(STATUS "Calling: " ${executable_} ${xmllint_params2} " ${WORKDIR}/${result_file_name}")
# check the created xhtml file # check the created xhtml file
execute_process( execute_process(
COMMAND ${executable_} ${xmllint_params} "${result_file_name}" COMMAND ${executable_} ${xmllint_params} "${result_file_name}"
@ -260,13 +261,15 @@ else()
file(WRITE "${result_file_name}.sax_out" ${xmlout}) file(WRITE "${result_file_name}.sax_out" ${xmlout})
Summary(_err "Checking \"${result_file_name}\" with ${XMLLINT_EXECUTABLE}") Summary(_err "Checking \"${result_file_name}\" with ${XMLLINT_EXECUTABLE}")
if (NOT _err) if (NOT _err)
# check if sax-parser output contains error messages # check if parser output contains error messages
message(STATUS "Check the output: ${PERL_EXECUTABLE} ${TOP_SRC_DIR}/development/autotests/examineXmllintOutput.pl") message(STATUS "Check the output: ${PERL_EXECUTABLE} ${TOP_SRC_DIR}/development/autotests/examineXmllintOutput.pl")
execute_process( execute_process(
COMMAND ${PERL_EXECUTABLE} "${TOP_SRC_DIR}/development/autotests/examineXmllintOutput.pl" "${result_file_name}.sax_out" COMMAND ${PERL_EXECUTABLE} "${TOP_SRC_DIR}/development/autotests/examineXmllintOutput.pl" "${result_file_name}.sax_out"
OUTPUT_VARIABLE xmlout OUTPUT_VARIABLE xmlout
RESULT_VARIABLE _err) RESULT_VARIABLE _err)
Summary(_err "Parse messages of ${XMLLINT_EXECUTABLE} for errors") Summary(_err "Parse messages of ${XMLLINT_EXECUTABLE} for errors")
else()
message(STATUS "Errors from xmllint: ${xmlerr}")
endif() endif()
if (NOT _err) if (NOT _err)
if (NOT "${xmlout}" STREQUAL "") if (NOT "${xmlout}" STREQUAL "")

View File

@ -116,12 +116,6 @@ export/export/latex/lyxbugs/[0-9].*
# (For some reason, the false positive error is not thrown with PDF (luatex).) # (For some reason, the false positive error is not thrown with PDF (luatex).)
#export/examples/sr/Modules/Braille_(dvi3|pdf4)_systemF #export/examples/sr/Modules/Braille_(dvi3|pdf4)_systemF
#10355 xmllint detects failures
export/doc/attic/eu_UserGuide_xhtml
export/doc/(es|ja)/UserGuide_xhtml
export/examples/External_Material/Spreadsheet_xhtml
export/export/WrongDfnTagHandling_xhtml
#11455 "Unable to process argument!" with multiple 1.6.x roundtrips #11455 "Unable to process argument!" with multiple 1.6.x roundtrips
export/templates/Articles/IEEE_Transactions_Journal_lyx16 export/templates/Articles/IEEE_Transactions_Journal_lyx16