Skip to content

Commit 246eedf

Browse files
committed
Merge branch 'js/cmake-updates'
Update to build procedure with VS using CMake/CTest. * js/cmake-updates: cmake: increase time-out for a long-running test cmake: avoid editing t/test-lib.sh add -p: avoid ambiguous signed/unsigned comparison cmake: copy the merge tools for testing cmake: make it easier to diagnose regressions in CTest runs
2 parents 702bb4b + c858750 commit 246eedf

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/fuzz_corpora
2+
/GIT-BUILD-DIR
23
/GIT-BUILD-OPTIONS
34
/GIT-CFLAGS
45
/GIT-LDFLAGS

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3042,6 +3042,7 @@ else
30423042
@echo RUNTIME_PREFIX=\'false\' >>$@+
30433043
endif
30443044
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
3045+
@if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
30453046

30463047
### Detect Python interpreter path changes
30473048
ifndef NO_PYTHON

contrib/buildsystems/CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,18 +1074,14 @@ endif()
10741074
#Make the tests work when building out of the source tree
10751075
get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE)
10761076
if(NOT ${CMAKE_BINARY_DIR}/CMakeCache.txt STREQUAL ${CACHE_PATH})
1077-
file(RELATIVE_PATH BUILD_DIR_RELATIVE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/CMakeCache.txt)
1078-
string(REPLACE "/CMakeCache.txt" "" BUILD_DIR_RELATIVE ${BUILD_DIR_RELATIVE})
10791077
#Setting the build directory in test-lib.sh before running tests
10801078
file(WRITE ${CMAKE_BINARY_DIR}/CTestCustom.cmake
1081-
"file(STRINGS ${CMAKE_SOURCE_DIR}/t/test-lib.sh GIT_BUILD_DIR_REPL REGEX \"GIT_BUILD_DIR=(.*)\")\n"
1082-
"file(STRINGS ${CMAKE_SOURCE_DIR}/t/test-lib.sh content NEWLINE_CONSUME)\n"
1083-
"string(REPLACE \"\${GIT_BUILD_DIR_REPL}\" \"GIT_BUILD_DIR=\\\"$TEST_DIRECTORY/../${BUILD_DIR_RELATIVE}\\\"\" content \"\${content}\")\n"
1084-
"file(WRITE ${CMAKE_SOURCE_DIR}/t/test-lib.sh \${content})")
1079+
"file(WRITE ${CMAKE_SOURCE_DIR}/GIT-BUILD-DIR \"${CMAKE_BINARY_DIR}\")")
10851080
#misc copies
10861081
file(COPY ${CMAKE_SOURCE_DIR}/t/chainlint.pl DESTINATION ${CMAKE_BINARY_DIR}/t/)
10871082
file(COPY ${CMAKE_SOURCE_DIR}/po/is.po DESTINATION ${CMAKE_BINARY_DIR}/po/)
1088-
file(COPY ${CMAKE_SOURCE_DIR}/mergetools/tkdiff DESTINATION ${CMAKE_BINARY_DIR}/mergetools/)
1083+
file(GLOB mergetools "${CMAKE_SOURCE_DIR}/mergetools/*")
1084+
file(COPY ${mergetools} DESTINATION ${CMAKE_BINARY_DIR}/mergetools/)
10891085
file(COPY ${CMAKE_SOURCE_DIR}/contrib/completion/git-prompt.sh DESTINATION ${CMAKE_BINARY_DIR}/contrib/completion/)
10901086
file(COPY ${CMAKE_SOURCE_DIR}/contrib/completion/git-completion.bash DESTINATION ${CMAKE_BINARY_DIR}/contrib/completion/)
10911087
endif()
@@ -1095,8 +1091,12 @@ file(GLOB test_scipts "${CMAKE_SOURCE_DIR}/t/t[0-9]*.sh")
10951091
#test
10961092
foreach(tsh ${test_scipts})
10971093
add_test(NAME ${tsh}
1098-
COMMAND ${SH_EXE} ${tsh}
1094+
COMMAND ${SH_EXE} ${tsh} --no-bin-wrappers --no-chain-lint -vx
10991095
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/t)
11001096
endforeach()
11011097

1098+
# This test script takes an extremely long time and is known to time out even
1099+
# on fast machines because it requires in excess of one hour to run
1100+
set_tests_properties("${CMAKE_SOURCE_DIR}/t/t7112-reset-submodule.sh" PROPERTIES TIMEOUT 4000)
1101+
11021102
endif()#BUILD_TESTING

t/test-lib.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ then
4747
echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
4848
exit 1
4949
fi
50+
if test -f "$GIT_BUILD_DIR/GIT-BUILD-DIR"
51+
then
52+
GIT_BUILD_DIR="$(cat "$GIT_BUILD_DIR/GIT-BUILD-DIR")" || exit 1
53+
# On Windows, we must convert Windows paths lest they contain a colon
54+
case "$(uname -s)" in
55+
*MINGW*)
56+
GIT_BUILD_DIR="$(cygpath -au "$GIT_BUILD_DIR")"
57+
;;
58+
esac
59+
fi
5060

5161
# Prepend a string to a VAR using an arbitrary ":" delimiter, not
5262
# adding the delimiter if VAR or VALUE is empty. I.e. a generalized:

0 commit comments

Comments
 (0)