summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2001-08-23 20:00:46 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2001-08-23 20:00:46 (GMT)
commit047c7b5af487a4752a0ee39c0fc841e4102d7756 (patch)
tree92aa3f1abb45ea10731f54563d3b03aca51a0d89
parent3a3b55679b1c28ac4d7c24c2de2ce28d88a3d21c (diff)
downloadCMake-047c7b5af487a4752a0ee39c0fc841e4102d7756.zip
CMake-047c7b5af487a4752a0ee39c0fc841e4102d7756.tar.gz
CMake-047c7b5af487a4752a0ee39c0fc841e4102d7756.tar.bz2
ENH: add more testing
-rw-r--r--Source/CMakeLists.txt8
-rw-r--r--Source/cmStandardIncludes.h4
-rw-r--r--Source/cmaketest.cxx42
-rw-r--r--Source/ctest.cxx4
4 files changed, 43 insertions, 15 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index f0f3699..1eb94ff 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -68,8 +68,12 @@ IF(BUILD_TESTING)
${CMake_BINARY_DIR}/Source/cmaketest.h ESCAPE_QUOTES)
ADD_TEST(simple ${CMake_BINARY_DIR}/Source/cmaketest
${CMake_SOURCE_DIR}/Tests/Simple
- ${CMake_BINARY_DIR}/Tests/Simple simple
- )
+ ${CMake_BINARY_DIR}/Tests/Simple simple )
+ ADD_TEST(complex ${CMake_BINARY_DIR}/Source/cmaketest
+ ${CMake_SOURCE_DIR}/Tests/Complex
+ ${CMake_BINARY_DIR}/Tests/Complex
+ complex
+ ${CMake_BINARY_DIR}/Tests/Complex/bin )
ENDIF (DART_ROOT)
ENDIF(BUILD_TESTING)
diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index ffae33a..570dc66 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -131,7 +131,9 @@ inline bool operator==(std::string const& a, const char* b)
{ return (a==std::string(b)); }
# endif // end CM_SGI_CC_720
-
+// use this class to shring the size of symbols in .o files
+// std::string is really basic_string<....lots of stuff....>
+// when combined with a map or set, the symbols can be > 2000 chars!
struct cmStdString : public std::string
{
typedef std::string Parent;
diff --git a/Source/cmaketest.cxx b/Source/cmaketest.cxx
index c59dea6..666acf3 100644
--- a/Source/cmaketest.cxx
+++ b/Source/cmaketest.cxx
@@ -15,7 +15,15 @@ int main (int argc, char *argv[])
{
cmSystemTools::MakeDirectory(argv[2]);
}
-
+ const char* sourceDirectory = argv[1];
+ const char* binaryDirectory = argv[2];
+ const char* executableName = argv[3];
+ const char* executableDirectory = "";
+ if(argc > 4)
+ {
+ executableDirectory = argv[4];
+ }
+
/**
* Run an executable command and put the stdout in output.
*/
@@ -23,10 +31,10 @@ int main (int argc, char *argv[])
// change to the tests directory and run cmake
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
- cmSystemTools::ChangeDirectory(argv[2]);
+ cmSystemTools::ChangeDirectory(binaryDirectory);
std::string ccmd = CMAKE_COMMAND;
ccmd += " ";
- ccmd += argv[1];
+ ccmd += sourceDirectory;
if (!cmSystemTools::RunCommand(ccmd.c_str(), output))
{
std::cerr << "Error: cmake execution failed\n";
@@ -39,7 +47,7 @@ int main (int argc, char *argv[])
// now build the test
std::string makeCommand = MAKEPROGRAM;
makeCommand += " ";
- makeCommand += argv[3];
+ makeCommand += executableName;
#ifdef _WIN32
makeCommand += ".dsw /MAKE \"ALL_BUILD - Release\" /REBUILD";
#endif
@@ -55,20 +63,19 @@ int main (int argc, char *argv[])
// now run the compiled test if we can find it
// See if the executable exists as written.
std::string fullPath;
- if(cmSystemTools::FileExists(argv[3]))
+ if(cmSystemTools::FileExists(executableName))
{
- fullPath = cmSystemTools::CollapseFullPath(argv[3]);
+ fullPath = cmSystemTools::CollapseFullPath(executableName);
}
- std::string tryPath = argv[3];
+ std::string tryPath = executableName;
tryPath += cmSystemTools::GetExecutableExtension();
if(cmSystemTools::FileExists(tryPath.c_str()))
{
fullPath = cmSystemTools::CollapseFullPath(tryPath.c_str());
}
-
// try the release extension
tryPath = "Release/";
- tryPath += cmSystemTools::GetFilenameName(argv[3]);
+ tryPath += cmSystemTools::GetFilenameName(executableName);
if(cmSystemTools::FileExists(tryPath.c_str()))
{
fullPath = cmSystemTools::CollapseFullPath(tryPath.c_str());
@@ -78,7 +85,22 @@ int main (int argc, char *argv[])
{
fullPath = cmSystemTools::CollapseFullPath(tryPath.c_str());
}
-
+ tryPath = executableDirectory;
+ tryPath += "/";
+ tryPath += executableName;
+ tryPath += cmSystemTools::GetExecutableExtension();
+ if(cmSystemTools::FileExists(tryPath.c_str()))
+ {
+ fullPath = cmSystemTools::CollapseFullPath(tryPath.c_str());
+ }
+ tryPath = executableDirectory;
+ tryPath += "/Release/";
+ tryPath += executableName;
+ tryPath += cmSystemTools::GetExecutableExtension();
+ if(cmSystemTools::FileExists(tryPath.c_str()))
+ {
+ fullPath = cmSystemTools::CollapseFullPath(tryPath.c_str());
+ }
if (!cmSystemTools::RunCommand(fullPath.c_str(), output))
{
std::cerr << "Error: " << fullPath.c_str() << " execution failed\n";
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index ab97699..e231f6e 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -117,7 +117,7 @@ void ctest::ProcessDirectory(int &passed, int &failed)
nwd += *j;
if (cmSystemTools::FileIsDirectory(nwd.c_str()))
{
- cerr << "Changing directory into " << nwd.c_str() << "\n";
+ std::cerr << "Changing directory into " << nwd.c_str() << "\n";
cmSystemTools::ChangeDirectory(nwd.c_str());
this->ProcessDirectory(passed,failed);
}
@@ -128,7 +128,7 @@ void ctest::ProcessDirectory(int &passed, int &failed)
if (name == "ADD_TEST")
{
- cerr << "Testing " << args[0] << " ... ";
+ std::cerr << "Testing " << args[0] << " ... ";
// find the test executable
std::string testCommand = this->FindExecutable(args[1].c_str());
// add the arguments