diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt index 533c704f8..0b81c4b3f 100644 --- a/src/modules/CMakeLists.txt +++ b/src/modules/CMakeLists.txt @@ -66,3 +66,21 @@ endforeach() include( CalamaresAddTranslations ) add_calamares_python_translations( ${CALAMARES_TRANSLATION_LANGUAGES} ) + +# TODO:3.3: Use FindPython3 +if ( BUILD_TESTING AND PYTHONINTERP_FOUND AND PYTHON_EXECUTABLE ) + # The tests for each config file are independent of whether the + # module is enabled or not: the config file should match its schema + # regardless. + foreach( SUBDIRECTORY ${SUBDIRECTORIES} ) + set( _schema_file "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${SUBDIRECTORY}.schema.yaml" ) + set( _conf_file "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${SUBDIRECTORY}.conf" ) + if ( EXISTS "${_schema_file}" AND EXISTS "${_conf_file}" ) + add_test( + NAME validate-${SUBDIRECTORY} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" "${_schema_file}" "${_conf_file}" + ) + endif() + endforeach() +endif() +