88 #define fei_file "fei_test.cpp"
97 int argc,
char** argv,
MPI_Comm comm);
100 int argc,
char** argv,
MPI_Comm comm);
109 MPI_Comm& newcomm1, MPI_Group& newgroup1,
110 MPI_Comm& newcomm2, MPI_Group& newgroup2);
116 int main(
int argc,
char** argv) {
134 if (!testname.empty()) {
155 catch(std::runtime_error& exc) {
161 int global_err_code = 0;
169 return(global_err_code);
173 int argc,
char** argv,
182 std::vector<std::string> inputFileNames;
184 const char* filename_c_str =
filename.c_str();
197 catch(std::runtime_error& exc) {
212 <<
"*****************************************************************"
213 <<
FEI_ENDL <<
" Running tests with partitioned communicators/groups"
215 <<
"*****************************************************************"
220 MPI_Group newgroup1, newgroup2;
226 newcomm2, newgroup2);
248 catch(std::exception& exc) {
249 FEI_COUT <<
"test_library_plugins: caught exception: "
262 catch(std::exception& exc) {
263 FEI_COUT <<
"test_library_plugins: caught exception: "
276 catch(std::exception& exc) {
277 FEI_COUT <<
"test_library_plugins: caught exception: "
287 int argc,
char** argv,
MPI_Comm comm)
301 bool testname_recognized =
false;
303 if (testname ==
"unit_tests") {
304 testname_recognized =
true;
308 catch(std::runtime_error& exc) {
314 if (testname ==
"poisson_main") {
316 testname_recognized =
true;
318 if (testname ==
"poisson3_main") {
320 testname_recognized =
true;
323 if (testname ==
"beam_oldfei_main") {
325 testname_recognized =
true;
327 if (testname ==
"beam_main") {
329 testname_recognized =
true;
332 if (testname ==
"feiDriver_main") {
334 testname_recognized =
true;
337 if (testname ==
"library_plugins") {
339 testname_recognized =
true;
342 if (testname ==
"benchmarks") {
343 testname_recognized =
true;
348 catch(std::runtime_error& exc) {
357 if (!testname_recognized &&
localProc == 0) {
358 FEI_COUT <<
"fei_test: '-test' argument used, but value ("<<testname
359 <<
") not recognized. Valid values are:"<<
FEI_ENDL
377 bool test_failed =
false;
378 if (tst.
runtests() != 0) test_failed =
false;
380 if (test_failed)
throw std::runtime_error(
"unit-test failed");
386 std::vector<fei::SharedPtr<tester> > testers;
412 std::vector<fei::SharedPtr<tester> >::const_iterator
413 testers_iter = testers.begin(),
414 testers_end = testers.end();
416 std::string failed_test_name;
417 bool test_failed =
false;
418 for(; testers_iter != testers_end; ++testers_iter) {
424 failed_test_name = tst->
getName();
430 std::string str1(
"unit-test failed: ");
431 throw std::runtime_error(str1+failed_test_name);
436 const std::string& path,
442 test_fei.
setPath(path.c_str());
452 n_iter = name_numproc_pairs.
begin(),
453 n_end = name_numproc_pairs.
end();
455 for(; n_iter != n_end; ++n_iter) {
456 const char* fileName = (*n_iter).getName().c_str();
457 int numProcsToUse = (*n_iter).getIntValue();
472 int resultCode = test_fei.
runtests();
473 if (resultCode < 0) {
474 throw std::runtime_error(
"nonzero resultCode from test_fei.runtests()");
481 MPI_Comm& newcomm1, MPI_Group& newgroup1,
482 MPI_Comm& newcomm2, MPI_Group& newgroup2)
503 int newgroup1_size = 2, newgroup2_size = 2;
506 MPI_Comm_group(comm, &group);
508 MPI_Group_incl(group, newgroup1_size, &procs[0], &newgroup1);
509 MPI_Group_incl(group, newgroup2_size, &procs[0]+midpoint, &newgroup2);
511 MPI_Comm_create(comm, newgroup1, &newcomm1);
512 MPI_Comm_create(comm, newgroup2, &newcomm2);