From 7679f9fab099e729b61320927a9e0b8d03546f7f Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 16 Dec 2010 16:50:16 -0500 Subject: Rename WorkingDirectory test --- Tests/CMakeLists.txt | 12 +++---- Tests/TestsWorkingDirectory/CMakeLists.txt | 29 ++++++++++++++++ Tests/TestsWorkingDirectory/main.cxx | 56 ++++++++++++++++++++++++++++++ Tests/WorkingDirectory/CMakeLists.txt | 29 ---------------- Tests/WorkingDirectory/main.cxx | 56 ------------------------------ 5 files changed, 91 insertions(+), 91 deletions(-) create mode 100644 Tests/TestsWorkingDirectory/CMakeLists.txt create mode 100644 Tests/TestsWorkingDirectory/main.cxx delete mode 100644 Tests/WorkingDirectory/CMakeLists.txt delete mode 100644 Tests/WorkingDirectory/main.cxx diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 8c89be5..0e1edfc 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1084,18 +1084,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest") ENDIF(APPLE AND CTEST_TEST_CPACK) - ADD_TEST(WorkingDirectory ${CMAKE_CTEST_COMMAND} + ADD_TEST(TestsWorkingDirectory ${CMAKE_CTEST_COMMAND} --build-and-test - "${CMake_SOURCE_DIR}/Tests/WorkingDirectory" - "${CMake_BINARY_DIR}/Tests/WorkingDirectory" + "${CMake_SOURCE_DIR}/Tests/TestsWorkingDirectory" + "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory" --build-generator ${CMAKE_TEST_GENERATOR} - --build-project WorkingDirectoryProj + --build-project TestsWorkingDirectoryProj --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} - --build-exe-dir "${CMake_BINARY_DIR}/Tests/WorkingDirectory" + --build-exe-dir "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory" --force-new-ctest-process --test-command ${CMAKE_CTEST_COMMAND} -V ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WorkingDirectory") + LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory") # Make sure CTest can handle a test with no newline in output. ADD_TEST(CTest.NoNewline diff --git a/Tests/TestsWorkingDirectory/CMakeLists.txt b/Tests/TestsWorkingDirectory/CMakeLists.txt new file mode 100644 index 0000000..5fbcd2a --- /dev/null +++ b/Tests/TestsWorkingDirectory/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 2.6) +project(WorkingDirectoryProj) + +add_executable(WorkingDirectory main.cxx) + +enable_testing() + +add_test(NAME WorkingDirectory1 COMMAND WorkingDirectory) +add_test(NAME WorkingDirectory2 COMMAND WorkingDirectory) +add_test(WorkingDirectory3 WorkingDirectory) + +set_tests_properties(WorkingDirectory1 PROPERTIES + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + PASS_REGULAR_EXPRESSION "Working directory: ${CMAKE_BINARY_DIR}" +) + +string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}") + +set_tests_properties(WorkingDirectory2 PROPERTIES + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/.." + PASS_REGULAR_EXPRESSION "Working directory: ${_parent_dir}" +) + +string(REGEX REPLACE "/[^/]*$" "" _wd_exe "${CMAKE_BINARY_DIR}") +get_filename_component(_default_cwd "${_wd_exe}" ABSOLUTE) + +set_tests_properties(WorkingDirectory3 PROPERTIES + PASS_REGULAR_EXPRESSION "Working directory: ${_default_cwd}" +) diff --git a/Tests/TestsWorkingDirectory/main.cxx b/Tests/TestsWorkingDirectory/main.cxx new file mode 100644 index 0000000..6636da0 --- /dev/null +++ b/Tests/TestsWorkingDirectory/main.cxx @@ -0,0 +1,56 @@ +#include +#include + +#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) + +#include +#include + +#if defined(__WATCOMC__) +#include +#define _getcwd getcwd +#endif + +inline const char* Getcwd(char* buf, unsigned int len) +{ + const char* ret = _getcwd(buf, len); + if(!ret) + { + fprintf(stderr, "No current working directory.\n"); + abort(); + } + // make sure the drive letter is capital + if(strlen(buf) > 1 && buf[1] == ':') + { + buf[0] = toupper(buf[0]); + } + return ret; +} + +#else +#include +#include +#include + +inline const char* Getcwd(char* buf, unsigned int len) +{ + const char* ret = getcwd(buf, len); + if(!ret) + { + fprintf(stderr, "No current working directory\n"); + abort(); + } + return ret; +} + +#endif + +int main(int argc, char *argv[]) +{ + char buf[2048]; + const char *cwd = Getcwd(buf, sizeof(buf)); + + fprintf(stdout, "Working directory: %s\n", cwd); + + return 0; +} diff --git a/Tests/WorkingDirectory/CMakeLists.txt b/Tests/WorkingDirectory/CMakeLists.txt deleted file mode 100644 index 5fbcd2a..0000000 --- a/Tests/WorkingDirectory/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -cmake_minimum_required(VERSION 2.6) -project(WorkingDirectoryProj) - -add_executable(WorkingDirectory main.cxx) - -enable_testing() - -add_test(NAME WorkingDirectory1 COMMAND WorkingDirectory) -add_test(NAME WorkingDirectory2 COMMAND WorkingDirectory) -add_test(WorkingDirectory3 WorkingDirectory) - -set_tests_properties(WorkingDirectory1 PROPERTIES - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" - PASS_REGULAR_EXPRESSION "Working directory: ${CMAKE_BINARY_DIR}" -) - -string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}") - -set_tests_properties(WorkingDirectory2 PROPERTIES - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/.." - PASS_REGULAR_EXPRESSION "Working directory: ${_parent_dir}" -) - -string(REGEX REPLACE "/[^/]*$" "" _wd_exe "${CMAKE_BINARY_DIR}") -get_filename_component(_default_cwd "${_wd_exe}" ABSOLUTE) - -set_tests_properties(WorkingDirectory3 PROPERTIES - PASS_REGULAR_EXPRESSION "Working directory: ${_default_cwd}" -) diff --git a/Tests/WorkingDirectory/main.cxx b/Tests/WorkingDirectory/main.cxx deleted file mode 100644 index 6636da0..0000000 --- a/Tests/WorkingDirectory/main.cxx +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include - -#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) - -#include -#include - -#if defined(__WATCOMC__) -#include -#define _getcwd getcwd -#endif - -inline const char* Getcwd(char* buf, unsigned int len) -{ - const char* ret = _getcwd(buf, len); - if(!ret) - { - fprintf(stderr, "No current working directory.\n"); - abort(); - } - // make sure the drive letter is capital - if(strlen(buf) > 1 && buf[1] == ':') - { - buf[0] = toupper(buf[0]); - } - return ret; -} - -#else -#include -#include -#include - -inline const char* Getcwd(char* buf, unsigned int len) -{ - const char* ret = getcwd(buf, len); - if(!ret) - { - fprintf(stderr, "No current working directory\n"); - abort(); - } - return ret; -} - -#endif - -int main(int argc, char *argv[]) -{ - char buf[2048]; - const char *cwd = Getcwd(buf, sizeof(buf)); - - fprintf(stdout, "Working directory: %s\n", cwd); - - return 0; -} -- cgit v0.12