summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CTest/cmCTestRunScriptCommand.cxx1
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx35
-rw-r--r--Source/CTest/cmCTestScriptHandler.h1
3 files changed, 16 insertions, 21 deletions
diff --git a/Source/CTest/cmCTestRunScriptCommand.cxx b/Source/CTest/cmCTestRunScriptCommand.cxx
index 274778a..88badc7 100644
--- a/Source/CTest/cmCTestRunScriptCommand.cxx
+++ b/Source/CTest/cmCTestRunScriptCommand.cxx
@@ -32,7 +32,6 @@ bool cmCTestRunScriptCommand::InitialPass(std::vector<std::string> const& args)
{
cmCTestScriptHandler::RunScript(m_CTest, args[i].c_str());
}
-
return true;
}
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index f197722..458b029 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -75,7 +75,6 @@ cmCTestScriptHandler::cmCTestScriptHandler()
{
m_Verbose = false;
m_Backup = false;
- m_ScriptHasRun = false;
m_EmptyBinDir = false;
m_EmptyBinDirOnce = false;
m_Makefile = 0;
@@ -191,17 +190,16 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
m_LocalGenerator = m_GlobalGenerator->CreateLocalGenerator();
m_LocalGenerator->SetGlobalGenerator(m_GlobalGenerator);
+ m_Makefile = m_LocalGenerator->GetMakefile();
// set a variable with the path to the current script
- m_LocalGenerator->GetMakefile()->AddDefinition("CTEST_SCRIPT_DIRECTORY",
- cmSystemTools::GetFilenamePath(
- script).c_str());
- m_LocalGenerator->GetMakefile()->AddDefinition("CTEST_SCRIPT_NAME",
- cmSystemTools::GetFilenameName(
- script).c_str());
- m_LocalGenerator->GetMakefile()->AddDefinition("CTEST_EXECUTABLE_NAME",
- m_CTest->GetCTestExecutable());
-
+ m_Makefile->AddDefinition("CTEST_SCRIPT_DIRECTORY",
+ cmSystemTools::GetFilenamePath(script).c_str());
+ m_Makefile->AddDefinition("CTEST_SCRIPT_NAME",
+ cmSystemTools::GetFilenameName(script).c_str());
+ m_Makefile->AddDefinition("CTEST_EXECUTABLE_NAME",
+ m_CTest->GetCTestExecutable());
+ m_Makefile->AddDefinition("CTEST_RUN_CURRENT_SCRIPT", true);
this->UpdateElapsedTime();
// add any ctest specific commands, probably should have common superclass
@@ -223,17 +221,16 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
// add the script arg if defined
if (script_arg.size())
{
- m_LocalGenerator->GetMakefile()->AddDefinition(
- "CTEST_SCRIPT_ARG", script_arg.c_str());
+ m_Makefile->AddDefinition("CTEST_SCRIPT_ARG", script_arg.c_str());
}
// always add a function blocker to update the elapsed time
cmCTestScriptFunctionBlocker *f = new cmCTestScriptFunctionBlocker();
f->m_CTestScriptHandler = this;
- m_LocalGenerator->GetMakefile()->AddFunctionBlocker(f);
+ m_Makefile->AddFunctionBlocker(f);
// finally read in the script
- if (!m_LocalGenerator->GetMakefile()->ReadListFile(0, script.c_str()))
+ if (!m_Makefile->ReadListFile(0, script.c_str()))
{
return 2;
}
@@ -246,9 +243,6 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
// extract variabels from the script to set ivars
int cmCTestScriptHandler::ExtractVariables()
{
- // get some info that should be set
- m_Makefile = m_LocalGenerator->GetMakefile();
-
// Temporary variables
const char* minInterval;
const char* contDuration;
@@ -361,7 +355,9 @@ int cmCTestScriptHandler::RunConfigurationScript(const std::string& total_script
{
return result;
}
- if (!m_ScriptHasRun)
+
+ // only run the curent script if we should
+ if (m_Makefile && m_Makefile->IsOn("CTEST_RUN_CURRENT_SCRIPT"))
{
return this->RunCurrentScript();
}
@@ -372,7 +368,8 @@ int cmCTestScriptHandler::RunCurrentScript()
{
int result;
- m_ScriptHasRun = true;
+ // do not run twice
+ m_Makefile->AddDefinition("CTEST_RUN_CURRENT_SCRIPT", false);
// no popup widows
cmSystemTools::SetRunCommandHideConsole(true);
diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h
index 0c0b30a..7dfb59c 100644
--- a/Source/CTest/cmCTestScriptHandler.h
+++ b/Source/CTest/cmCTestScriptHandler.h
@@ -121,7 +121,6 @@ private:
bool m_Backup;
bool m_EmptyBinDir;
bool m_EmptyBinDirOnce;
- bool m_ScriptHasRun;
cmStdString m_SourceDir;
cmStdString m_BinaryDir;