summaryrefslogtreecommitdiffstats
path: root/Tests
Commit message (Expand)AuthorAgeFilesLines
* Fix for StopTime for cases when gmtime is a day ahead of localtimeZach Mullen2010-03-181-2/+2
* More debugging of StopTime testZach Mullen2010-03-182-3/+16
* Output times during StopTime test for debuggingZach Mullen2010-03-171-0/+4
* Move get_date call closer to ctest_test for more predictable results.Zach Mullen2010-03-171-3/+4
* Add the --stop-time argumentZach Mullen2010-03-176-1/+304
* Add CMAKE_TESTS_CDASH_SERVER variable and CTestSubmitLargeOutput test.David Cole2010-03-087-4/+128
* Remove empty_binary_dir command in new unit testZach Mullen2010-03-032-3/+1
* Add unit test for RESOURCE_LOCK test propertyZach Mullen2010-03-035-1/+85
* Different versions of cygwin report differet messages for cygwinBill Hoffman2010-02-261-2/+2
* Change the tag to be master from CVS for release scriptsBill Hoffman2010-02-251-2/+2
* Fix problem with ExternalProject test in in-source builds.David Cole2010-02-171-0/+11
* Add a high COST value to BootstrapTest so that it will be scheduled first in ...Zach Mullen2010-02-111-0/+2
* Make CTest.UpdateCVS robust to some cvs clientsBrad King2010-02-102-2/+3
* Fix configure time error that occurs when there is a backslash in the HOME en...David Cole2010-02-101-1/+2
* Teach CTest.UpdateGIT test to fake file timestampBrad King2010-02-092-0/+12
* Teach CTest.Update tests to strongly check entriesBrad King2010-02-091-19/+47
* Re-enabled Scheduler test and fixed the underlying problem.Zach Mullen2010-02-031-10/+10
* Disable Scheduler test until underlying problem is resolved.Zach Mullen2010-02-031-10/+10
* Add unit test to ensure that CTestCostData scheduling works correctlyZach Mullen2010-02-035-0/+79
* Add alternate per-vendor compiler id detectionBrad King2010-02-012-0/+32
* Avoid PathScale cmd-line bug in TryCompile testBrad King2010-01-251-2/+8
* Skip Fortran module mangling test on PathScaleBrad King2010-01-251-1/+1
* Fix escapes in Fortran depend.make entriesBrad King2010-01-042-4/+11
* Fix issue #10060 - add APPEND arg to ctest_start command.David Cole2009-12-291-0/+4
* Longer CTestTestTimeout default time on CygwinBrad King2009-12-211-1/+5
* Test for SVNPath element in Update.xmlBrad King2009-12-182-3/+4
* Fix BadExe test on cygwin.Bill Hoffman2009-12-181-6/+8
* Submit global tree revision in Update.xmlBrad King2009-12-182-0/+20
* Test the CheckTypeSize moduleBrad King2009-12-174-0/+181
* Teach ADD_TEST_MACRO about test namespacesBrad King2009-12-171-4/+6
* Workaround for CTestTestBadExe on CygwinZach Mullen2009-12-171-2/+6
* Add a test to build the CSE project if the optional cache entry CMAKE_TEST_PR...David Cole2009-12-151-0/+13
* Honor real language flags in FortranC.Flags testBrad King2009-12-153-6/+10
* FortranCInterface: Support '=' in language flagsBrad King2009-12-151-2/+2
* Add one more possible error message from curl for the failed submit tests.David Cole2009-12-151-0/+1
* Test FortranCInterface flag propagationBrad King2009-12-144-0/+81
* New decision method to enable Fortran testsBrad King2009-12-102-14/+50
* Always use a configuration for CMake testsBrad King2009-12-101-15/+3
* Test 'install' target of CMake itselfBrad King2009-12-102-0/+50
* Apply CMake test-time config to all testsBrad King2009-12-101-4/+0
* Create CMakeLibTests output dir for XcodeBrad King2009-12-091-0/+10
* Test XML encoding with UTF-8 character validationBrad King2009-12-082-0/+48
* Test UTF-8 decodingBrad King2009-12-082-0/+126
* Create CMakeLib test driver and test cmXMLParserBrad King2009-12-085-0/+49
* Clean up CMake build tree 'bin' directoryBrad King2009-12-081-1/+1
* Remove unused DumpDocumentation codeBrad King2009-12-081-10/+0
* Force CheckSourceTree test to pass if the source tree is not a CVS checkout. ...David Cole2009-12-071-0/+11
* Remove WILL_FAIL property from BadExe test, since CTest was returning 0. Repl...Zach Mullen2009-12-071-1/+2
* Cosmetic changes to previous commit, for consistency.Zach Mullen2009-12-072-3/+2
* Added a unit test for running a test command which exists but is not an execu...Zach Mullen2009-12-076-1/+50
"hl kwd">AddArchitecturePaths("32"); } } if (this->Makefile->GetState()->GetGlobalPropertyAsBool( "FIND_LIBRARY_USE_LIB64_PATHS")) { // add special 64 bit paths if this is a 64 bit compile. if (this->Makefile->PlatformIs64Bit()) { this->AddArchitecturePaths("64"); } } std::string library = this->FindLibrary(); if (library != "") { // Save the value in the cache this->Makefile->AddCacheDefinition(this->VariableName, library.c_str(), this->VariableDocumentation.c_str(), cmStateEnums::FILEPATH); return true; } std::string notfound = this->VariableName + "-NOTFOUND"; this->Makefile->AddCacheDefinition(this->VariableName, notfound.c_str(), this->VariableDocumentation.c_str(), cmStateEnums::FILEPATH); return true; } void cmFindLibraryCommand::AddArchitecturePaths(const char* suffix) { std::vector<std::string> original; original.swap(this->SearchPaths); for (std::vector<std::string>::const_iterator i = original.begin(); i != original.end(); ++i) { this->AddArchitecturePath(*i, 0, suffix); } } void cmFindLibraryCommand::AddArchitecturePath( std::string const& dir, std::string::size_type start_pos, const char* suffix, bool fresh) { std::string::size_type pos = dir.find("lib/", start_pos); if (pos != std::string::npos) { std::string cur_dir = dir.substr(0, pos + 3); // Follow "lib<suffix>". std::string next_dir = cur_dir + suffix; if (cmSystemTools::FileIsDirectory(next_dir)) { next_dir += dir.substr(pos + 3); std::string::size_type next_pos = pos + 3 + strlen(suffix) + 1; this->AddArchitecturePath(next_dir, next_pos, suffix); } // Follow "lib". if (cmSystemTools::FileIsDirectory(cur_dir)) { this->AddArchitecturePath(dir, pos + 3 + 1, suffix, false); } } if (fresh) { // Check for <dir><suffix>/. std::string cur_dir = dir + suffix + "/"; if (cmSystemTools::FileIsDirectory(cur_dir)) { this->SearchPaths.push_back(cur_dir); } // Now add the original unchanged path if (cmSystemTools::FileIsDirectory(dir)) { this->SearchPaths.push_back(dir); } } } std::string cmFindLibraryCommand::FindLibrary() { std::string library; if (this->SearchFrameworkFirst || this->SearchFrameworkOnly) { library = this->FindFrameworkLibrary(); } if (library.empty() && !this->SearchFrameworkOnly) { library = this->FindNormalLibrary(); } if (library.empty() && this->SearchFrameworkLast) { library = this->FindFrameworkLibrary(); } return library; } struct cmFindLibraryHelper { cmFindLibraryHelper(cmMakefile* mf); // Context information. cmMakefile* Makefile; cmGlobalGenerator* GG; // List of valid prefixes and suffixes. std::vector<std::string> Prefixes; std::vector<std::string> Suffixes; std::string PrefixRegexStr; std::string SuffixRegexStr; // Keep track of the best library file found so far. typedef std::vector<std::string>::size_type size_type; std::string BestPath; // Support for OpenBSD shared library naming: lib<name>.so.<major>.<minor> bool OpenBSD; // Current names under consideration. struct Name { bool TryRaw; std::string Raw; cmsys::RegularExpression Regex; Name() : TryRaw(false) { } }; std::vector<Name> Names; // Current full path under consideration. std::string TestPath; void RegexFromLiteral(std::string& out, std::string const& in); void RegexFromList(std::string& out, std::vector<std::string> const& in); size_type GetPrefixIndex(std::string const& prefix) { return std::find(this->Prefixes.begin(), this->Prefixes.end(), prefix) - this->Prefixes.begin(); } size_type GetSuffixIndex(std::string const& suffix) { return std::find(this->Suffixes.begin(), this->Suffixes.end(), suffix) - this->Suffixes.begin(); } bool HasValidSuffix(std::string const& name); void AddName(std::string const& name); void SetName(std::string const& name); bool CheckDirectory(std::string const& path); bool CheckDirectoryForName(std::string const& path, Name& name); }; cmFindLibraryHelper::cmFindLibraryHelper(cmMakefile* mf) : Makefile(mf) { this->GG = this->Makefile->GetGlobalGenerator(); // Collect the list of library name prefixes/suffixes to try. const char* prefixes_list = this->Makefile->GetRequiredDefinition("CMAKE_FIND_LIBRARY_PREFIXES"); const char* suffixes_list = this->Makefile->GetRequiredDefinition("CMAKE_FIND_LIBRARY_SUFFIXES"); cmSystemTools::ExpandListArgument(prefixes_list, this->Prefixes, true); cmSystemTools::ExpandListArgument(suffixes_list, this->Suffixes, true); this->RegexFromList(this->PrefixRegexStr, this->Prefixes); this->RegexFromList(this->SuffixRegexStr, this->Suffixes); // Check whether to use OpenBSD-style library version comparisons. this->OpenBSD = this->Makefile->GetState()->GetGlobalPropertyAsBool( "FIND_LIBRARY_USE_OPENBSD_VERSIONING"); } void cmFindLibraryHelper::RegexFromLiteral(std::string& out, std::string const& in) { for (std::string::const_iterator ci = in.begin(); ci != in.end(); ++ci) { char ch = *ci; if (ch == '[' || ch == ']' || ch == '(' || ch == ')' || ch == '\\' || ch == '.' || ch == '*' || ch == '+' || ch == '?' || ch == '-' || ch == '^' || ch == '$') { out += "\\"; } #if defined(_WIN32) || defined(__APPLE__) out += tolower(ch); #else out += ch; #endif } } void cmFindLibraryHelper::RegexFromList(std::string& out, std::vector<std::string> const& in) { // Surround the list in parens so the '|' does not apply to anything // else and the result can be checked after matching. out += "("; const char* sep = ""; for (std::vector<std::string>::const_iterator si = in.begin(); si != in.end(); ++si) { // Separate from previous item. out += sep; sep = "|"; // Append this item. this->RegexFromLiteral(out, *si); } out += ")"; } bool cmFindLibraryHelper::HasValidSuffix(std::string const& name) { for (std::vector<std::string>::const_iterator si = this->Suffixes.begin(); si != this->Suffixes.end(); ++si) { std::string suffix = *si; if (name.length() <= suffix.length()) { continue; } // Check if the given name ends in a valid library suffix. if (name.substr(name.size() - suffix.length()) == suffix) { return true; } // Check if a valid library suffix is somewhere in the name, // this may happen e.g. for versioned shared libraries: libfoo.so.2 suffix += "."; if (name.find(suffix) != name.npos) { return true; } } return false; } void cmFindLibraryHelper::AddName(std::string const& name) { Name entry; // Consider checking the raw name too. entry.TryRaw = this->HasValidSuffix(name); entry.Raw = name; // Build a regular expression to match library names. std::string regex = "^"; regex += this->PrefixRegexStr; this->RegexFromLiteral(regex, name); regex += this->SuffixRegexStr; if (this->OpenBSD) { regex += "(\\.[0-9]+\\.[0-9]+)?"; } regex += "$"; entry.Regex.compile(regex.c_str()); this->Names.push_back(entry); } void cmFindLibraryHelper::SetName(std::string const& name) { this->Names.clear(); this->AddName(name); } bool cmFindLibraryHelper::CheckDirectory(std::string const& path) { for (std::vector<Name>::iterator i = this->Names.begin(); i != this->Names.end(); ++i) { if (this->CheckDirectoryForName(path, *i)) { return true; } } return false; } bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path, Name& name) { // If the original library name provided by the user matches one of // the suffixes, try it first. This allows users to search // specifically for a static library on some platforms (on MS tools // one cannot tell just from the library name whether it is a static // library or an import library). if (name.TryRaw) { this->TestPath = path; this->TestPath += name.Raw; if (cmSystemTools::FileExists(this->TestPath.c_str(), true)) { this->BestPath = cmSystemTools::CollapseFullPath(this->TestPath); cmSystemTools::ConvertToUnixSlashes(this->BestPath); return true; } } // No library file has yet been found. size_type bestPrefix = this->Prefixes.size(); size_type bestSuffix = this->Suffixes.size(); unsigned int bestMajor = 0; unsigned int bestMinor = 0; // Search for a file matching the library name regex. std::string dir = path; cmSystemTools::ConvertToUnixSlashes(dir); std::set<std::string> const& files = this->GG->GetDirectoryContent(dir); for (std::set<std::string>::const_iterator fi = files.begin(); fi != files.end(); ++fi) { std::string const& origName = *fi; #if defined(_WIN32) || defined(__APPLE__) std::string testName = cmSystemTools::LowerCase(origName); #else std::string const& testName = origName; #endif if (name.Regex.find(testName)) { this->TestPath = path; this->TestPath += origName; if (!cmSystemTools::FileIsDirectory(this->TestPath)) { // This is a matching file. Check if it is better than the // best name found so far. Earlier prefixes are preferred, // followed by earlier suffixes. For OpenBSD, shared library // version extensions are compared. size_type prefix = this->GetPrefixIndex(name.Regex.match(1)); size_type suffix = this->GetSuffixIndex(name.Regex.match(2)); unsigned int major = 0; unsigned int minor = 0; if (this->OpenBSD) { sscanf(name.Regex.match(3).c_str(), ".%u.%u", &major, &minor); } if (this->BestPath.empty() || prefix < bestPrefix || (prefix == bestPrefix && suffix < bestSuffix) || (prefix == bestPrefix && suffix == bestSuffix && (major > bestMajor || (major == bestMajor && minor > bestMinor)))) { this->BestPath = this->TestPath; bestPrefix = prefix; bestSuffix = suffix; bestMajor = major; bestMinor = minor; } } } } // Use the best candidate found in this directory, if any. return !this->BestPath.empty(); } std::string cmFindLibraryCommand::FindNormalLibrary() { if (this->NamesPerDir) { return this->FindNormalLibraryNamesPerDir(); } return this->FindNormalLibraryDirsPerName(); } std::string cmFindLibraryCommand::FindNormalLibraryNamesPerDir() { // Search for all names in each directory. cmFindLibraryHelper helper(this->Makefile); for (std::vector<std::string>::const_iterator ni = this->Names.begin(); ni != this->Names.end(); ++ni) { helper.AddName(*ni); } // Search every directory. for (std::vector<std::string>::const_iterator p = this->SearchPaths.begin(); p != this->SearchPaths.end(); ++p) { if (helper.CheckDirectory(*p)) { return helper.BestPath; } } // Couldn't find the library. return ""; } std::string cmFindLibraryCommand::FindNormalLibraryDirsPerName() { // Search the entire path for each name. cmFindLibraryHelper helper(this->Makefile); for (std::vector<std::string>::const_iterator ni = this->Names.begin(); ni != this->Names.end(); ++ni) { // Switch to searching for this name. helper.SetName(*ni); // Search every directory. for (std::vector<std::string>::const_iterator p = this->SearchPaths.begin(); p != this->SearchPaths.end(); ++p) { if (helper.CheckDirectory(*p)) { return helper.BestPath; } } } // Couldn't find the library. return ""; } std::string cmFindLibraryCommand::FindFrameworkLibrary() { if (this->NamesPerDir) { return this->FindFrameworkLibraryNamesPerDir(); } return this->FindFrameworkLibraryDirsPerName(); } std::string cmFindLibraryCommand::FindFrameworkLibraryNamesPerDir() { std::string fwPath; // Search for all names in each search path. for (std::vector<std::string>::const_iterator di = this->SearchPaths.begin(); di != this->SearchPaths.end(); ++di) { for (std::vector<std::string>::const_iterator ni = this->Names.begin(); ni != this->Names.end(); ++ni) { fwPath = *di; fwPath += *ni; fwPath += ".framework"; if (cmSystemTools::FileIsDirectory(fwPath)) { return cmSystemTools::CollapseFullPath(fwPath); } } } // No framework found. return ""; } std::string cmFindLibraryCommand::FindFrameworkLibraryDirsPerName() { std::string fwPath; // Search for each name in all search paths. for (std::vector<std::string>::const_iterator ni = this->Names.begin(); ni != this->Names.end(); ++ni) { for (std::vector<std::string>::const_iterator di = this->SearchPaths.begin(); di != this->SearchPaths.end(); ++di) { fwPath = *di; fwPath += *ni; fwPath += ".framework"; if (cmSystemTools::FileIsDirectory(fwPath)) { return cmSystemTools::CollapseFullPath(fwPath); } } } // No framework found. return ""; }