From 715226aa7c0827cb24cb91d45ac2c3077bf97e2d Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9dric=20Aguerre?= Date: Wed, 19 Jul 2017 15:51:58 +0200 Subject: [PATCH] Testing when calling salome shell inside ctest --- CTestTestfileInstall.cmake.in | 4 +-- bin/appliskel/tests/CMakeLists.txt | 3 +- bin/appliskel/tests/salomeTest/CMakeLists.txt | 31 ++++++++++++++++ .../salomeTest/CTestTestfileInstall.cmake | 36 +++++++++++++++++++ bin/appliskel/tests/salomeTest/salome_test.py | 32 +++++++++++++++++ bin/appliskel/tests/salomeTest/salome_test.sh | 27 ++++++++++++++ .../tests/salomeTest/salome_test_in_shell.sh | 28 +++++++++++++++ 7 files changed, 158 insertions(+), 3 deletions(-) create mode 100644 bin/appliskel/tests/salomeTest/CMakeLists.txt create mode 100644 bin/appliskel/tests/salomeTest/CTestTestfileInstall.cmake create mode 100644 bin/appliskel/tests/salomeTest/salome_test.py create mode 100644 bin/appliskel/tests/salomeTest/salome_test.sh create mode 100644 bin/appliskel/tests/salomeTest/salome_test_in_shell.sh diff --git a/CTestTestfileInstall.cmake.in b/CTestTestfileInstall.cmake.in index 254fb82f1..753228053 100644 --- a/CTestTestfileInstall.cmake.in +++ b/CTestTestfileInstall.cmake.in @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2016 CEA/DEN, EDF R&D +# Copyright (C) 2015-2017 CEA/DEN, EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -17,7 +17,6 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#SET(SALOME_TEST_DRIVER "$ENV{ABSOLUTE_APPLI_PATH}/bin/salome/appliskel/salome_test_driver.py") SET(SALOME_TEST_DRIVER "@CMAKE_INSTALL_PREFIX@/bin/salome/appliskel/salome_test_driver.py") SET(COMPONENT_NAME KERNEL) @@ -42,4 +41,5 @@ SUBDIRS( Launcher salomeInstance salomeCommand concurrentSession + salomeTest ) diff --git a/bin/appliskel/tests/CMakeLists.txt b/bin/appliskel/tests/CMakeLists.txt index dd4c93082..da311738a 100644 --- a/bin/appliskel/tests/CMakeLists.txt +++ b/bin/appliskel/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2013-2016 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2013-2017 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -20,3 +20,4 @@ ADD_SUBDIRECTORY(concurrentSession) ADD_SUBDIRECTORY(salomeInstance) ADD_SUBDIRECTORY(salomeCommand) +ADD_SUBDIRECTORY(salomeTest) diff --git a/bin/appliskel/tests/salomeTest/CMakeLists.txt b/bin/appliskel/tests/salomeTest/CMakeLists.txt new file mode 100644 index 000000000..da05dd540 --- /dev/null +++ b/bin/appliskel/tests/salomeTest/CMakeLists.txt @@ -0,0 +1,31 @@ +# Copyright (C) 2017 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +FILE(GLOB py_scripts "${CMAKE_CURRENT_SOURCE_DIR}/*.py") +FILE(GLOB sh_scripts "${CMAKE_CURRENT_SOURCE_DIR}/*.sh") +LIST(APPEND scripts ${py_scripts}) +LIST(APPEND scripts ${sh_scripts}) + +# Application tests +INSTALL(FILES CTestTestfileInstall.cmake + DESTINATION ${KERNEL_TEST_DIR}/salomeTest + RENAME CTestTestfile.cmake) + +INSTALL(FILES ${scripts} + DESTINATION ${KERNEL_TEST_DIR}/salomeTest) diff --git a/bin/appliskel/tests/salomeTest/CTestTestfileInstall.cmake b/bin/appliskel/tests/salomeTest/CTestTestfileInstall.cmake new file mode 100644 index 000000000..c4df885bb --- /dev/null +++ b/bin/appliskel/tests/salomeTest/CTestTestfileInstall.cmake @@ -0,0 +1,36 @@ +# Copyright (C) 2017 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +SET(tname salome_test) + +SET(TEST_NAME ${COMPONENT_NAME}_SALOME_TEST_${tname}_bash) +ADD_TEST(${TEST_NAME} bash ${tname}.sh) +SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}" TIMEOUT ${TIMEOUT} WILL_FAIL ON) + +SET(TEST_NAME ${COMPONENT_NAME}_SALOME_TEST_${tname}_shell) +ADD_TEST(${TEST_NAME} bash ${tname}_in_shell.sh) +SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}" TIMEOUT ${TIMEOUT} WILL_FAIL ON) + +SET(TEST_NAME ${COMPONENT_NAME}_SALOME_TEST_${tname}_py) +ADD_TEST(${TEST_NAME} python ${tname}.py) +SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}" TIMEOUT ${TIMEOUT} WILL_FAIL ON) + +SET(TEST_NAME ${COMPONENT_NAME}_SALOME_TEST_${tname}_driver) +ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ${tname}.py) +SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}" TIMEOUT ${TIMEOUT} WILL_FAIL ON) diff --git a/bin/appliskel/tests/salomeTest/salome_test.py b/bin/appliskel/tests/salomeTest/salome_test.py new file mode 100644 index 000000000..6119509e7 --- /dev/null +++ b/bin/appliskel/tests/salomeTest/salome_test.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# Copyright (C) 2017 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +import unittest + +class TestSalomeTest(unittest.TestCase): + + def testMustPass(self): + assert(True) + + def testMustFail(self): + assert(False) + +if __name__ == "__main__": + unittest.main() diff --git a/bin/appliskel/tests/salomeTest/salome_test.sh b/bin/appliskel/tests/salomeTest/salome_test.sh new file mode 100644 index 000000000..cba080ae8 --- /dev/null +++ b/bin/appliskel/tests/salomeTest/salome_test.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# Copyright (C) 2017 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +set -e # fail when any subcommand fails + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done +CALLDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + +python ${CALLDIR}/salome_test.py diff --git a/bin/appliskel/tests/salomeTest/salome_test_in_shell.sh b/bin/appliskel/tests/salomeTest/salome_test_in_shell.sh new file mode 100644 index 000000000..fd00f8b76 --- /dev/null +++ b/bin/appliskel/tests/salomeTest/salome_test_in_shell.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Copyright (C) 2017 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +set -e # fail when any subcommand fails + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done +CALLDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + +echo ABSOLUTE_APPLI_PATH: $ABSOLUTE_APPLI_PATH +$ABSOLUTE_APPLI_PATH/salome shell -- python ${CALLDIR}/salome_test.py -- 2.39.2