From 0c7f06137add31f598d01ba7de468d97a04719af Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 2 Feb 2022 15:57:49 +0100 Subject: [PATCH] CMake: validate all the test-configurations as well --- CHANGES-3.3 | 7 +++++++ src/modules/CMakeLists.txt | 29 +++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/CHANGES-3.3 b/CHANGES-3.3 index 79957dec9..f02f5cd81 100644 --- a/CHANGES-3.3 +++ b/CHANGES-3.3 @@ -13,6 +13,11 @@ This release contains contributions from (alphabetically by first name): - Evan James - Vitor Lopes +This is a "minor" version change, but the size of the changes is very +large. Configuration files from previous versions of Calamares will +**certainly** need to be re-validated. Take heed of the many changes +in the *Modules* heading, below. + ## Core ## - CMake 3.16, Qt 5.15 are now required; the newer CMake is to support new features (also for KDE Frameworks), Qt is the current LTS version. @@ -27,5 +32,7 @@ This release contains contributions from (alphabetically by first name): Boost::Python now requires 1.67 or later (for CMake support). ## Modules ## + - *grubcfg* changed the key *keepDistributor* to *keep_distributor*. + Please update configurations. - *bootloader* now supports more options when building the kernel command-line. (Thanks Evan) diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt index 03384105e..dfb99a068 100644 --- a/src/modules/CMakeLists.txt +++ b/src/modules/CMakeLists.txt @@ -32,12 +32,29 @@ if ( BUILD_TESTING AND BUILD_SCHEMA_TESTING AND PYTHONINTERP_FOUND AND PYTHON_EX # 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}" - ) + # Collect config files from the module-directory and from a tests/ subdir, + # using the same mechanism to find those test-config-files as function + # calamares_add_module_subdirectory() would do. + set( _conf_files "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${SUBDIRECTORY}.conf" ) + set( _count 1 ) + set( _testdir "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/tests" ) + while ( EXISTS "${_testdir}/${_count}.global" OR EXISTS "${_testdir}/${_count}.job" ) + if ( EXISTS "${_testdir}/${_count}.job" ) + list( APPEND _conf_files "${_testdir}/${_count}.job" ) + endif() + math( EXPR _count "${_count} + 1" ) + endwhile() + + if ( EXISTS "${_schema_file}" ) + foreach( _conf_file ${_conf_files} ) + if ( EXISTS ${_conf_file} ) + get_filename_component( _conf_base "${_conf_file}" NAME_WE ) + add_test( + NAME validate-${SUBDIRECTORY}-${_conf_base} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" "${_schema_file}" "${_conf_file}" + ) + endif() + endforeach() endif() endforeach() endif()