From 477fb26c1ef458b6b552c7ac42bd0f18a483770f Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 18 Jun 2010 17:38:21 -0400 Subject: Centralize LD_LIBRARY_PATH logic with new SET_TEST_PATH macro. Add ${SHARED_LIB_STAGING_DIR_RELEASE} to LD_LIBRARY_PATH for executing tests: otherwise Debug-build tests can't find (e.g.) the aprutil DLL, for which we don't build/package a debug variant. Leverage discovery that a CMake macro can accept a target variable name argument for LL_TEST_COMMAND macro. --- indra/cmake/LLAddBuildTest.cmake | 56 ++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 19 deletions(-) (limited to 'indra/cmake/LLAddBuildTest.cmake') diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake index bf4d9b72a9..e0c0ae2246 100644 --- a/indra/cmake/LLAddBuildTest.cmake +++ b/indra/cmake/LLAddBuildTest.cmake @@ -141,17 +141,9 @@ INCLUDE(GoogleMock) IF(LL_TEST_VERBOSE) MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_cmd = ${TEST_CMD}") ENDIF(LL_TEST_VERBOSE) - - IF(WINDOWS) - set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}) - ELSEIF(DARWIN) - set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources:/usr/lib) - ELSE(WINDOWS) - set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}:/usr/lib) - ENDIF(WINDOWS) - LL_TEST_COMMAND("${LD_LIBRARY_PATH}" ${TEST_CMD}) - SET(TEST_SCRIPT_CMD ${LL_TEST_COMMAND_value}) + SET_TEST_PATH(LD_LIBRARY_PATH) + LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${TEST_CMD}) IF(LL_TEST_VERBOSE) MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_script = ${TEST_SCRIPT_CMD}") ENDIF(LL_TEST_VERBOSE) @@ -233,16 +225,9 @@ FUNCTION(LL_ADD_INTEGRATION_TEST LIST(INSERT test_command test_exe_pos "${TEST_EXE}") ENDIF (test_exe_pos LESS 0) - IF(WINDOWS) - set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}) - ELSEIF(DARWIN) - set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources:/usr/lib) - ELSE(WINDOWS) - set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}:/usr/lib) - ENDIF(WINDOWS) + SET_TEST_PATH(LD_LIBRARY_PATH) - LL_TEST_COMMAND("${LD_LIBRARY_PATH}" ${test_command}) - SET(TEST_SCRIPT_CMD ${LL_TEST_COMMAND_value}) + LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${test_command}) if(TEST_DEBUG) message(STATUS "TEST_SCRIPT_CMD: ${TEST_SCRIPT_CMD}") @@ -258,3 +243,36 @@ FUNCTION(LL_ADD_INTEGRATION_TEST # ADD_TEST(INTEGRATION_TEST_RUNNER_${testname} ${TEST_SCRIPT_CMD}) ENDFUNCTION(LL_ADD_INTEGRATION_TEST) + +MACRO(SET_TEST_LIST LISTVAR) + IF(WINDOWS) + # We typically build/package only Release variants of third-party + # libraries, so append the Release staging dir in case the library being + # sought doesn't have a debug variant. + set(${LISTVAR} ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR} ${SHARED_LIB_STAGING_DIR}/Release) + ELSEIF(DARWIN) + # We typically build/package only Release variants of third-party + # libraries, so append the Release staging dir in case the library being + # sought doesn't have a debug variant. + set(${LISTVAR} ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources ${SHARED_LIB_STAGING_DIR}/Release/Resources /usr/lib) + ELSE(WINDOWS) + # Linux uses a single staging directory anyway. + set(${LISTVAR} ${SHARED_LIB_STAGING_DIR} /usr/lib) + ENDIF(WINDOWS) +ENDMACRO(SET_TEST_LIST) + +MACRO(SET_TEST_PATH PATHVAR) + set_test_list(test_list) + IF(WINDOWS) + set(sep "\;") + ELSE(WINDOWS) + set(sep ":") + ENDIF(WINDOWS) + set(path "") + set(optsep "") + foreach(dir ${test_list}) + set(path "${path}${optsep}${dir}") + set(optsep "${sep}") + endforeach(dir) + set(${PATHVAR} "${path}") +ENDMACRO(SET_TEST_PATH) -- cgit v1.2.3 From 4e538adca41d486125c3b887ce694c457bcab157 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 21 Jun 2010 12:18:16 -0400 Subject: EXT-7926: fix broken LD_LIBRARY_PATH handling on Windows. Recent checkins introduced two different CMake macros SET_TEST_LIST (which returned a CMake list of PATH directory strings) and SET_TEST_PATH (which returned a single platform-appropriate PATH string). On Windows, whose path-separator character is ';', SET_TEST_PATH interacted badly with CMake: in CMake, a single string containing ';' characters is indistinguishable from a list of strings. Eliminate the return-single-string form, redirecting the name SET_TEST_PATH to the macro that returns a CMake list. Make LL_TEST_COMMAND expect a list value, prepending each directory string with run_build_test.py's -l switch. --- indra/cmake/LLAddBuildTest.cmake | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'indra/cmake/LLAddBuildTest.cmake') diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake index e0c0ae2246..dd49caaf20 100644 --- a/indra/cmake/LLAddBuildTest.cmake +++ b/indra/cmake/LLAddBuildTest.cmake @@ -226,7 +226,6 @@ FUNCTION(LL_ADD_INTEGRATION_TEST ENDIF (test_exe_pos LESS 0) SET_TEST_PATH(LD_LIBRARY_PATH) - LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${test_command}) if(TEST_DEBUG) @@ -244,7 +243,7 @@ FUNCTION(LL_ADD_INTEGRATION_TEST ENDFUNCTION(LL_ADD_INTEGRATION_TEST) -MACRO(SET_TEST_LIST LISTVAR) +MACRO(SET_TEST_PATH LISTVAR) IF(WINDOWS) # We typically build/package only Release variants of third-party # libraries, so append the Release staging dir in case the library being @@ -259,20 +258,4 @@ MACRO(SET_TEST_LIST LISTVAR) # Linux uses a single staging directory anyway. set(${LISTVAR} ${SHARED_LIB_STAGING_DIR} /usr/lib) ENDIF(WINDOWS) -ENDMACRO(SET_TEST_LIST) - -MACRO(SET_TEST_PATH PATHVAR) - set_test_list(test_list) - IF(WINDOWS) - set(sep "\;") - ELSE(WINDOWS) - set(sep ":") - ENDIF(WINDOWS) - set(path "") - set(optsep "") - foreach(dir ${test_list}) - set(path "${path}${optsep}${dir}") - set(optsep "${sep}") - endforeach(dir) - set(${PATHVAR} "${path}") ENDMACRO(SET_TEST_PATH) -- cgit v1.2.3