PlasCom2  1.0
XPACC Multi-physics simluation application
TestSys.C
Go to the documentation of this file.
1 #include "SysTest.H"
7 #include "UnixUtils.H"
8 #include "Application.H"
9 #include "TestingProgram.H"
10 
11 namespace ix {
12  namespace sys {
13 
15  std::string systemInfo(SystemInfo());
16  result.UpdateResult("SystemInfo:Worked",ix::util::NumLines(systemInfo) > 10);
17  ix::sys::platform_info platformInfo(PlatformInfo(systemInfo));
18  bool platformResolved = !platformInfo.operatingSystem.empty() &&
19  !platformInfo.systemArchitecture.empty() && !platformInfo.hostName.empty() &&
20  platformInfo.numProcessors > 0 && platformInfo.numCores > 0;
21  if(!platformResolved){
22  std::ostringstream Ostr;
23  Ostr << "Platform resolution failed...." << std::endl
24  << "Platform Info:" << std::endl
25  << "==============" << std::endl
26  << platformInfo << std::endl
27  << "--------------" << std::endl
28  << "System Info: " << std::endl
29  << "==============" << std::endl
30  << systemInfo << std::endl;
31  if(driverProgram){
32  driverProgram->StdOut(Ostr.str());
33  } else {
34  std::cout << Ostr.str();
35  }
36  }
37  result.UpdateResult("PlatformInfo:Worked",platformResolved);
38  };
39 
40  };
41 };
42 
43 int main(int argc,char *argv[])
44 {
45  ix::test::program<ix::sys::testmanager> testProgram(argc,argv);
46  ix::sys::testmanager &testManager(testProgram.TestObject());
47  testManager.SetDriverProgram(&testProgram);
48 
49  return(ix::app::ProgramDriver(testProgram));
50 }
int ProgramDriver(ProgramType &applicationProgram)
void Test__SystemInfo(test::results &result)
Definition: TestSys.C:14
Implements a program object for testing.
Defines MPI-specific parallel global and program classes.
std::string hostName
Definition: UnixUtils.H:32
TestGlobalType * driverProgram
Definition: SysTest.H:17
virtual int StdOut(const std::string &outstr, unsigned char inlev=1)
Definition: Global.H:439
std::string operatingSystem
Definition: UnixUtils.H:34
void SetDriverProgram(TestGlobalType *inProgram)
Definition: SysTest.H:24
int NumLines(const std::string &instr)
Testing object for system utilities.
Unix System Tools interface.
std::string SystemInfo()
Definition: UnixUtils.C:99
std::string systemArchitecture
Definition: UnixUtils.H:35
TestObjectType & TestObject()
int main(int argc, char *argv[])
Definition: TestSys.C:43
platform_info PlatformInfo(const std::string &systemInfo)
Definition: UnixUtils.C:45