MCPcopy Create free account
hub / github.com/Kitware/CMake / ForkProcess

Method ForkProcess

Source/CTest/cmCTestRunTest.cxx:771–902  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

769}
770
771bool cmCTestRunTest::ForkProcess()
772{
773 this->TestProcess->SetId(this->Index);
774 this->TestProcess->SetWorkingDirectory(this->TestProperties->Directory);
775 this->TestProcess->SetCommand(this->ActualCommand);
776 this->TestProcess->SetCommandArguments(this->Arguments);
777
778 cm::optional<cmDuration> timeout;
779
780 // Check TIMEOUT test property.
781 if (this->TestProperties->Timeout &&
782 *this->TestProperties->Timeout >= cmDuration::zero()) {
783 timeout = this->TestProperties->Timeout;
784 }
785
786 // An explicit TIMEOUT=0 test property means "no timeout".
787 if (timeout) {
788 if (*timeout == std::chrono::duration<double>::zero()) {
789 timeout = cm::nullopt;
790 }
791 } else {
792 // Check --timeout.
793 if (this->CTest->GetGlobalTimeout() > cmDuration::zero()) {
794 timeout = this->CTest->GetGlobalTimeout();
795 }
796
797 if (!timeout) {
798 // Check CTEST_TEST_TIMEOUT.
799 cmDuration ctestTestTimeout = this->CTest->GetTimeOut();
800 if (ctestTestTimeout > cmDuration::zero()) {
801 timeout = ctestTestTimeout;
802 }
803 }
804 }
805
806 // Check CTEST_TIME_LIMIT.
807 cmDuration timeRemaining = this->CTest->GetRemainingTimeAllowed();
808 if (timeRemaining != cmCTest::MaxDuration()) {
809 // This two minute buffer is historical.
810 timeRemaining -= std::chrono::minutes(2);
811 }
812
813 // Check --stop-time.
814 std::chrono::system_clock::time_point stop_time = this->CTest->GetStopTime();
815 if (stop_time != std::chrono::system_clock::time_point()) {
816 cmDuration timeUntilStop =
817 (stop_time - std::chrono::system_clock::now()) % std::chrono::hours(24);
818 this->TestProcess->SetStopTimeout(timeUntilStop);
819 }
820
821 // Enforce remaining time even over explicit TIMEOUT=0.
822 if (timeRemaining <= cmDuration::zero()) {
823 timeRemaining = cmDuration::zero();
824 }
825 if (!timeout || timeRemaining < *timeout) {
826 timeout = timeRemaining;
827 }
828

Callers 1

StartTestMethod · 0.95

Calls 15

SetCommandArgumentsMethod · 0.80
GetGlobalTimeoutMethod · 0.80
GetTimeOutMethod · 0.80
GetStopTimeMethod · 0.80
SetStopTimeoutMethod · 0.80
SetTimeoutMethod · 0.80
GetComputedTimeoutMethod · 0.80
AppendEnvMethod · 0.80
ApplyToCurrentEnvMethod · 0.80
ParseOperationMethod · 0.80

Tested by

no test coverage detected