Salome HOME
76e233258d7c76e63ead137def5ace8b637c519a
[modules/smesh.git] / src / Tools / padder / meshjob / impl / testhelper.hxx
1 #ifndef __TESTHELPER_HXX__
2 #define __TESTHELPER_HXX__
3
4 // >>>
5 // WARN: this file is DEPRECATED and/or should be used for test
6 // purpose only. The PADDER configuration is now read in a
7 // configuration file (padder.cfg).
8 // <<<
9
10 #include <stdlib.h> // Standard C include (for getenv)
11 #include <unistd.h>
12 #include <string>
13
14 /*!
15  * This function returns the module SMESH installation root directory
16  * as a string.
17  */
18 static std::string SMESH_ROOT_DIR() {
19   static std::string * smesh_root_dir;
20   if ( smesh_root_dir == NULL ) {
21     char * SMESH_ROOT_DIR = getenv("SMESH_ROOT_DIR");
22     if ( SMESH_ROOT_DIR == NULL ) {
23       smesh_root_dir = new std::string("<path_undefined>");
24     }
25     else {
26       smesh_root_dir = new std::string(SMESH_ROOT_DIR);
27     }
28   }
29   return *smesh_root_dir;
30 }
31
32 /*! Relative path of the directory containing data and exe for tests */
33 static std::string PADDEREXE_RPATH("/share/salome/resources/smesh/padderexe");
34 /*! Absolute path of the directory containing data and exe for tests */
35 static std::string PADDEREXE_APATH(SMESH_ROOT_DIR()+PADDEREXE_RPATH);
36 /*! Absolute path of the exe shell script for tests */
37 static std::string PADDEREXE_SCRIPT_FILENAME(PADDEREXE_APATH+"/padder.sh");
38
39
40 static int testssh_using_system() {
41   const char * cmd = "/usr/bin/ssh claui2p1 -l boulant 'cd /tmp && ./runCommand_padder_Mon_Feb_28_14_28_36_2011.sh'";
42   int result = system(cmd);
43   return result;
44 }
45
46 #endif // __TESTHELPER_HXX__