int main(int argc, char *argv[]) { #ifdef TEST_COLLECTIVES MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &comm_ndev); MPI_Comm_rank(MPI_COMM_WORLD, &comm_rank); if (argc < comm_ndev) { if (comm_rank == 0) printf("Usage : %s <GPU list per rank>\n", argv[0]); exit(1); } dev_name = argv[comm_rank + 1]; // Set a gpu for this process. #endif // TEST_COLLECTIVES int number_failed; Suite *s = get_suite(); SRunner *sr = srunner_create(s); #ifdef TEST_COLLECTIVES // Check by default forks to another (non mpi registered) process in order to // run tests. Using MPI inside tests means we must disable this. srunner_set_fork_status(sr, CK_NOFORK); #endif // TEST_COLLECTIVES srunner_run_all(sr, CK_VERBOSE); number_failed = srunner_ntests_failed(sr); srunner_free(sr); #ifdef TEST_COLLECTIVES MPI_Finalize(); #endif // TEST_COLLECTIVES return number_failed == 0 ? EXIT_SUCCESS : EXIT_FAILURE; }
int main(int argc, char** argv) { const char* test_name = NULL; int i = 1; test_suite suite; test_runner = run_test_in_child; fallback_function = exit_fallback; while (i < argc) { if (*(argv[i]) != '-') { test_name = argv[i]; break; } else { switch (*(argv[i]+1)) { case 'f': test_runner = run_test_in_child; break; case 's': test_runner = run_test; break; case 'S': test_runner = run_test_with_siglongjmp; fallback_function = siglongjmp_fallback; break; case 'v': verbose_mode = TRUE; break; case 'h': printUsage(argv[0]); return OK; default: fprintf(stderr, "Invalid option: %s\n", argv[i]); printUsage(argv[0]); return USAGE; } } ++i; } if (!init_testing()) { fprintf(stderr, "Unable to initialize testing runtime\n"); return TEST_INIT; } suite = get_suite(); if (!run_tests(suite, test_name)) { return TEST_NOT_FOUND; } printResults(); release_suite(suite); return (cleanup_testing()) ? OK : TEST_CLEANUP; }
int list_modules( const boost::string_ref prog, const boost::string_ref desc ) { if (desc.length() > 0) { println("Suite ${quote}: $.", get_suite(prog), desc); } else { println("Suite ${quote}.", get_suite(prog)); } for (const auto& m : module_list{}) { if (m.description().length() > 0) { println("Module ${quote}: $.", m.name(), m.description()); } else { println("Module ${quote}.", m.name(), m.description()); } } return EXIT_SUCCESS; }