summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2009-07-27 16:04:03 (GMT)
committerDavid Cole <david.cole@kitware.com>2009-07-27 16:04:03 (GMT)
commit7ae028eb3318820bc95b7a6ab2595e07f88b6a4a (patch)
treec3bee32b22a6fd4e1b4bdab5abeddbbea8ae1919 /Tests
parent38d1ff59daa197eb26e939247625f9d130281508 (diff)
downloadCMake-7ae028eb3318820bc95b7a6ab2595e07f88b6a4a.zip
CMake-7ae028eb3318820bc95b7a6ab2595e07f88b6a4a.tar.gz
CMake-7ae028eb3318820bc95b7a6ab2595e07f88b6a4a.tar.bz2
ENH: Make the CheckSourceTree test emit a warning (but pass instead of fail) when there is an in-source build on a dashboard machine.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeTests/CMakeLists.txt1
-rw-r--r--Tests/CMakeTests/CheckSourceTreeTest.cmake.in54
2 files changed, 51 insertions, 4 deletions
diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt
index 0b10dc3..2d57dd0 100644
--- a/Tests/CMakeTests/CMakeLists.txt
+++ b/Tests/CMakeTests/CMakeLists.txt
@@ -32,6 +32,7 @@ AddCMakeTest(GetPrerequisites "${GetPrerequisites_PreArgs}")
#
if(do_cvs_tests)
set(CheckSourceTree_PreArgs
+ "-DCMake_BINARY_DIR:PATH=${CMake_BINARY_DIR}"
"-DCMake_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}"
"-DCVS_EXECUTABLE:STRING=${CVS_EXECUTABLE}"
)
diff --git a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in
index cd1934b..fab5662 100644
--- a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in
+++ b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in
@@ -3,12 +3,43 @@
message("=============================================================================")
message("CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
message("")
+message("CMake_BINARY_DIR='${CMake_BINARY_DIR}'")
message("CMake_SOURCE_DIR='${CMake_SOURCE_DIR}'")
message("CVS_EXECUTABLE='${CVS_EXECUTABLE}'")
message("ENV{DASHBOARD_TEST_FROM_CTEST}='$ENV{DASHBOARD_TEST_FROM_CTEST}'")
message("")
+# Is the build directory the same as or underneath the source directory?
+# (i.e. - is it an "in source" build?)
+#
+set(in_source_build 0)
+
+if(CMake_SOURCE_DIR STREQUAL "${CMake_BINARY_DIR}")
+ message("build dir *is* source dir")
+ set(in_source_build 1)
+else()
+ string(LENGTH "${CMake_SOURCE_DIR}" src_len)
+ string(LENGTH "${CMake_BINARY_DIR}" bin_len)
+
+ if(bin_len GREATER src_len)
+ math(EXPR substr_len "${src_len}+1")
+ string(SUBSTRING "${CMake_BINARY_DIR}" 0 ${substr_len} bin_dir)
+ if(bin_dir STREQUAL "${CMake_SOURCE_DIR}/")
+ message("build dir is under source dir")
+ set(in_source_build 1)
+ endif()
+ endif()
+endif()
+
+message("src_len='${src_len}'")
+message("bin_len='${bin_len}'")
+message("substr_len='${substr_len}'")
+message("bin_dir='${bin_dir}'")
+message("in_source_build='${in_source_build}'")
+message("")
+
+
# Check with "cvs -q -n up -dP" if there are any local modifications to the
# CMake source tree:
#
@@ -92,11 +123,13 @@ message("=======================================================================
if("$ENV{DASHBOARD_TEST_FROM_CTEST}" STREQUAL "")
# developers are allowed to have local additions and modifications...
+ set(is_dashboard 0)
message("interactive test run")
message("")
else()
+ set(is_dashboard 1)
message("dashboard test run")
message("")
@@ -110,9 +143,10 @@ else()
endif()
#
- # It's a dashboard run if ctest was run with '-D ExperimentalTest' or some other
- # -D arg on its command line or if ctest is running a -S script to run a dashboard...
- # Running ctest like that causes the DASHBOARD_TEST_FROM_CTEST env var to be set.
+ # It's a dashboard run if ctest was run with '-D ExperimentalTest' or some
+ # other -D arg on its command line or if ctest is running a -S script to run
+ # a dashboard... Running ctest like that sets the DASHBOARD_TEST_FROM_CTEST
+ # env var.
#
endif()
@@ -122,7 +156,19 @@ endif()
# Not even developers.
#
if(nonadditions)
- message(FATAL_ERROR "test fails: local source tree non-additions: use cvs add before committing, or remove the files from the source tree")
+ if(in_source_build AND is_dashboard)
+ message("
+warning: test results confounded because this is an 'in-source' build - cannot
+distinguish between non-added files that are in-source build products and
+non-added source files that somebody forgot to 'cvs add'... - this is only ok
+if this is intentionally an in-source dashboard build... Developers should
+use out-of-source builds to verify a clean source tree with this test...
+
+Allowing test to pass despite the warning message...
+")
+ else()
+ message(FATAL_ERROR "test fails: local source tree non-additions: use cvs add before committing, or remove the files from the source tree")
+ endif()
endif()
if(conflicts)