From b93d46ab10f8588add1a42528d8c103af406d933 Mon Sep 17 00:00:00 2001 From: srn Date: Thu, 9 Mar 2006 12:53:22 +0000 Subject: [PATCH] Added a cppunit test for SalomeApp --- src/Makefile.in | 6 +++ src/SalomeApp/Test/Makefile.in | 65 ++++++++++++++++++++++++++++ src/SalomeApp/Test/SalomeAppTest.cxx | 56 ++++++++++++++++++++++++ src/SalomeApp/Test/SalomeAppTest.hxx | 39 +++++++++++++++++ src/SalomeApp/Test/TestSalomeApp.cxx | 31 +++++++++++++ src/SalomeApp/Test/TestSalomeApp.py | 29 +++++++++++++ 6 files changed, 226 insertions(+) create mode 100644 src/SalomeApp/Test/Makefile.in create mode 100644 src/SalomeApp/Test/SalomeAppTest.cxx create mode 100644 src/SalomeApp/Test/SalomeAppTest.hxx create mode 100644 src/SalomeApp/Test/TestSalomeApp.cxx create mode 100644 src/SalomeApp/Test/TestSalomeApp.py diff --git a/src/Makefile.in b/src/Makefile.in index 861e9d4b9..fe29018cc 100755 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -73,5 +73,11 @@ ifneq ($(GUI_DISABLE_CORBA),yes) Event Session SalomeApp SALOME_SWIG SALOME_PY SALOME_PYQT endif +ifeq (@cppunit_ok@,yes) +ifneq ($(GUI_DISABLE_CORBA),yes) + SUBDIRS+= \ + SalomeApp/Test +endif +endif @MODULE@ diff --git a/src/SalomeApp/Test/Makefile.in b/src/SalomeApp/Test/Makefile.in new file mode 100644 index 000000000..93e6b8dcd --- /dev/null +++ b/src/SalomeApp/Test/Makefile.in @@ -0,0 +1,65 @@ +# SALOMELocalTrace : log on local machine +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# 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. +# +# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# +# +# File : Makefile.in +# Author : Sergey RUIN +# Module : SALOME + +top_srcdir=@top_srcdir@ +top_builddir=../../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# header files +EXPORT_HEADERS= SalomeAppTest.hxx + +EXPORT_PYSCRIPTS = TestSalomeApp.py + +# Libraries targets + +LIB = libSalomeAppTest.la +LIB_SRC = SalomeAppTest.cxx +LIB_CLIENT_IDL = + +# Executables targets + +BIN = TestSalomeApp +BIN_SRC = +BIN_CLIENT_IDL = + + +CXXFLAGS += $ @CPPUNIT_INCLUDES@ -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $ @CPPUNIT_INCLUDES@ -I${KERNEL_ROOT_DIR}/include/salome + +LIBS= @LIBS@ @CPPUNIT_LIBS@ + +LDFLAGS+= + +LDFLAGSFORBIN+= $(LDFLAGS) -lSalomeAppTest + +UNIT_TEST_PROG = TestSalomeApp + +@CONCLUDE@ diff --git a/src/SalomeApp/Test/SalomeAppTest.cxx b/src/SalomeApp/Test/SalomeAppTest.cxx new file mode 100644 index 000000000..f34ab8b32 --- /dev/null +++ b/src/SalomeApp/Test/SalomeAppTest.cxx @@ -0,0 +1,56 @@ +// Copyright (C) 2006 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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. +// +// 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/ +// + +#include "SalomeAppTest.hxx" + +using namespace std; + +// ============================================================================ +/*! + * Set up the environment + */ +// ============================================================================ + +void SalomeAppTest::setUp() +{ +} + +// ============================================================================ +/*! + * - delete + */ +// ============================================================================ + +void SalomeAppTest::tearDown() +{ +} + +// ============================================================================ +/*! + * Check SalomeApp functionality + */ +// ============================================================================ +void SalomeAppTest::testSalomeApp() +{ +} + + + + diff --git a/src/SalomeApp/Test/SalomeAppTest.hxx b/src/SalomeApp/Test/SalomeAppTest.hxx new file mode 100644 index 000000000..0f5a3f959 --- /dev/null +++ b/src/SalomeApp/Test/SalomeAppTest.hxx @@ -0,0 +1,39 @@ +// Copyright (C) 2006 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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. +// +// 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/ +// + +#ifndef _SalomeAppTEST_HXX_ +#define _SalomeAppTEST_HXX_ + +#include + +class SalomeAppTest : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE( SalomeAppTest ); + CPPUNIT_TEST( testSalomeApp ); + CPPUNIT_TEST_SUITE_END(); + +public: + + void setUp(); + void tearDown(); + void testSalomeApp(); +}; + +#endif diff --git a/src/SalomeApp/Test/TestSalomeApp.cxx b/src/SalomeApp/Test/TestSalomeApp.cxx new file mode 100644 index 000000000..5168f98af --- /dev/null +++ b/src/SalomeApp/Test/TestSalomeApp.cxx @@ -0,0 +1,31 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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. +// +// 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/ +// + +// --- include all SalomeApp Test from basics until the present directory + +#include "SalomeAppTest.hxx" + +// --- Registers the fixture into the 'registry' + +CPPUNIT_TEST_SUITE_REGISTRATION( SalomeAppTest ); + +// --- generic Main program from Basic/Test + +#include "BasicMainTest.hxx" diff --git a/src/SalomeApp/Test/TestSalomeApp.py b/src/SalomeApp/Test/TestSalomeApp.py new file mode 100644 index 000000000..03daaf27b --- /dev/null +++ b/src/SalomeApp/Test/TestSalomeApp.py @@ -0,0 +1,29 @@ + +import sys, os,signal,string,commands +import runSalome +import orbmodule +import TestKiller + +# get SALOME environment : + +args, modules_list, modules_root_dir = runSalome.get_config() +runSalome.set_env(args, modules_list, modules_root_dir) + +# launch CORBA naming server + +clt=orbmodule.client() + +# launch CORBA logger server + +myServer=runSalome.LoggerServer(args) +myServer.run() +clt.waitLogger("Logger") + +# execute Unit Test + +command = ['TestSalomeApp'] +ret = os.spawnvp(os.P_WAIT, command[0], command) + +# kill Test process + +TestKiller.killProcess(runSalome.process_id) -- 2.39.2