From 4a7a9ec32d6fcb4de890acccd13d5ba2a4eeaf15 Mon Sep 17 00:00:00 2001 From: Martchus Date: Tue, 11 Oct 2022 19:25:17 +0200 Subject: [PATCH] Add build system check to validate appstream files * Exclude new tests from `check` target for now as they are currently failing * See https://github.com/Martchus/syncthingtray/issues/158 --- cmake/modules/AppUtilities.cmake | 8 ++++++++ cmake/modules/BasicConfig.cmake | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cmake/modules/AppUtilities.cmake b/cmake/modules/AppUtilities.cmake index 3077f98..d6a1fc0 100644 --- a/cmake/modules/AppUtilities.cmake +++ b/cmake/modules/AppUtilities.cmake @@ -72,6 +72,14 @@ function (add_appstream_file) FILES "${APPSTREAM_FILE}" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo" COMPONENT appimage) + + # add test + find_program(APPSTREAMCLI_BIN "appstreamcli") + if (NOT APPSTREAMCLI_BIN) + message(STATUS "Could not find appstreamcli; won't add test/target to validate appstream files") + else () + add_test(NAME "${META_TARGET_NAME}_appstream_validation" COMMAND "${APPSTREAMCLI_BIN}" validate "${APPSTREAM_FILE}") + endif () endfunction () # define function to add *.desktop file and meta info from project meta data diff --git a/cmake/modules/BasicConfig.cmake b/cmake/modules/BasicConfig.cmake index 5e8a1ff..5de5f29 100644 --- a/cmake/modules/BasicConfig.cmake +++ b/cmake/modules/BasicConfig.cmake @@ -503,7 +503,7 @@ endif () # add autotools-style check target if (NOT TARGET check) - set(CMAKE_CTEST_COMMAND ${CMAKE_CTEST_COMMAND} -V) + set(CMAKE_CTEST_COMMAND ${CMAKE_CTEST_COMMAND} -V -E ".*appstream.*") add_custom_target( check COMMAND ${CMAKE_CTEST_COMMAND}