From 28bd7370620ecf1d8ad6869df3149af63f3fa486 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 29 Nov 2021 14:44:49 +0100 Subject: [PATCH] [packages] Validate test-configs, too - The config-files has a typo, so didn't validate, so the loaded data was wrong, leading to test-failures. See 61e0d538e9f0b83f66b11f3c63d55b8495eb8ac2 . --- src/modules/packages/tests/CMakeTests.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/modules/packages/tests/CMakeTests.txt b/src/modules/packages/tests/CMakeTests.txt index 9ee9c6682..4f7d6185f 100644 --- a/src/modules/packages/tests/CMakeTests.txt +++ b/src/modules/packages/tests/CMakeTests.txt @@ -22,3 +22,21 @@ add_test( COMMAND env PYTHONPATH=.: python3 ${CMAKE_CURRENT_LIST_DIR}/test-pm-${_pm}.py ${CMAKE_CURRENT_LIST_DIR}/pm-pacman-2.yaml 3 0 0 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) + +if ( BUILD_TESTING AND BUILD_SCHEMA_TESTING AND PYTHONINTERP_FOUND AND PYTHON_EXECUTABLE ) + set( _module packages ) + set( _schema_file "${CMAKE_CURRENT_SOURCE_DIR}/${_module}/${_module}.schema.yaml" ) + message(STATUS "Schema ${_schema_file}") + foreach( _cf pm-pacman-1.yaml pm-pacman-2.yaml ) + set( _conf_file "${CMAKE_CURRENT_SOURCE_DIR}/${_module}/tests/${_cf}" ) + if ( EXISTS "${_schema_file}" AND EXISTS "${_conf_file}" ) + add_test( + NAME validate-packages-${_cf} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" "${_schema_file}" "${_conf_file}" + ) + else() + message(FATAL_ERROR "Missing ${_conf_file}") + endif() + endforeach() +endif() +