CI: add a BUILD_SCHEMA_TESTING
- ON by default, so if tests are built and the script works, those tests will run as well. - Check that the script works by invoking it once.
This commit is contained in:
parent
f2a8f0fcdd
commit
635f53a804
@ -33,6 +33,7 @@
|
|||||||
# - PYTHONQT # TODO:3.3: remove
|
# - PYTHONQT # TODO:3.3: remove
|
||||||
# BUILD_<foo> : choose additional things to build
|
# BUILD_<foo> : choose additional things to build
|
||||||
# - TESTING (standard CMake option)
|
# - TESTING (standard CMake option)
|
||||||
|
# - SCHEMA_TESTING (requires Python, see ci/configvalidator.py)
|
||||||
# DEBUG_<foo> : special developer flags for debugging
|
# DEBUG_<foo> : special developer flags for debugging
|
||||||
#
|
#
|
||||||
# Example usage:
|
# Example usage:
|
||||||
@ -63,6 +64,10 @@ option( WITH_KF5DBus "Use DBus service for unique-application." OFF ) # TODO:3.
|
|||||||
option( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON )
|
option( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON )
|
||||||
option( WITH_PYTHONQT "Enable Python view modules API (deprecated, requires PythonQt)." OFF ) # TODO:3.3: remove
|
option( WITH_PYTHONQT "Enable Python view modules API (deprecated, requires PythonQt)." OFF ) # TODO:3.3: remove
|
||||||
option( WITH_QML "Enable QML UI options." ON )
|
option( WITH_QML "Enable QML UI options." ON )
|
||||||
|
#
|
||||||
|
# Additional parts to build
|
||||||
|
option( BUILD_SCHEMA_TESTING "Enable schema-validation-tests" ON )
|
||||||
|
|
||||||
|
|
||||||
# Possible debugging flags are:
|
# Possible debugging flags are:
|
||||||
# - DEBUG_TIMEZONES draws latitude and longitude lines on the timezone
|
# - DEBUG_TIMEZONES draws latitude and longitude lines on the timezone
|
||||||
@ -337,6 +342,20 @@ set_package_properties(
|
|||||||
)
|
)
|
||||||
if ( PYTHONINTERP_FOUND )
|
if ( PYTHONINTERP_FOUND )
|
||||||
message(STATUS "Found Python 3 interpreter ${PYTHON_EXECUTABLE}")
|
message(STATUS "Found Python 3 interpreter ${PYTHON_EXECUTABLE}")
|
||||||
|
if ( BUILD_SCHEMA_TESTING )
|
||||||
|
# The configuration validator script has some dependencies,
|
||||||
|
# and if they are not installed, don't run. If errors out
|
||||||
|
# with exit(1) on missing dependencies.
|
||||||
|
exec_program( ${PYTHON_EXECUTABLE} ARGS "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" -x RETURN_VALUE _validator_deps )
|
||||||
|
# It should never succeed, but only returns 1 when the imports fail
|
||||||
|
if ( _validator_deps EQUAL 1 )
|
||||||
|
message(STATUS "BUILD_SCHEMA_TESTING dependencies are missing." )
|
||||||
|
set( BUILD_SCHEMA_TESTING OFF )
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
# Can't run schema tests without Python3.
|
||||||
|
set( BUILD_SCHEMA_TESTING OFF )
|
||||||
endif()
|
endif()
|
||||||
find_package( PythonLibs ${PYTHONLIBS_VERSION} )
|
find_package( PythonLibs ${PYTHONLIBS_VERSION} )
|
||||||
set_package_properties(
|
set_package_properties(
|
||||||
|
@ -14,6 +14,15 @@ JSON-representable, anyway.
|
|||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
configvalidator.py <schema> <file> ...
|
configvalidator.py <schema> <file> ...
|
||||||
|
configvalidator.py -x
|
||||||
|
|
||||||
|
Exits with value 0 on success, otherwise:
|
||||||
|
1 on missing dependencies
|
||||||
|
2 on invalid command-line arguments
|
||||||
|
3 on missing files
|
||||||
|
4 if files have invalid syntax
|
||||||
|
5 if files fail to validate
|
||||||
|
Use -x as only command-line argument to check the imports only.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# The schemata originally lived outside the Calamares repository,
|
# The schemata originally lived outside the Calamares repository,
|
||||||
@ -50,6 +59,9 @@ import sys
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
if len(sys.argv) < 3:
|
if len(sys.argv) < 3:
|
||||||
|
# Special-case: called with -x to just test the imports
|
||||||
|
if len(sys.argv) == 2 and sys.argv[1] == "-x":
|
||||||
|
exit(0)
|
||||||
print(usage)
|
print(usage)
|
||||||
exit(ERR_USAGE)
|
exit(ERR_USAGE)
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ include( CalamaresAddTranslations )
|
|||||||
add_calamares_python_translations( ${CALAMARES_TRANSLATION_LANGUAGES} )
|
add_calamares_python_translations( ${CALAMARES_TRANSLATION_LANGUAGES} )
|
||||||
|
|
||||||
# TODO:3.3: Use FindPython3
|
# TODO:3.3: Use FindPython3
|
||||||
if ( BUILD_TESTING AND PYTHONINTERP_FOUND AND PYTHON_EXECUTABLE )
|
if ( BUILD_TESTING AND BUILD_SCHEMA_TESTING AND PYTHONINTERP_FOUND AND PYTHON_EXECUTABLE )
|
||||||
# The tests for each config file are independent of whether the
|
# The tests for each config file are independent of whether the
|
||||||
# module is enabled or not: the config file should match its schema
|
# module is enabled or not: the config file should match its schema
|
||||||
# regardless.
|
# regardless.
|
||||||
|
Loading…
Reference in New Issue
Block a user