diff options
-rw-r--r-- | indra/cmake/LLAddBuildTest.cmake | 56 | ||||
-rw-r--r-- | indra/cmake/LLSharedLibs.cmake | 7 | ||||
-rw-r--r-- | indra/cmake/LLTestCommand.cmake | 11 | ||||
-rw-r--r-- | indra/lib/python/indra/util/llmanifest.py | 14 | ||||
-rwxr-xr-x | indra/newview/viewer_manifest.py | 112 | ||||
-rw-r--r-- | indra/test/CMakeLists.txt | 14 |
6 files changed, 125 insertions, 89 deletions
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) diff --git a/indra/cmake/LLSharedLibs.cmake b/indra/cmake/LLSharedLibs.cmake index 6f602680f4..b32a46b736 100644 --- a/indra/cmake/LLSharedLibs.cmake +++ b/indra/cmake/LLSharedLibs.cmake @@ -5,7 +5,7 @@ macro(ll_deploy_sharedlibs_command target_exe) get_filename_component(OUTPUT_PATH ${TARGET_LOCATION} PATH) if(DARWIN) - set(SEARCH_DIRS "${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources") + SET_TEST_LIST(SEARCH_DIRS) get_target_property(IS_BUNDLE ${target_exe} MACOSX_BUNDLE) if(IS_BUNDLE) # If its a bundle the exe is not in the target location, this should find it. @@ -15,9 +15,10 @@ macro(ll_deploy_sharedlibs_command target_exe) set(OUTPUT_PATH ${OUTPUT_PATH}/../Resources) endif(IS_BUNDLE) elseif(WINDOWS) - set(SEARCH_DIRS "${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}" "$ENV{SystemRoot}/system32") + SET_TEST_LIST(SEARCH_DIRS) + LIST(APPEND SEARCH_DIRS "$ENV{SystemRoot}/system32") elseif(LINUX) - set(SEARCH_DIRS "${SHARED_LIB_STAGING_DIR}") + SET_TEST_LIST(SEARCH_DIRS) set(OUTPUT_PATH ${OUTPUT_PATH}/lib) endif(DARWIN) diff --git a/indra/cmake/LLTestCommand.cmake b/indra/cmake/LLTestCommand.cmake index fae5640493..3002720754 100644 --- a/indra/cmake/LLTestCommand.cmake +++ b/indra/cmake/LLTestCommand.cmake @@ -1,13 +1,14 @@ -MACRO(LL_TEST_COMMAND LD_LIBRARY_PATH) +MACRO(LL_TEST_COMMAND OUTVAR LD_LIBRARY_PATH) # nat wonders how Kitware can use the term 'function' for a construct that # cannot return a value. And yet, variables you set inside a FUNCTION are # local. Try a MACRO instead. - SET(LL_TEST_COMMAND_value + SET(value ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/cmake/run_build_test.py") IF(LD_LIBRARY_PATH) - LIST(APPEND LL_TEST_COMMAND_value "-l${LD_LIBRARY_PATH}") + LIST(APPEND value "-l${LD_LIBRARY_PATH}") ENDIF(LD_LIBRARY_PATH) - LIST(APPEND LL_TEST_COMMAND_value ${ARGN}) -##MESSAGE(STATUS "Will run: ${LL_TEST_COMMAND_value}") + LIST(APPEND value ${ARGN}) + SET(${OUTVAR} ${value}) +##MESSAGE(STATUS "Will run: ${value}") ENDMACRO(LL_TEST_COMMAND) diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py index 7e5b86c53f..c33a03034a 100644 --- a/indra/lib/python/indra/util/llmanifest.py +++ b/indra/lib/python/indra/util/llmanifest.py @@ -39,6 +39,7 @@ import shutil import sys import tarfile import errno +import subprocess def path_ancestors(path): drive, path = os.path.splitdrive(os.path.normpath(path)) @@ -366,20 +367,23 @@ class LLManifest(object): def run_command(self, command): """ Runs an external command, and returns the output. Raises - an exception if the command reurns a nonzero status code. For - debugging/informational purpoases, prints out the command's + an exception if the command returns a nonzero status code. For + debugging/informational purposes, prints out the command's output as it is received.""" print "Running command:", command - fd = os.popen(command, 'r') + sys.stdout.flush() + child = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + shell=True) lines = [] while True: - lines.append(fd.readline()) + lines.append(child.stdout.readline()) if lines[-1] == '': break else: print lines[-1], output = ''.join(lines) - status = fd.close() + child.stdout.close() + status = child.wait() if status: raise RuntimeError( "Command %s returned non-zero status (%s) \noutput:\n%s" diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 0fd3cf5b3b..0b30128ff3 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -34,6 +34,7 @@ import sys import os.path import re import tarfile +import time viewer_dir = os.path.dirname(__file__) # add llmanifest library to our path so we don't have to muck with PYTHONPATH sys.path.append(os.path.join(viewer_dir, '../lib/python/indra/util')) @@ -737,55 +738,72 @@ class DarwinManifest(ViewerManifest): # mount the image and get the name of the mount point and device node hdi_output = self.run_command('hdiutil attach -private %r' % sparsename) - devfile = re.search("/dev/disk([0-9]+)[^s]", hdi_output).group(0).strip() - volpath = re.search('HFS\s+(.+)', hdi_output).group(1).strip() + try: + devfile = re.search("/dev/disk([0-9]+)[^s]", hdi_output).group(0).strip() + volpath = re.search('HFS\s+(.+)', hdi_output).group(1).strip() - # Copy everything in to the mounted .dmg + # Copy everything in to the mounted .dmg - if self.default_channel() and not self.default_grid(): - app_name = "Second Life " + self.args['grid'] - else: - app_name = channel_standin.strip() - - # Hack: - # Because there is no easy way to coerce the Finder into positioning - # the app bundle in the same place with different app names, we are - # adding multiple .DS_Store files to svn. There is one for release, - # one for release candidate and one for first look. Any other channels - # will use the release .DS_Store, and will look broken. - # - Ambroff 2008-08-20 - dmg_template = os.path.join( - 'installers', - 'darwin', - '%s-dmg' % "".join(self.channel_unique().split()).lower()) - - if not os.path.exists (self.src_path_of(dmg_template)): - dmg_template = os.path.join ('installers', 'darwin', 'release-dmg') - - for s,d in {self.get_dst_prefix():app_name + ".app", - os.path.join(dmg_template, "_VolumeIcon.icns"): ".VolumeIcon.icns", - os.path.join(dmg_template, "background.jpg"): "background.jpg", - os.path.join(dmg_template, "_DS_Store"): ".DS_Store"}.items(): - print "Copying to dmg", s, d - self.copy_action(self.src_path_of(s), os.path.join(volpath, d)) - - # Hide the background image, DS_Store file, and volume icon file (set their "visible" bit) - for f in ".VolumeIcon.icns", "background.jpg", ".DS_Store": - self.run_command('SetFile -a V %r' % os.path.join(volpath, f)) - - # Create the alias file (which is a resource file) from the .r - self.run_command('rez %r -o %r' % - (self.src_path_of("installers/darwin/release-dmg/Applications-alias.r"), - os.path.join(volpath, "Applications"))) - - # Set the alias file's alias and custom icon bits - self.run_command('SetFile -a AC %r' % os.path.join(volpath, "Applications")) - - # Set the disk image root's custom icon bit - self.run_command('SetFile -a C %r' % volpath) - - # Unmount the image - self.run_command('hdiutil detach -force %r' % devfile) + if self.default_channel() and not self.default_grid(): + app_name = "Second Life " + self.args['grid'] + else: + app_name = channel_standin.strip() + + # Hack: + # Because there is no easy way to coerce the Finder into positioning + # the app bundle in the same place with different app names, we are + # adding multiple .DS_Store files to svn. There is one for release, + # one for release candidate and one for first look. Any other channels + # will use the release .DS_Store, and will look broken. + # - Ambroff 2008-08-20 + dmg_template = os.path.join( + 'installers', + 'darwin', + '%s-dmg' % "".join(self.channel_unique().split()).lower()) + + if not os.path.exists (self.src_path_of(dmg_template)): + dmg_template = os.path.join ('installers', 'darwin', 'release-dmg') + + for s,d in {self.get_dst_prefix():app_name + ".app", + os.path.join(dmg_template, "_VolumeIcon.icns"): ".VolumeIcon.icns", + os.path.join(dmg_template, "background.jpg"): "background.jpg", + os.path.join(dmg_template, "_DS_Store"): ".DS_Store"}.items(): + print "Copying to dmg", s, d + self.copy_action(self.src_path_of(s), os.path.join(volpath, d)) + + # Hide the background image, DS_Store file, and volume icon file (set their "visible" bit) + for f in ".VolumeIcon.icns", "background.jpg", ".DS_Store": + pathname = os.path.join(volpath, f) + # We've observed mysterious "no such file" failures of the SetFile + # command, especially on the first file listed above -- yet + # subsequent inspection of the target directory confirms it's + # there. Timing problem with copy command? Try to handle. + for x in xrange(3): + if os.path.exists(pathname): + print "Confirmed existence: %r" % pathname + break + print "Waiting for %s copy command to complete (%s)..." % (f, x+1) + sys.stdout.flush() + time.sleep(1) + # If we fall out of the loop above without a successful break, oh + # well, possibly we've mistaken the nature of the problem. In any + # case, don't hang up the whole build looping indefinitely, let + # the original problem manifest by executing the desired command. + self.run_command('SetFile -a V %r' % pathname) + + # Create the alias file (which is a resource file) from the .r + self.run_command('rez %r -o %r' % + (self.src_path_of("installers/darwin/release-dmg/Applications-alias.r"), + os.path.join(volpath, "Applications"))) + + # Set the alias file's alias and custom icon bits + self.run_command('SetFile -a AC %r' % os.path.join(volpath, "Applications")) + + # Set the disk image root's custom icon bit + self.run_command('SetFile -a C %r' % volpath) + finally: + # Unmount the image even if exceptions from any of the above + self.run_command('hdiutil detach -force %r' % devfile) print "Converting temp disk image to final disk image" self.run_command('hdiutil convert %(sparse)r -format UDZO -imagekey zlib-level=9 -o %(final)r' % {'sparse':sparsename, 'final':finalname}) diff --git a/indra/test/CMakeLists.txt b/indra/test/CMakeLists.txt index c1360987a5..955c77c041 100644 --- a/indra/test/CMakeLists.txt +++ b/indra/test/CMakeLists.txt @@ -13,6 +13,7 @@ include(LLXML) include(LScript) include(Linking) include(Tut) +include(LLAddBuildTest) include(GoogleMock) @@ -117,19 +118,12 @@ endif (WINDOWS) get_target_property(TEST_EXE test LOCATION) -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}" +SET_TEST_PATH(LD_LIBRARY_PATH) +LL_TEST_COMMAND(command "${LD_LIBRARY_PATH}" "${TEST_EXE}" "--output=${CMAKE_CURRENT_BINARY_DIR}/cpp_test_results.txt" "--touch=${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt") ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt - COMMAND ${LL_TEST_COMMAND_value} + COMMAND ${command} DEPENDS test WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "C++ unit tests" |