QA: Allow to build tests manually if disabled
Add a new CMake target, qa_all, which builds all tests, tools and their deps. Then, when KICAD_BUILD_QA_TESTS is set OFF, remove tests and tools from the ALL target, so `make all` doesn't include these builds. This means even when you turn the KICAD_BUILD_QA_TESTS option off, you still have the option to: * Build individual tests: `make qa_pcbnew` * Build all tests: `make qa_all_tests` * Build all tools: `make qa_all_tools` * Build all QA executables: `make qa_all` This also will provide a place to hang extra logic for test routine wrangling (e.g. by CI tools) Update the "Compiling KiCad" dev docs. Also, CMakeModules .cmake files should not be excluded from git
This commit is contained in:
parent
c1c5afad67
commit
45aa514591
|
@ -76,3 +76,6 @@ demos/**/fp-info-cache
|
||||||
*.gch
|
*.gch
|
||||||
*.orig
|
*.orig
|
||||||
*.patch
|
*.patch
|
||||||
|
|
||||||
|
# These CMake files are wanted
|
||||||
|
!CMakeModules/*.cmake
|
||||||
|
|
|
@ -948,9 +948,7 @@ add_subdirectory( plugins ) # 3D plugins must be built before kicad
|
||||||
add_subdirectory( kicad ) # should follow pcbnew, eeschema
|
add_subdirectory( kicad ) # should follow pcbnew, eeschema
|
||||||
add_subdirectory( tools )
|
add_subdirectory( tools )
|
||||||
add_subdirectory( utils )
|
add_subdirectory( utils )
|
||||||
if( KICAD_BUILD_QA_TESTS )
|
add_subdirectory( qa )
|
||||||
add_subdirectory( qa )
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Resources
|
# Resources
|
||||||
if ( KICAD_INSTALL_DEMOS )
|
if ( KICAD_INSTALL_DEMOS )
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
# This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, you may find one here:
|
||||||
|
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
# or you may search the http://www.gnu.org website for the version 2 license,
|
||||||
|
# or you may write to the Free Software Foundation, Inc.,
|
||||||
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
#
|
||||||
|
# Utility CMake functions and targets for marshalling the builds of QA
|
||||||
|
# tests and tools
|
||||||
|
#
|
||||||
|
|
||||||
|
# This is a "meta" target that is used to collect all tests
|
||||||
|
add_custom_target( qa_all_tests )
|
||||||
|
|
||||||
|
# This is a "meta" target used to collect all utility tools
|
||||||
|
add_custom_target( qa_all_tools )
|
||||||
|
|
||||||
|
# This "meta" target builds all QA tools, utils, etc
|
||||||
|
add_custom_target( qa_all
|
||||||
|
DEPENDS qa_all_tests qa_all_tools
|
||||||
|
)
|
||||||
|
|
||||||
|
# Add a target as a "QA test" executable:
|
||||||
|
# * Added as a CTest test with the given name
|
||||||
|
# * Excluded from ALL when KICAD_BUILD_QA_TESTS not set
|
||||||
|
# * Is a dependency of qa_all_tests
|
||||||
|
function( kicad_add_boost_test TEST_EXEC_TARGET TEST_NAME)
|
||||||
|
|
||||||
|
# Add the test to the CTest registry
|
||||||
|
add_test( NAME ${TEST_NAME}
|
||||||
|
COMMAND $<TARGET_FILE:${TEST_EXEC_TARGET}>
|
||||||
|
)
|
||||||
|
|
||||||
|
# Make the overall test meta-target depend on this test
|
||||||
|
add_dependencies( qa_all_tests ${TEST_EXEC_TARGET} )
|
||||||
|
|
||||||
|
# If tests are not enabled by default, remove from the ALL target
|
||||||
|
# They can still be built manually, or all together with the qa_all_test target
|
||||||
|
if( NOT KICAD_BUILD_QA_TESTS )
|
||||||
|
|
||||||
|
set_target_properties( ${TEST_EXEC_TARGET}
|
||||||
|
PROPERTIES EXCLUDE_FROM_ALL TRUE
|
||||||
|
)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Add a target as a "QA tool" executable:
|
||||||
|
# * Excluded from ALL when KICAD_BUILD_QA_TESTS not set
|
||||||
|
# * Is a dependency of qa_all_tools
|
||||||
|
function( kicad_add_utils_executable TARGET)
|
||||||
|
|
||||||
|
# If tests are not enabled by default, remove from the ALL target
|
||||||
|
# They can still be built manually, or all together with the qa_all_tools
|
||||||
|
if( NOT KICAD_BUILD_QA_TESTS )
|
||||||
|
|
||||||
|
set_target_properties( ${TARGET}
|
||||||
|
PROPERTIES EXCLUDE_FROM_ALL TRUE
|
||||||
|
)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Make the overall test meta-target depend on this test
|
||||||
|
add_dependencies( qa_all_tools ${TARGET} )
|
||||||
|
|
||||||
|
endfunction()
|
|
@ -205,10 +205,18 @@ The KICAD_SCRIPTING_ACTION_MENU option allows Python scripts to be added directl
|
||||||
menu. This option is disabled by default. Please note that this option is highly experimental
|
menu. This option is disabled by default. Please note that this option is highly experimental
|
||||||
and can cause Pcbnew to crash if Python scripts create an invalid object state within Pcbnew.
|
and can cause Pcbnew to crash if Python scripts create an invalid object state within Pcbnew.
|
||||||
|
|
||||||
## Quality assurance (qa) unit tests ## {#quality_assurance_tests_opt}
|
## Quality assurance (QA) unit tests ## {#quality_assurance_tests_opt}
|
||||||
|
|
||||||
The KICAD_BUILD_QA_TESTS option allows building unit tests binaries for quality assurance.
|
The KICAD_BUILD_QA_TESTS option allows building unit tests binaries for quality assurance as part
|
||||||
This option is enabled by default.
|
of the default build. This option is enabled by default.
|
||||||
|
|
||||||
|
If this option is disabled, the QA binaries can still be built by manually specifying the target.
|
||||||
|
For example, with `make`:
|
||||||
|
|
||||||
|
* Build all QA binaries: `make qa_all`
|
||||||
|
* Build a specific test: `make qa_pcbnew`
|
||||||
|
* Build all unit tests: `make qa_all_tests`
|
||||||
|
* Build all test tool binaries: `make qa_all_tools`
|
||||||
|
|
||||||
## KiCad Build Version ## {#build_version_opt}
|
## KiCad Build Version ## {#build_version_opt}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,26 @@
|
||||||
|
# This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2014-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, you may find one here:
|
||||||
|
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
# or you may search the http://www.gnu.org website for the version 2 license,
|
||||||
|
# or you may write to the Free Software Foundation, Inc.,
|
||||||
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
|
include(KiCadQABuildUtils)
|
||||||
|
|
||||||
if( KICAD_SCRIPTING_MODULES )
|
if( KICAD_SCRIPTING_MODULES )
|
||||||
|
|
||||||
# Test that runs the QA tests through scripting
|
# Test that runs the QA tests through scripting
|
||||||
|
|
|
@ -93,14 +93,6 @@ include_directories(
|
||||||
${INC_AFTER}
|
${INC_AFTER}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_test( NAME common_gerbview
|
kicad_add_boost_test( qa_common_eeschema common_eeschema )
|
||||||
COMMAND qa_common_gerbview
|
kicad_add_boost_test( qa_common_pcbnew common_pcbnew )
|
||||||
)
|
kicad_add_boost_test( qa_common_gerbview qa_common_gerbview )
|
||||||
|
|
||||||
add_test( NAME common_pcbnew
|
|
||||||
COMMAND qa_common_pcbnew
|
|
||||||
)
|
|
||||||
|
|
||||||
add_test( NAME common_eeschema
|
|
||||||
COMMAND qa_common_eeschema
|
|
||||||
)
|
|
|
@ -59,3 +59,5 @@ target_link_libraries( qa_common_tools
|
||||||
target_compile_definitions( qa_common_tools
|
target_compile_definitions( qa_common_tools
|
||||||
PRIVATE PCBNEW
|
PRIVATE PCBNEW
|
||||||
)
|
)
|
||||||
|
|
||||||
|
kicad_add_utils_executable( qa_common_tools )
|
|
@ -56,10 +56,6 @@ target_link_libraries( qa_eeschema
|
||||||
${Boost_LIBRARIES}
|
${Boost_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_test( NAME eeschema
|
|
||||||
COMMAND qa_eeschema
|
|
||||||
)
|
|
||||||
|
|
||||||
# Eeschema tests, so pretend to be eeschema (for units, etc)
|
# Eeschema tests, so pretend to be eeschema (for units, etc)
|
||||||
target_compile_definitions( qa_eeschema
|
target_compile_definitions( qa_eeschema
|
||||||
PUBLIC EESCHEMA
|
PUBLIC EESCHEMA
|
||||||
|
@ -69,3 +65,5 @@ target_compile_definitions( qa_eeschema
|
||||||
set_source_files_properties( eeschema_test_utils.cpp PROPERTIES
|
set_source_files_properties( eeschema_test_utils.cpp PROPERTIES
|
||||||
COMPILE_DEFINITIONS "QA_EESCHEMA_DATA_LOCATION=(\"${CMAKE_CURRENT_SOURCE_DIR}/data\")"
|
COMPILE_DEFINITIONS "QA_EESCHEMA_DATA_LOCATION=(\"${CMAKE_CURRENT_SOURCE_DIR}/data\")"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
kicad_add_boost_test( qa_eeschema eeschema )
|
|
@ -79,3 +79,5 @@ target_link_libraries( test_gal_pixel_alignment
|
||||||
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
|
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
|
||||||
${wxWidgets_LIBRARIES}
|
${wxWidgets_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
kicad_add_utils_executable( test_gal_pixel_alignment )
|
|
@ -41,6 +41,4 @@ target_include_directories( qa_sexpr PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_test( NAME sexpr
|
kicad_add_boost_test(qa_sexpr sexpr)
|
||||||
COMMAND qa_sexpr
|
|
||||||
)
|
|
|
@ -76,6 +76,4 @@ target_link_libraries( qa_pcbnew
|
||||||
${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost
|
${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost
|
||||||
)
|
)
|
||||||
|
|
||||||
add_test( NAME pcbnew
|
kicad_add_boost_test( qa_pcbnew pcbnew )
|
||||||
COMMAND qa_pcbnew
|
|
||||||
)
|
|
|
@ -63,3 +63,5 @@ target_link_libraries( qa_pcbnew_tools
|
||||||
${Boost_LIBRARIES} # must follow GITHUB
|
${Boost_LIBRARIES} # must follow GITHUB
|
||||||
${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost
|
${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost
|
||||||
)
|
)
|
||||||
|
|
||||||
|
kicad_add_utils_executable( qa_pcbnew_tools )
|
|
@ -39,6 +39,4 @@ target_include_directories( qa_sexpr PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_test( NAME kicad2step
|
kicad_add_boost_test( qa_kicad2step kicad2step )
|
||||||
COMMAND qa_kicad2step
|
|
||||||
)
|
|
Loading…
Reference in New Issue