15 namespace GridConversion{
20 typedef IRAD::Comm::CommunicatorObject
CommType;
58 int rank = communicator.Rank();
59 int nproc = communicator.Size();
60 bool do_stdout = !
rank;
73 int clerr = comline.ProcessOptions();
75 if(!comline.GetOption(
"help").empty()){
78 std::cout << comline.LongUsage() << std::endl;
80 std::cout <<
"GridConversion::ParallelTest: Exiting test function (success)"
83 communicator.SetExit(1);
85 if(communicator.Check())
89 std::cout << comline.ErrorReport() << std::endl
90 << std::endl << comline.ShortUsage() << std::endl;
92 std::cout <<
"GridConversion::ParallelTest: Exiting test function (fail)" << std::endl;
94 communicator.SetExit(1);
96 if(communicator.Check())
102 std::ostream *Out = NULL;
108 std::string OutFileName(comline.GetOption(
"output"));
109 std::string TestName(comline.GetOption(
"name"));
110 std::string ListName(comline.GetOption(
"list"));
111 std::string sverb(comline.GetOption(
"verblevel"));
116 if(sverb !=
".true."){
117 std::istringstream Istr(sverb);
125 if(!OutFileName.empty()){
127 Ouf.open(OutFileName.c_str());
129 std::cout <<
"GridConversion::ParallelTest> Error: Could not open output file, "
130 << OutFileName <<
" for test output. Exiting (fail)." << std::endl;
131 communicator.SetExit(1);
135 if(communicator.Check())
139 if(verblevel > 1 && Out)
140 *Out <<
"GridConversion::ParallelTest: Entering test function" << std::endl;
143 GridConversion::ParallelTestingObject<GridConversion::CommType,GridConversion::TestResults>
test(communicator);
148 if(!TestName.empty()){
150 test.RunTest(TestName,results);
154 else if(!ListName.empty()){
155 std::ifstream ListInf;
156 ListInf.open(ListName.c_str());
159 *Out <<
"GridConversion::ParallelTest> Error: Could not open list of tests in file "
160 << ListName <<
". Exiting (fail)." << std::endl;
161 communicator.SetExit(1);
163 if(communicator.Check())
165 std::string testname;
166 while(std::getline(ListInf,testname))
167 test.RunTest(testname,results);
172 test.Process(results);
175 *Out << results << std::endl;
180 if((verblevel > 1) && Out)
181 *Out <<
"GridConversion::ParallelTest: Exiting test function (success)" << std::endl;
187 int main(
int argc,
char *argv[])
ComLineObject for GridConversion testing command-line interface.
Testing utilities for GridConversion.
IRAD::Util::TestResults TestResults
Project-specific test results type.
IRAD::Comm::CommunicatorObject CommType
Convenience typedef for CommunicatorObject.
int main(int argc, char *argv[])
int ParallelTest(int argc, char *argv[])
Drives the GridConversion::TestObject.