/// <summary> /// Creates the user specified number of parallel testing processes. /// </summary> private void CreateParallelTestingProcesses() { for (uint testId = 0; testId < this.Configuration.ParallelBugFindingTasks; testId++) { this.TestingProcesses.Add(testId, TestingProcessFactory.Create(testId, this.Configuration)); this.TestingProcessChannels.Add(testId, this.CreateTestingProcessChannel(testId)); } Output.WriteLine($"... Created '{this.Configuration.ParallelBugFindingTasks}' " + "testing tasks."); }
/// <summary> /// Runs the P# testing scheduler. /// </summary> internal void Run() { // Opens the remote notification listener. // Requires administrator access. this.OpenNotificationListener(); // Creates the user specified number of testing processes. for (int testId = 0; testId < this.Configuration.ParallelBugFindingTasks; testId++) { this.TestingProcesses.Add(testId, TestingProcessFactory.Create(testId, this.Configuration)); this.TestingProcessChannels.Add(testId, this.CreateTestingProcessChannel(testId)); } IO.PrintLine($"... Created '{this.Configuration.ParallelBugFindingTasks}' " + "parallel testing tasks."); this.Profiler.StartMeasuringExecutionTime(); // Starts the testing processes. for (int testId = 0; testId < this.Configuration.ParallelBugFindingTasks; testId++) { this.TestingProcesses[testId].Start(); } // Waits the testing processes to exit. for (int testId = 0; testId < this.Configuration.ParallelBugFindingTasks; testId++) { try { this.TestingProcesses[testId].WaitForExit(); } catch (InvalidOperationException) { IO.Debug($"... Unable to wait for testing task '{testId}' to " + "terminate. Task has already terminated."); } } this.Profiler.StopMeasuringExecutionTime(); IO.PrintLine($"... Elapsed {this.Profiler.Results()} sec."); // Closes the remote notification listener. this.CloseNotificationListener(); }