2020-08-25 16:05:56 +02:00
|
|
|
# === This file is part of Calamares - <https://calamares.io> ===
|
2020-08-26 00:24:52 +02:00
|
|
|
#
|
|
|
|
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
|
|
|
# SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
#
|
|
|
|
|
2017-12-24 22:08:48 +01:00
|
|
|
# The variable SKIP_MODULES can be set to skip particular modules;
|
|
|
|
# individual modules can also decide they must be skipped (e.g. OS-specific
|
|
|
|
# modules, or ones with unmet dependencies). Collect the skipped modules
|
|
|
|
# in this list.
|
2022-02-08 16:18:47 +01:00
|
|
|
set(LIST_SKIPPED_MODULES "")
|
2017-12-24 22:08:48 +01:00
|
|
|
|
2019-05-07 13:47:24 +02:00
|
|
|
include_directories(
|
|
|
|
${CMAKE_SOURCE_DIR}/src/libcalamares
|
|
|
|
${CMAKE_BINARY_DIR}/src/libcalamares
|
|
|
|
${CMAKE_SOURCE_DIR}/src/libcalamaresui
|
|
|
|
)
|
|
|
|
|
2022-02-08 16:18:47 +01:00
|
|
|
string(REPLACE " " ";" SKIP_LIST "${SKIP_MODULES}")
|
2018-01-24 10:29:06 +01:00
|
|
|
|
2022-02-08 16:18:47 +01:00
|
|
|
file(GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*")
|
|
|
|
list(SORT SUBDIRECTORIES)
|
2018-01-24 10:29:06 +01:00
|
|
|
|
2022-02-08 16:18:47 +01:00
|
|
|
foreach(SUBDIRECTORY ${SUBDIRECTORIES})
|
2021-03-22 15:55:30 +01:00
|
|
|
calamares_add_module_subdirectory( ${SUBDIRECTORY} LIST_SKIPPED_MODULES )
|
2018-06-26 11:33:01 +02:00
|
|
|
endforeach()
|
|
|
|
|
2022-04-27 16:57:18 +02:00
|
|
|
if(BUILD_TESTING AND BUILD_SCHEMA_TESTING AND Python_Interpreter_FOUND)
|
2020-06-16 14:38:13 +02:00
|
|
|
# The tests for each config file are independent of whether the
|
|
|
|
# module is enabled or not: the config file should match its schema
|
|
|
|
# regardless.
|
2022-02-08 16:18:47 +01:00
|
|
|
foreach(SUBDIRECTORY ${SUBDIRECTORIES})
|
|
|
|
set(_schema_file "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${SUBDIRECTORY}.schema.yaml")
|
2022-02-02 15:57:49 +01:00
|
|
|
# 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.
|
2022-02-08 16:18:47 +01:00
|
|
|
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")
|
2022-02-02 15:57:49 +01:00
|
|
|
endif()
|
2022-02-08 16:18:47 +01:00
|
|
|
math(EXPR _count "${_count} + 1")
|
2022-02-02 15:57:49 +01:00
|
|
|
endwhile()
|
|
|
|
|
2022-02-08 16:18:47 +01:00
|
|
|
if(EXISTS "${_schema_file}")
|
|
|
|
foreach(_conf_file ${_conf_files})
|
|
|
|
if(EXISTS ${_conf_file})
|
|
|
|
get_filename_component(_conf_base "${_conf_file}" NAME_WE)
|
2022-02-02 15:57:49 +01:00
|
|
|
add_test(
|
|
|
|
NAME validate-${SUBDIRECTORY}-${_conf_base}
|
2022-02-08 16:18:47 +01:00
|
|
|
COMMAND
|
2022-04-27 16:57:18 +02:00
|
|
|
${Python_EXECUTABLE} "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" "${_schema_file}"
|
2022-02-08 16:18:47 +01:00
|
|
|
"${_conf_file}"
|
2022-02-02 15:57:49 +01:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endforeach()
|
2020-06-16 14:38:13 +02:00
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endif()
|