diff --git a/.gitmodules b/.gitmodules index f59ffda..bcd333f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "external/libcatalogs"] path = external/libcatalogs url = https://hephaistos.lpp.polytechnique.fr/rhodecode/HG_REPOSITORIES/LPP/SciQLOP_Repos/libcatalogs +[submodule "external/pybind11"] + path = external/pybind11 + url = https://github.com/pybind/pybind11 diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d3dddc..318bfcc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,13 @@ if (NOT CatalogueAPI_FOUND) add_subdirectory(external/libcatalogs) endif() +find_package(pybind11 CONFIG QUIET) +if (NOT pybind11_FOUND) + execute_process(COMMAND git submodule init external/pybind11 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + execute_process(COMMAND git submodule update external/pybind11 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + add_subdirectory(external/pybind11) +endif() + add_subdirectory(core) add_subdirectory(gui) add_subdirectory(app) diff --git a/external/pybind11 b/external/pybind11 new file mode 160000 index 0000000..2d0507d --- /dev/null +++ b/external/pybind11 @@ -0,0 +1 @@ +Subproject commit 2d0507db43cd5a117f7843e053b17dffca114107 diff --git a/plugins/amda/CMakeLists.txt b/plugins/amda/CMakeLists.txt index 721c242..99b3c33 100644 --- a/plugins/amda/CMakeLists.txt +++ b/plugins/amda/CMakeLists.txt @@ -12,7 +12,7 @@ set(AMDA_SERVER_TYPE "hybrid;amdatest;localhost" CACHE STRING "List of possible for AMDA server type") set_property(CACHE AMDA_server_type PROPERTY STRINGS ${AMDA_SERVER_TYPE}) -add_definitions(-DSCIQLOP_AMDA_SERVER="{AMDA_server_type}") +add_definitions(-DSCIQLOP_AMDA_SERVER="${AMDA_server_type}") add_definitions(-DQT_PLUGIN) add_definitions(-DSCIQLOP_PLUGIN_JSON_FILE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/resources/amda.json") @@ -38,3 +38,25 @@ declare_test(TestAmdaParser TestAmdaParser tests/TestAmdaParser.cpp "amdaplugin; declare_test(TestAmdaResultParser TestAmdaResultParser tests/TestAmdaResultParser.cpp "amdaplugin;Qt5::Test") declare_test(TestAmdaAcquisition TestAmdaAcquisition tests/TestAmdaAcquisition.cpp "amdaplugin;Qt5::Test") declare_test(TestAmdaFuzzing TestAmdaFuzzing "tests/TestAmdaFuzzing.cpp;tests/FuzzingValidators.cpp;tests/FuzzingUtils.cpp;tests/FuzzingOperations.cpp;tests/FuzzingDefs.cpp" "amdaplugin;Qt5::Test") + +pybind11_add_module(pytestamda tests/PyTestAmdaWrapper.cpp) +target_link_libraries(pytestamda PUBLIC amdaplugin) + +#pybind11_add_module(pytestamdalib SHARED tests/PyTestAmdaWrapper.cpp) +add_library(pytestamdalib tests/PyTestAmdaWrapper.cpp) +target_link_libraries(pytestamdalib PUBLIC pybind11::module) +target_link_libraries(pytestamdalib PUBLIC pybind11::embed) +target_link_libraries(pytestamdalib PUBLIC amdaplugin) + +declare_test(TestPytestamda TestPytestamda "tests/PyTestAmdaWrapperExe.cpp" "amdaplugin;pytestamdalib") +target_compile_definitions(TestPytestamda PRIVATE -DPYTESTAMDA_SCRIPT="${CMAKE_CURRENT_LIST_DIR}/tests/pyamdatests.py") + +find_package(PythonInterp 3 REQUIRED) + +add_test(NAME pyamdatests + COMMAND ${PYTHON_EXECUTABLE} + ${CMAKE_CURRENT_LIST_DIR}/tests/pyamdatests.py + pyamdatests) + +set_tests_properties(pyamdatests PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}) + diff --git a/plugins/amda/tests/PyTestAmdaWrapper.cpp b/plugins/amda/tests/PyTestAmdaWrapper.cpp new file mode 100644 index 0000000..1b6284d --- /dev/null +++ b/plugins/amda/tests/PyTestAmdaWrapper.cpp @@ -0,0 +1,164 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SciQLOP Software +-- Copyright (C) 2018, Plasma Physics Laboratory - CNRS +-- +-- 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, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ +#include +#include +#include + +#include +#include +#include + +#include +#include +#include