-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SofaFramework] Create Sofa.Testing module #1834
Merged
epernod
merged 19 commits into
sofa-framework:master
from
fredroy:create_sofa_testing_one
Mar 17, 2021
Merged
Changes from 11 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
017b4a3
add stub
fredroy 8e1f4ae
move gtest and sofagtestmain
fredroy 681a6f0
update cmakelists
fredroy 7946341
move testing files from Helper
fredroy 5ad1262
clean, change namespace
fredroy 4afc6bb
add compat
fredroy f85368a
move BaseSimulationTest from SimulationGraph
fredroy 1c01637
add compat for BAseSimuTest + expand cmake files
fredroy c9ef53e
make it compile
fredroy 545bcab
fix plugins
fredroy 24d6f1b
remove trace of gtest in helper
fredroy a3be118
Merge branch 'master' into create_sofa_testing_one
fredroy c39838d
Merge branch 'master' into create_sofa_testing_one
fredroy be274f3
fix cmake files for install
fredroy ef46195
change py3 pointer
fredroy a0120df
update regression git pointer
fredroy cb3faca
Apply suggestions from code review
fredroy d8693cd
remove (temporarily) the sofa_test cmake
fredroy 55efcec
Merge branch 'master' into create_sofa_testing_one
fredroy File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
cmake_minimum_required(VERSION 3.12) | ||
project(Sofa.Testing LANGUAGES CXX) | ||
|
||
# Enable testing features of cmake, like the add_test() command. | ||
enable_testing() | ||
|
||
# add gtest library | ||
add_subdirectory(extlibs/gtest) | ||
# add custom gtest main | ||
add_subdirectory(SofaGTestMain) | ||
|
||
set(SOFATESTINGSRC_ROOT "src/sofa/testing") | ||
|
||
set(HEADER_FILES | ||
${SOFATESTINGSRC_ROOT}/config.h.in | ||
${SOFATESTINGSRC_ROOT}/initSofa.Testing.h | ||
${SOFATESTINGSRC_ROOT}/BaseTest.h | ||
${SOFATESTINGSRC_ROOT}/NumericTest.h | ||
${SOFATESTINGSRC_ROOT}/TestMessageHandler.h | ||
${SOFATESTINGSRC_ROOT}/BaseSimulationTest.h | ||
) | ||
|
||
set(SOURCE_FILES | ||
${SOFATESTINGSRC_ROOT}/initSofa.Testing.cpp | ||
${SOFATESTINGSRC_ROOT}/BaseTest.cpp | ||
${SOFATESTINGSRC_ROOT}/NumericTest.cpp | ||
${SOFATESTINGSRC_ROOT}/TestMessageHandler.cpp | ||
${SOFATESTINGSRC_ROOT}/BaseSimulationTest.cpp | ||
) | ||
|
||
|
||
# Compatibility files | ||
set (COMPATSRC_ROOT "compat/") | ||
set (COMPAT_HEADER_FILES | ||
${COMPATSRC_ROOT}/sofa/helper/testing/BaseTest.h | ||
${COMPATSRC_ROOT}/sofa/helper/testing/NumericTest.h | ||
${COMPATSRC_ROOT}/sofa/helper/testing/TestMessageHandler.h | ||
${COMPATSRC_ROOT}/SofaSimulationGraph/testing/BaseSimulationTest.h | ||
) | ||
|
||
find_package(SofaFramework REQUIRED) | ||
find_package(SofaSimulationGraph REQUIRED) | ||
|
||
add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${COMPAT_HEADER_FILES}) | ||
target_link_libraries(${PROJECT_NAME} PUBLIC SofaHelper SofaDefaultType SofaCore gtest SofaGTestMain SofaSimulationGraph) | ||
|
||
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${COMPATSRC_ROOT}>") | ||
source_group("compat" FILES ${COMPAT_HEADER_FILES} ) | ||
|
||
# own include dir, the macro does not handle "independent" package for SofaFramework-style include | ||
# i.e NOT the name of package first (sofa/testing is wanted, instead of Sofa.Testing/) | ||
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include/${PROJECT_NAME}/${PROJECT_NAME}>") | ||
|
||
fredroy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sofa_create_package_with_targets( | ||
PACKAGE_NAME ${PROJECT_NAME} | ||
PACKAGE_VERSION ${Sofa_VERSION} | ||
TARGETS ${PROJECT_NAME} AUTO_SET_TARGET_PROPERTIES | ||
INCLUDE_SOURCE_DIR "src" | ||
INCLUDE_INSTALL_DIR "${PROJECT_NAME}" | ||
RELOCATABLE "plugins" | ||
) | ||
|
||
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Testing) |
14 changes: 14 additions & 0 deletions
14
SofaKernel/modules/Sofa.Testing/Sofa.TestingConfig.cmake.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# CMake package configuration file for the @PROJECT_NAME@ module | ||
|
||
@PACKAGE_GUARD@ | ||
@PACKAGE_INIT@ | ||
|
||
find_package(GTest CONFIG QUIET REQUIRED) | ||
find_package(SofaFramework REQUIRED) | ||
find_package(SofaSimulationGraph REQUIRED) | ||
|
||
if(NOT TARGET @PROJECT_NAME@) | ||
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") | ||
endif() | ||
|
||
check_required_components(@PROJECT_NAME@) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
31 changes: 31 additions & 0 deletions
31
SofaKernel/modules/Sofa.Testing/compat/SofaSimulationGraph/testing/BaseSimulationTest.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/****************************************************************************** | ||
* SOFA, Simulation Open-Framework Architecture * | ||
* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * | ||
* * | ||
* 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, see <http://www.gnu.org/licenses/>. * | ||
******************************************************************************* | ||
* Authors: The SOFA Team and external contributors (see Authors.txt) * | ||
* * | ||
* Contact information: contact@sofa-framework.org * | ||
******************************************************************************/ | ||
#pragma once | ||
|
||
#include <sofa/testing/BaseSimulationTest.h> | ||
|
||
//SOFA_DEPRECATED_HEADER(v21.12, "sofa/testing/BaseSimulationTest.h") | ||
|
||
namespace sofa::helper | ||
{ | ||
namespace testing = sofa::testing; | ||
} |
38 changes: 38 additions & 0 deletions
38
SofaKernel/modules/Sofa.Testing/compat/sofa/helper/testing/BaseTest.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/****************************************************************************** | ||
* SOFA, Simulation Open-Framework Architecture * | ||
* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * | ||
* * | ||
* 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, see <http://www.gnu.org/licenses/>. * | ||
******************************************************************************* | ||
* Authors: The SOFA Team and external contributors (see Authors.txt) * | ||
* * | ||
* Contact information: contact@sofa-framework.org * | ||
******************************************************************************/ | ||
#pragma once | ||
|
||
#include <sofa/testing/BaseTest.h> | ||
|
||
//SOFA_DEPRECATED_HEADER(v21.12, "sofa/testing/BaseTest.h") | ||
|
||
namespace sofa::helper | ||
{ | ||
namespace testing = sofa::testing; | ||
} | ||
|
||
//{ | ||
// const SReal g_minDeltaErrorRatio = sofa::testing::g_minDeltaErrorRatio; | ||
// | ||
// using BaseTest = sofa::testing::BaseTest; | ||
// | ||
//} // namespace sofa::helper::testing |
54 changes: 54 additions & 0 deletions
54
SofaKernel/modules/Sofa.Testing/compat/sofa/helper/testing/NumericTest.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/****************************************************************************** | ||
* SOFA, Simulation Open-Framework Architecture * | ||
* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * | ||
* * | ||
* 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, see <http://www.gnu.org/licenses/>. * | ||
******************************************************************************* | ||
* Authors: The SOFA Team and external contributors (see Authors.txt) * | ||
* * | ||
* Contact information: contact@sofa-framework.org * | ||
******************************************************************************/ | ||
#pragma once | ||
|
||
#include <sofa/testing/NumericTest.h> | ||
|
||
//SOFA_DEPRECATED_HEADER(v21.12, "sofa/testing/NumericTest.h") | ||
|
||
namespace sofa::helper | ||
{ | ||
namespace testing = sofa::testing; | ||
} | ||
|
||
//namespace sofa::helper::testing | ||
//{ | ||
// template <typename _Real = SReal> | ||
// using NumericTest = sofa::testing::NumericTest<_Real>; | ||
// | ||
// template<class Vector, class ReadData> | ||
// void copyFromData(Vector& v, const ReadData& d) | ||
// { | ||
// sofa::testing::copyFromData(v,d); | ||
// } | ||
// | ||
// template<class WriteData, class Vector> | ||
// void copyToData(WriteData& d, const Vector& v) | ||
// { | ||
// sofa::testing::copyToData(v, d); | ||
// } | ||
// | ||
// template<class _DataTypes> | ||
// using data_traits = sofa::testing::data_traits<_DataTypes>; | ||
// | ||
// | ||
//} // namespace sofa::helper::testing |
33 changes: 33 additions & 0 deletions
33
SofaKernel/modules/Sofa.Testing/compat/sofa/helper/testing/TestMessageHandler.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/****************************************************************************** | ||
* SOFA, Simulation Open-Framework Architecture * | ||
* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * | ||
* * | ||
* 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, see <http://www.gnu.org/licenses/>. * | ||
******************************************************************************* | ||
* Authors: The SOFA Team and external contributors (see Authors.txt) * | ||
* * | ||
* Contact information: contact@sofa-framework.org * | ||
******************************************************************************/ | ||
#pragma once | ||
|
||
#include <sofa/testing/TestMessageHandler.h> | ||
|
||
//SOFA_DEPRECATED_HEADER(v21.12, "sofa/testing/TestMessageHandler.h") | ||
|
||
namespace sofa::helper::logging | ||
{ | ||
using sofa::testing::MessageAsTestFailure; | ||
using sofa::testing::IgnoreMessage; | ||
using sofa::testing::MainGtestMessageHandler; | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SofaSimulationGraph_test is missing in tests/CMakeLists.txt though