]> git.lyx.org Git - features.git/commitdiff
Cmake xhtml export tests: Use command xmllint to test the export result
authorKornel Benko <kornel@lyx.org>
Mon, 30 May 2016 07:50:22 +0000 (09:50 +0200)
committerKornel Benko <kornel@lyx.org>
Mon, 30 May 2016 07:50:22 +0000 (09:50 +0200)
development/autotests/ExportTests.cmake
development/autotests/export.cmake
development/autotests/ignoredTests

index f448d800ca0ec03c5ba4b49330dfe4fe520832bb..562c639e15847b7804471fe728a18e00ecf3d6b5 100644 (file)
@@ -27,6 +27,7 @@
 #
 
 find_package(Perl)
+find_program(XMLLINT_EXECUTABLE xmllint)
 
 if(PERL_FOUND)
   set(DVI_FORMATS "dvi" "dvi3")
@@ -401,6 +402,7 @@ foreach(libsubfolderx autotests/export lib/doc lib/examples lib/templates autote
             -Dinverted=${inverted}
             -DTOP_SRC_DIR=${TOP_SRC_DIR}
             -DPERL_EXECUTABLE=${PERL_EXECUTABLE}
+            -DXMLLINT_EXECUTABLE=${XMLLINT_EXECUTABLE}
             -P "${TOP_SRC_DIR}/development/autotests/export.cmake")
           setmarkedtestlabel(${TestName} ${mytestlabel}) # check for suspended pdf/dvi exports
         endif()
index 29487d4c6ccdbcedac9f2e148e239aeb9c622270..c89c3f63ff4790bed8d2e8cdb8903a1e81baac09 100755 (executable)
@@ -25,6 +25,7 @@
 #       -Dinverted=[01] \
 #       -DTOP_SRC_DIR=${TOP_SRC_DIR}
 #       -DPERL_EXECUTABLE=${PERL_EXECUTABLE}
+#       -DXMLLINT_EXECUTABLE=${XMLLINT_EXECUTABLE}
 #       -P "${TOP_SRC_DIR}/development/autotests/export.cmake"
 #
 
@@ -138,6 +139,30 @@ else()
       set(_err -1)
     else()
       message(STATUS "Expected result file \"${result_file_name}\" exists")
+      if (format MATCHES "xhtml")
+        if (XMLLINT_EXECUTABLE)
+          # check the created xhtml file
+          execute_process(
+            COMMAND ${XMLLINT_EXECUTABLE} --sax --html --valid  "${result_file_name}"
+            OUTPUT_VARIABLE xmlout
+            ERROR_VARIABLE xmlerr
+            RESULT_VARIABLE _err)
+          file(WRITE "${result_file_name}.sax_out" ${xmlout})
+          if (NOT _err)
+            # check if sax-parser output contains error messages
+            execute_process(
+              COMMAND ${PERL_EXECUTABLE} "${TOP_SRC_DIR}/development/autotests/examineXmllintOutput.pl" "${result_file_name}.sax_out"
+              OUTPUT_VARIABLE xmlout
+              RESULT_VARIABLE _err)
+          endif()
+          if (NOT _err)
+            if (NOT "${xmlout}" STREQUAL "")
+              message(STATUS "${xmlout}")
+              set(_err -1)
+            endif()
+          endif()
+        endif()
+      endif()
     endif()
   endif()
 endif()
index 06e9b482ee01df368457bf1fa494bac56e69e39b..01bd26e04fe569647daf85758bb4e4d5589906f9 100644 (file)
@@ -40,3 +40,7 @@ export/examples/(Literate|noweb2lyx)_lyx16
 # Document class "Docbook article (SGML)" does not work with LaTeX:
 export/examples/docbook_article_(dvi3|pdf[245]).*
 export/templates/DocBook_article_(dvi3|pdf[245]).*
+
+# Ignore MergedManuals_xhtml because the test is very time-consuming
+# and the underlying subdocuments are already tested
+export/doc/(ja/|)MergedManuals_xhtml