diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/cmake/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/cmake/LLAddBuildTest.cmake | 16 | ||||
-rw-r--r-- | indra/cmake/LLTestCommand.cmake | 13 | ||||
-rw-r--r-- | indra/cmake/run_build_test.py | 22 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 8 | ||||
-rw-r--r-- | indra/test/CMakeLists.txt | 11 |
6 files changed, 44 insertions, 28 deletions
diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt index 3ce393b659..4563b59ad2 100644 --- a/indra/cmake/CMakeLists.txt +++ b/indra/cmake/CMakeLists.txt @@ -53,6 +53,7 @@ set(cmake_SOURCE_FILES LLPrimitive.cmake LLRender.cmake LLScene.cmake + LLTestCommand.cmake LLUI.cmake LLVFS.cmake LLWindow.cmake @@ -69,7 +70,6 @@ set(cmake_SOURCE_FILES PNG.cmake Python.cmake Prebuilt.cmake - RunBuildTest.cmake TemplateCheck.cmake Tut.cmake UI.cmake diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake index e6ef4f1f6b..8cd5796849 100644 --- a/indra/cmake/LLAddBuildTest.cmake +++ b/indra/cmake/LLAddBuildTest.cmake @@ -1,4 +1,5 @@ # -*- cmake -*- +include(LLTestCommand) MACRO(LL_ADD_PROJECT_UNIT_TESTS project sources) # Given a project name and a list of sourcefiles (with optional properties on each), @@ -126,17 +127,14 @@ MACRO(LL_ADD_PROJECT_UNIT_TESTS project sources) set(LD_LIBRARY_PATH ${ARCH_PREBUILT_DIRS}:${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}:/usr/lib) ENDIF(WINDOWS) + LL_TEST_COMMAND("${LD_LIBRARY_PATH}" ${TEST_CMD}) + SET(TEST_SCRIPT_CMD ${LL_TEST_COMMAND_value}) IF(LL_TEST_VERBOSE) MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_script = ${TEST_SCRIPT_CMD}") ENDIF(LL_TEST_VERBOSE) # Add test ADD_CUSTOM_COMMAND( OUTPUT ${TEST_OUTPUT} - COMMAND ${CMAKE_COMMAND} - ARGS - -DLD_LIBRARY_PATH=${LD_LIBRARY_PATH} - "-DTEST_CMD:STRING=\"${TEST_CMD}\"" - -P ${CMAKE_SOURCE_DIR}/cmake/RunBuildTest.cmake COMMAND ${TEST_SCRIPT_CMD} DEPENDS PROJECT_${project}_TEST_${name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} @@ -216,12 +214,8 @@ FUNCTION(LL_ADD_INTEGRATION_TEST set(LD_LIBRARY_PATH ${ARCH_PREBUILT_DIRS}:${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}:/usr/lib) ENDIF(WINDOWS) - SET(TEST_SCRIPT_CMD - ${CMAKE_COMMAND} - -DLD_LIBRARY_PATH="${LD_LIBRARY_PATH}" - -DTEST_CMD:STRING="${test_command}" - -P ${CMAKE_SOURCE_DIR}/cmake/RunBuildTest.cmake - ) + LL_TEST_COMMAND("${LD_LIBRARY_PATH}" ${test_command}) + SET(TEST_SCRIPT_CMD ${LL_TEST_COMMAND_value}) if(TEST_DEBUG) message(STATUS "TEST_SCRIPT_CMD: ${TEST_SCRIPT_CMD}") diff --git a/indra/cmake/LLTestCommand.cmake b/indra/cmake/LLTestCommand.cmake new file mode 100644 index 0000000000..fae5640493 --- /dev/null +++ b/indra/cmake/LLTestCommand.cmake @@ -0,0 +1,13 @@ +MACRO(LL_TEST_COMMAND 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 + ${PYTHON_EXECUTABLE} + "${CMAKE_SOURCE_DIR}/cmake/run_build_test.py") + IF(LD_LIBRARY_PATH) + LIST(APPEND LL_TEST_COMMAND_value "-l${LD_LIBRARY_PATH}") + ENDIF(LD_LIBRARY_PATH) + LIST(APPEND LL_TEST_COMMAND_value ${ARGN}) +##MESSAGE(STATUS "Will run: ${LL_TEST_COMMAND_value}") +ENDMACRO(LL_TEST_COMMAND) diff --git a/indra/cmake/run_build_test.py b/indra/cmake/run_build_test.py index 1882b644a0..17bce6f434 100644 --- a/indra/cmake/run_build_test.py +++ b/indra/cmake/run_build_test.py @@ -60,22 +60,35 @@ def main(command, libpath=[], vars={}): raise NotImplemented("run_build_test: unknown platform %s" % sys.platform)
lpvars = []
for var in lpvars:
- # Split the existing path
- dirs = os.environ[var].split(os.pathsep)
+ # Split the existing path. Bear in mind that the variable in question
+ # might not exist; instead of KeyError, just use an empty string.
+ dirs = os.environ.get(var, "").split(os.pathsep)
# Append the sequence in libpath
+## print "%s += %r" % (var, libpath)
dirs.extend(libpath)
# Now rebuild the path string. This way we use a minimum of separators
# -- and we avoid adding a pointless separator when libpath is empty.
os.environ[var] = os.pathsep.join(dirs)
# Now handle arbitrary environment variables. The tricky part is ensuring
# that all the keys and values we try to pass are actually strings.
+## if vars:
+## print "Setting:"
+## for key, value in vars.iteritems():
+## print "%s=%s" % (key, value)
os.environ.update(dict([(str(key), str(value)) for key, value in vars.iteritems()]))
# Run the child process.
+## print "Running: %s" % " ".join(command)
return subprocess.call(command)
if __name__ == "__main__":
from optparse import OptionParser
parser = OptionParser(usage="usage: %prog [options] command args...")
+ # We want optparse support for the options we ourselves handle -- but we
+ # DO NOT want it looking at options for the executable we intend to run,
+ # rejecting them as invalid because we don't define them. So configure the
+ # parser to stop looking for options as soon as it sees the first
+ # positional argument (traditional Unix syntax).
+ parser.disable_interspersed_args()
parser.add_option("-D", "--define", dest="vars", default=[], action="append",
metavar="VAR=value",
help="Add VAR=value to the env variables defined")
@@ -92,6 +105,7 @@ if __name__ == "__main__": # want.
rc = main(command=args, libpath=opts.libpath,
vars=dict([(pair.split('=', 1) + [""])[:2] for pair in opts.vars]))
- print >>sys.stderr, "Failure running: %s" % " ".join(args)
- print >>sys.stderr, "Error: %s" % rc
+ if rc not in (None, 0):
+ print >>sys.stderr, "Failure running: %s" % " ".join(args)
+ print >>sys.stderr, "Error: %s" % rc
sys.exit((rc < 0) and 255 or rc)
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index d3c5cfc390..93c203cecd 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -4271,7 +4271,7 @@ void LLAppViewer::launchUpdater() xml_search_paths.append(","); // comma-delimit } // build the overall command-line to run the updater correctly - update_exe_path = + LLAppViewer::sUpdaterInfo->mUpdateExePath = gDirUtilp->getExecutableDir() + "/" + "linux-updater.bin" + " --url \"" + update_url.asString() + "\"" + " --name \"" + LLAppViewer::instance()->getSecondLifeTitle() + "\"" + @@ -4280,12 +4280,12 @@ void LLAppViewer::launchUpdater() " --stringsfile \"" + xml_strings_file + "\""; LL_INFOS("AppInit") << "Calling updater: " - << update_exe_path << LL_ENDL; + << LLAppViewer::sUpdaterInfo->mUpdateExePath << LL_ENDL; - // *TODO: we could use the gdk equivilant to ensure the updater + // *TODO: we could use the gdk equivalent to ensure the updater // gets started on the same screen. GError *error = NULL; - if (!g_spawn_command_line_async(update_exe_path.c_str(), &error)) + if (!g_spawn_command_line_async(LLAppViewer::sUpdaterInfo->mUpdateExePath.c_str(), &error)) { llerrs << "Failed to launch updater: " << error->message diff --git a/indra/test/CMakeLists.txt b/indra/test/CMakeLists.txt index d8c3d45c5f..3e42f6929b 100644 --- a/indra/test/CMakeLists.txt +++ b/indra/test/CMakeLists.txt @@ -153,16 +153,11 @@ ELSE(WINDOWS) set(LD_LIBRARY_PATH ${ARCH_PREBUILT_DIRS}:${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}:/usr/lib) ENDIF(WINDOWS) -SET(TEST_CMD ${TEST_EXE} --output=${CMAKE_CURRENT_BINARY_DIR}/cpp_test_results.txt --touch=${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt) - +LL_TEST_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 ${CMAKE_COMMAND} - ARGS - -DLD_LIBRARY_PATH=${LD_LIBRARY_PATH} - "-DTEST_CMD:STRING=\"${TEST_CMD}\"" - -P ${CMAKE_SOURCE_DIR}/cmake/RunBuildTest.cmake - + COMMAND ${LL_TEST_COMMAND_value} DEPENDS test WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "C++ unit tests" |