Salome HOME
Update copyrights 2014.
[modules/smesh.git] / src / Tools / padder / meshjob / impl / testhelper.hxx
1 // Copyright (C) 2011-2014  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, or (at your option) any later version.
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
20 // Authors : Guillaume Boulant (EDF) - 01/03/2011
21
22 #ifndef __TESTHELPER_HXX__
23 #define __TESTHELPER_HXX__
24
25 // >>>
26 // WARN: this file is DEPRECATED and/or should be used for test
27 // purpose only. The PADDER configuration is now read in a
28 // configuration file (padder.cfg).
29 // <<<
30
31 #include <stdlib.h> // Standard C include (for getenv)
32 #include <unistd.h>
33 #include <string>
34
35 /*!
36  * This function returns the module SMESH installation root directory
37  * as a string.
38  */
39 static std::string SMESH_ROOT_DIR() {
40   static std::string * smesh_root_dir;
41   if ( smesh_root_dir == NULL ) {
42     char * SMESH_ROOT_DIR = getenv("SMESH_ROOT_DIR");
43     if ( SMESH_ROOT_DIR == NULL ) {
44       smesh_root_dir = new std::string("<path_undefined>");
45     }
46     else {
47       smesh_root_dir = new std::string(SMESH_ROOT_DIR);
48     }
49   }
50   return *smesh_root_dir;
51 }
52
53 /*! Relative path of the directory containing data and exe for tests */
54 static std::string PADDEREXE_RPATH("/share/salome/resources/smesh/padderexe");
55 /*! Absolute path of the directory containing data and exe for tests */
56 static std::string PADDEREXE_APATH(SMESH_ROOT_DIR()+PADDEREXE_RPATH);
57 /*! Absolute path of the exe shell script for tests */
58 static std::string PADDEREXE_SCRIPT_FILENAME(PADDEREXE_APATH+"/padder.sh");
59
60
61 static int testssh_using_system() {
62   const char * cmd = "/usr/bin/ssh claui2p1 -l boulant 'cd /tmp && ./runCommand_padder_Mon_Feb_28_14_28_36_2011.sh'";
63   int result = system(cmd);
64   return result;
65 }
66
67 #endif // __TESTHELPER_HXX__