2021-11-29 13:04:44 +01:00
|
|
|
# SPDX-FileCopyrightText: no
|
|
|
|
# SPDX-License-Identifier: CC0-1.0
|
|
|
|
#
|
|
|
|
# We have tests to load (some) of the package-managers specifically, to
|
|
|
|
# test their configuration code and implementation. Those tests conventionally
|
|
|
|
# live in Python files here in the tests/ directory. Add them.
|
2021-11-29 13:21:50 +01:00
|
|
|
|
|
|
|
# Pacman (Arch) tests
|
|
|
|
set(_pm pacman)
|
|
|
|
add_test(
|
|
|
|
NAME configure-packages-${_pm}
|
|
|
|
COMMAND env PYTHONPATH=.: python3 ${CMAKE_CURRENT_LIST_DIR}/test-pm-${_pm}.py
|
|
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
|
|
|
)
|
|
|
|
add_test(
|
|
|
|
NAME configure-packages-${_pm}-ops-1
|
2022-02-08 16:18:47 +01:00
|
|
|
COMMAND
|
|
|
|
env PYTHONPATH=.: python3 ${CMAKE_CURRENT_LIST_DIR}/test-pm-${_pm}.py ${CMAKE_CURRENT_LIST_DIR}/pm-pacman-1.yaml
|
|
|
|
4 1 1
|
2021-11-29 13:21:50 +01:00
|
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
|
|
|
)
|
|
|
|
add_test(
|
|
|
|
NAME configure-packages-${_pm}-ops-2
|
2022-02-08 16:18:47 +01:00
|
|
|
COMMAND
|
|
|
|
env PYTHONPATH=.: python3 ${CMAKE_CURRENT_LIST_DIR}/test-pm-${_pm}.py ${CMAKE_CURRENT_LIST_DIR}/pm-pacman-2.yaml
|
|
|
|
3 0 0
|
2021-11-29 13:21:50 +01:00
|
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
|
|
|
)
|
2021-11-29 14:44:49 +01:00
|
|
|
|
2022-02-08 16:18:47 +01:00
|
|
|
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")
|
2021-11-29 14:44:49 +01:00
|
|
|
message(STATUS "Schema ${_schema_file}")
|
2022-02-08 16:18:47 +01:00
|
|
|
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}")
|
2021-11-29 14:44:49 +01:00
|
|
|
add_test(
|
|
|
|
NAME validate-packages-${_cf}
|
2022-02-08 16:18:47 +01:00
|
|
|
COMMAND
|
|
|
|
${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" "${_schema_file}" "${_conf_file}"
|
2021-11-29 14:44:49 +01:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Missing ${_conf_file}")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endif()
|