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
This commit is contained in:
Martchus 2022-10-11 19:25:17 +02:00
parent 0cf59b654b
commit 4a7a9ec32d
2 changed files with 9 additions and 1 deletions

View File

@ -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

View File

@ -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}