diff options
author | Brad King <brad.king@kitware.com> | 2011-12-23 20:49:09 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2011-12-23 21:16:56 (GMT) |
commit | c1789e69869370889bbe57f2ec8606ba45ab5034 (patch) | |
tree | 8b5dc6cc6114c523858e56ae5b85ed5b10027d5d /Tests/Complex | |
parent | 569cee1d9ef613d4c3c87e124982463ffac3cdb2 (diff) | |
download | CMake-c1789e69869370889bbe57f2ec8606ba45ab5034.zip CMake-c1789e69869370889bbe57f2ec8606ba45ab5034.tar.gz CMake-c1789e69869370889bbe57f2ec8606ba45ab5034.tar.bz2 |
complex: Remove test dependence on cmSystemTools
Use C standard 'remove' and POSIX standard 'stat'.
Diffstat (limited to 'Tests/Complex')
-rw-r--r-- | Tests/Complex/Executable/complex.cxx | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx index f095449..ca73bcb 100644 --- a/Tests/Complex/Executable/complex.cxx +++ b/Tests/Complex/Executable/complex.cxx @@ -11,7 +11,6 @@ extern "C" { } #ifdef COMPLEX_TEST_CMAKELIB #include "cmStandardIncludes.h" -#include "cmSystemTools.h" #else #include <vector> #include <string> @@ -19,6 +18,12 @@ extern "C" { #include <string.h> #endif +#include <stdio.h> +#include <sys/stat.h> +#if !defined(S_ISDIR) +# define S_ISDIR(mode) ((mode) & _S_IFDIR) +#endif + #ifdef COMPLEX_TEST_LINK_STATIC extern "C" { @@ -69,13 +74,14 @@ void cmPassed(const char* Message, const char* m2="") void TestAndRemoveFile(const char* filename) { - if (!cmSystemTools::FileExists(filename)) + struct stat st; + if(stat(filename, &st) < 0) { cmFailed("Could not find file: ", filename); } else { - if (!cmSystemTools::RemoveFile(filename)) + if (remove(filename) < 0) { cmFailed("Unable to remove file. It does not imply that this test failed, but it *will* be corrupted thereafter if this file is not removed: ", filename); } @@ -90,20 +96,14 @@ void TestAndRemoveFile(const char* filename) void TestDir(const char* filename) { - if (!cmSystemTools::FileExists(filename)) + struct stat st; + if(stat(filename, &st) < 0 || !S_ISDIR(st.st_mode)) { cmFailed("Could not find dir: ", filename); } else { - if (!cmSystemTools::FileIsDirectory(filename)) - { - cmFailed("Unable to check if file is a directory: ", filename); - } - else - { - cmPassed("Find dir: ", filename); - } + cmPassed("Find dir: ", filename); } } |