| 53 | } |
| 54 | |
| 55 | int TestPExecutableRunner(int argc, char* argv[]) |
| 56 | { |
| 57 | MPI_Init(&argc, &argv); |
| 58 | |
| 59 | vtkNew<vtkMPIController> controller; |
| 60 | controller->Initialize(&argc, &argv, 1); |
| 61 | controller->SetGlobalController(controller); |
| 62 | |
| 63 | std::string message = "Hello World!"; |
| 64 | std::string command; |
| 65 | #ifdef _WIN32 |
| 66 | command += "cmd.exe /c "; |
| 67 | #endif |
| 68 | command += " echo " + message; |
| 69 | |
| 70 | int numberOfProcesses = controller->GetNumberOfProcesses(); |
| 71 | |
| 72 | bool testResult = true; |
| 73 | |
| 74 | { |
| 75 | // Test vtkPExecutableRunner when executing a command only on rank 0 |
| 76 | std::vector<std::string> testCaseExpectedResults; |
| 77 | testCaseExpectedResults.resize(numberOfProcesses, ""); |
| 78 | testCaseExpectedResults[0] = message; |
| 79 | testResult &= ::RunTestCase(controller, command, 0, testCaseExpectedResults); |
| 80 | } |
| 81 | |
| 82 | // Test vtkPExecutableRunner when executing a command on all ranks |
| 83 | { |
| 84 | std::vector<std::string> testCaseExpectedResults; |
| 85 | testCaseExpectedResults.resize(numberOfProcesses, message); |
| 86 | testResult &= ::RunTestCase(controller, command, std::nullopt, testCaseExpectedResults); |
| 87 | } |
| 88 | |
| 89 | controller->SetGlobalController(nullptr); |
| 90 | controller->Finalize(); |
| 91 | |
| 92 | return testResult ? EXIT_SUCCESS : EXIT_FAILURE; |
| 93 | } |
nothing calls this directly
no test coverage detected