forked from sofa-framework/sofa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SofaFramework] Create Sofa.Testing module (sofa-framework#1834)
* add stub * move gtest and sofagtestmain * update cmakelists * move testing files from Helper * clean, change namespace * add compat * move BaseSimulationTest from SimulationGraph * add compat for BAseSimuTest + expand cmake files * make it compile * fix plugins * remove trace of gtest in helper * fix cmake files for install * change py3 pointer * update regression git pointer * Apply suggestions from code review Co-authored-by: Guillaume Paran <guillaume.paran@sofa-framework.org> * remove (temporarily) the sofa_test cmake Co-authored-by: Guillaume Paran <guillaume.paran@sofa-framework.org>
- Loading branch information
Showing
218 changed files
with
616 additions
and
322 deletions.
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,59 @@ | ||
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}>") | ||
target_include_directories(${PROJECT_NAME} PUBLIC "$<INSTALL_INTERFACE:include/Sofa.Testing/Sofa.Testing/compat>") | ||
source_group("compat" FILES ${COMPAT_HEADER_FILES} ) | ||
|
||
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}" | ||
) | ||
|
||
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Testing) |
15 changes: 15 additions & 0 deletions
15
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,15 @@ | ||
# CMake package configuration file for the @PROJECT_NAME@ module | ||
|
||
@PACKAGE_GUARD@ | ||
@PACKAGE_INIT@ | ||
|
||
find_package(GTest CONFIG QUIET REQUIRED) | ||
find_package(SofaGTestMain QUIET REQUIRED) | ||
find_package(SofaFramework QUIET REQUIRED) | ||
find_package(SofaSimulationGraph QUIET 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.