Salome HOME
Update copyright information
[modules/smesh.git] / src / Tools / padder / meshjob / impl / testhelper.hxx
1 // Copyright (C) 2011-2012  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Authors : Guillaume Boulant (EDF) - 01/03/2011
20
21 #ifndef __TESTHELPER_HXX__
22 #define __TESTHELPER_HXX__
23
24 // >>>
25 // WARN: this file is DEPRECATED and/or should be used for test
26 // purpose only. The PADDER configuration is now read in a
27 // configuration file (padder.cfg).
28 // <<<
29
30 #include <stdlib.h> // Standard C include (for getenv)
31 #include <unistd.h>
32 #include <string>
33
34 /*!
35  * This function returns the module SMESH installation root directory
36  * as a string.
37  */
38 static std::string SMESH_ROOT_DIR() {
39   static std::string * smesh_root_dir;
40   if ( smesh_root_dir == NULL ) {
41     char * SMESH_ROOT_DIR = getenv("SMESH_ROOT_DIR");
42     if ( SMESH_ROOT_DIR == NULL ) {
43       smesh_root_dir = new std::string("<path_undefined>");
44     }
45     else {
46       smesh_root_dir = new std::string(SMESH_ROOT_DIR);
47     }
48   }
49   return *smesh_root_dir;
50 }
51
52 /*! Relative path of the directory containing data and exe for tests */
53 static std::string PADDEREXE_RPATH("/share/salome/resources/smesh/padderexe");
54 /*! Absolute path of the directory containing data and exe for tests */
55 static std::string PADDEREXE_APATH(SMESH_ROOT_DIR()+PADDEREXE_RPATH);
56 /*! Absolute path of the exe shell script for tests */
57 static std::string PADDEREXE_SCRIPT_FILENAME(PADDEREXE_APATH+"/padder.sh");
58
59
60 static int testssh_using_system() {
61   const char * cmd = "/usr/bin/ssh claui2p1 -l boulant 'cd /tmp && ./runCommand_padder_Mon_Feb_28_14_28_36_2011.sh'";
62   int result = system(cmd);
63   return result;
64 }
65
66 #endif // __TESTHELPER_HXX__