diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-04-24 19:59:51 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-04-24 19:59:51 (GMT) |
commit | d395b563ede173721c240df2daad23284f453c4a (patch) | |
tree | 84178ad0d725b16b92f84549bd106e05038c90d5 /Source/cmEnableTestingCommand.cxx | |
parent | 3a8e7599b10806b43179e18c23218fe68a4d2eb5 (diff) | |
download | CMake-d395b563ede173721c240df2daad23284f453c4a.zip CMake-d395b563ede173721c240df2daad23284f453c4a.tar.gz CMake-d395b563ede173721c240df2daad23284f453c4a.tar.bz2 |
ENH: Improve internal test handling by creating a test class. Command cmEnableTesting now only sets CMAKE_TESTING_ENABLED and cmAddTest only adds a test to the list. The actual test files are written by local generator. This way we can at some point in the future replace DartTestfile with some XML file
Diffstat (limited to 'Source/cmEnableTestingCommand.cxx')
-rw-r--r-- | Source/cmEnableTestingCommand.cxx | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/Source/cmEnableTestingCommand.cxx b/Source/cmEnableTestingCommand.cxx index cc9c7cb..ce0b69a 100644 --- a/Source/cmEnableTestingCommand.cxx +++ b/Source/cmEnableTestingCommand.cxx @@ -24,91 +24,3 @@ bool cmEnableTestingCommand::InitialPass(std::vector<std::string> const&) m_Makefile->AddDefinition("CMAKE_TESTING_ENABLED","1"); return true; } - -void cmEnableTestingCommand::FinalPass() -{ - // initialize the DartTestfile files for the tree - this->CreateDartTestfileForMakefile(m_Makefile); -} - -void cmEnableTestingCommand::CreateDartTestfileForMakefile(cmMakefile *mf) -{ - // Create a full path filename for output Testfile - std::string fname; - fname = mf->GetStartOutputDirectory(); - fname += "/"; - if ( m_Makefile->IsSet("CTEST_NEW_FORMAT") ) - { - fname += "CTestTestfile.cmake"; - } - else - { - fname += "DartTestfile.txt"; - } - - cmSystemTools::MakeDirectory(mf->GetStartOutputDirectory()); - - // Open the output Testfile - std::ofstream fout(fname.c_str()); - if (!fout) - { - cmSystemTools::Error("Error Writing ", fname.c_str()); - cmSystemTools::ReportLastSystemError(""); - return; - } - - fout << "# CMake generated Testfile for " << std::endl - << "#\tSource directory: " - << mf->GetStartDirectory() - << std::endl - << "#\tBuild directory: " << mf->GetStartOutputDirectory() - << std::endl - << "# " << std::endl - << "# This file replicates the SUBDIRS() and ADD_TEST() commands from the source" - << std::endl - << "# tree CMakeLists.txt file, skipping any SUBDIRS() or ADD_TEST() commands" - << std::endl - << "# that are excluded by CMake control structures, i.e. IF() commands." - << std::endl - << "#" << std::endl - << "# The next line is critical for Dart to work" << std::endl - << "# Duh :-)" << std::endl << std::endl; - - // get our output directory - std::string outDir = mf->GetStartOutputDirectory(); - outDir += "/"; - - // write out the subdirs for the current directory - std::vector<cmLocalGenerator *>& children = - mf->GetLocalGenerator()->GetChildren(); - - unsigned int i; - if (children.size()) - { - fout << "SUBDIRS("; - std::string binP = children[0]->GetMakefile()->GetStartOutputDirectory(); - cmSystemTools::ReplaceString(binP, outDir.c_str(), ""); - fout << binP.c_str(); - for(i = 1; i < children.size(); ++i) - { - binP = children[i]->GetMakefile()->GetStartOutputDirectory(); - cmSystemTools::ReplaceString(binP, outDir.c_str(), ""); - fout << " " << binP.c_str(); - } - fout << ")" << std::endl << std::endl;; - } - fout.close(); - - // then recurse - if (children.size()) - { - for(i = 0; i < children.size(); ++i) - { - this->CreateDartTestfileForMakefile(children[i]->GetMakefile()); - } - } - - - return; -} - |