MCPcopy Create free account
hub / github.com/Kitware/VTK / TestPExecutableRunner

Function TestPExecutableRunner

Parallel/MPI/Testing/Cxx/TestPExecutableRunner.cxx:55–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55int 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}

Callers

nothing calls this directly

Calls 6

RunTestCaseFunction · 0.85
SetGlobalControllerMethod · 0.80
GetNumberOfProcessesMethod · 0.80
InitializeMethod · 0.45
resizeMethod · 0.45
FinalizeMethod · 0.45

Tested by

no test coverage detected