From d3deae99b1a446b4dca69ed3f44b7bdcdf64b0f1 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Mon, 11 May 2026 22:30:49 -0700 Subject: [PATCH] Disable schema test if xmllint is too new * Warn when xmllint is not found or version is not detected * Status message if schema test is skipped Signed-off-by: Steve Peters --- test/integration/CMakeLists.txt | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/test/integration/CMakeLists.txt b/test/integration/CMakeLists.txt index 8c3f4ae16..afaa83ad2 100644 --- a/test/integration/CMakeLists.txt +++ b/test/integration/CMakeLists.txt @@ -71,9 +71,33 @@ endif() find_program(XMLLINT_EXE xmllint) if (EXISTS ${XMLLINT_EXE}) - set (tests ${tests} schema_test.cc) + # get xmllint version + execute_process( + COMMAND ${XMLLINT_EXE} --version + ERROR_VARIABLE XMLLINT_VERSION_OUTPUT + ) + # typical output: "/usr/bin/xmllint: using libxml version 20913\ncompiled with: ..." + # version is formatted as a single integer, with 20913 representing 2.9.13 + string(REGEX MATCH "using libxml version [0-9]+" XMLLINT_VERSION_STRING "${XMLLINT_VERSION_OUTPUT}") + string(REPLACE "using libxml version " "" XMLLINT_VERSION "${XMLLINT_VERSION_STRING}") + if("${XMLLINT_VERSION}" STREQUAL "") + message(WARNING "Unable to identify xmllint version. schema_test won't be run") + elseif("${XMLLINT_VERSION}" LESS 10000) + message(WARNING "Old version of xmllint (${XMLLINT_VERSION_STRING}) detected. schema_test won't be run") + elseif("${XMLLINT_VERSION}" LESS 21500) + # schema test is broken with very new versions of xmllint + # https://github.com/gazebosim/sdformat/issues/1656 + # enable schema test if xmllint is older than 2.15.0 + set (tests ${tests} schema_test.cc) + else() + # TODO: convert to WARNING when https://github.com/gazebosim/sdformat/issues/1656 + # is resolved on supported platforms. It currently fails on Ubuntu 26.04 + message(STATUS "WARNING: xmllint version (${XMLLINT_VERSION}) is too new; " + "schema_test won't be run. " + "See https://github.com/gazebosim/sdformat/issues/1656") + endif() else() - gz_build_warning("xmllint not found. schema_test won't be run") + message(WARNING "xmllint not found. schema_test won't be run") endif() gz_build_tests(TYPE ${TEST_TYPE}