From 67f1dab2b5e69474cc4df000cdbd2d3135981c5b Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 9 Jan 2004 13:35:18 -0500 Subject: [PATCH] ENH: add an ability to specify a build run directory --- Source/cmCTest.cxx | 17 ++++++++++++++++- Source/cmCTest.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index d6690174f..eba119385 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -3703,6 +3703,11 @@ int cmCTest::Run(std::vectorconst& args, std::string* output) i++; m_BuildTarget = args[i]; } + if(arg.find("--build-run-dir",0) == 0 && i < args.size() - 1) + { + i++; + m_BuildRunDir = args[i]; + } if(arg.find("--build-two-config",0) == 0 && i < args.size() - 1) { m_BuildTwoConfig = true; @@ -4050,6 +4055,11 @@ int cmCTest::RunCMakeAndTest(std::string* outstring) *outstring += output; } + if(m_TestCommand.size() == 0) + { + return retVal; + } + // now run the compiled test if we can find it // See if the executable exists as written. std::vector failed; @@ -4149,7 +4159,12 @@ int cmCTest::RunCMakeAndTest(std::string* outstring) testCommand.push_back(0); std::string outs; int retval = 0; - out << "Running test executable: " << fullPath << "\n"; + out << "Running test executable: " << fullPath << "\n"; + // run the test from the m_BuildRunDir if set + if(m_BuildRunDir.size()) + { + cmSystemTools::ChangeDirectory(m_BuildRunDir.c_str()); + } this->RunTest(testCommand, &outs, &retval); out << outs << "\n"; if(outstring) diff --git a/Source/cmCTest.h b/Source/cmCTest.h index e07d0e140..89361381f 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -298,6 +298,7 @@ private: std::string m_CTestSelf; std::string m_SourceDir; std::string m_BinaryDir; + std::string m_BuildRunDir; std::string m_BuildGenerator; std::string m_BuildMakeProgram; std::string m_BuildProject;