@@ -165,8 +165,7 @@ endfunction()
165165#
166166# Logging options in the standard form of "-o filename,format"
167167# will be appended to the arguments list, prefixed with ARG_PREFIX.
168−# XUnitXML files will be stored in current binary dir or under
169−# ARTIFACTS_DIR, if set.
168+# XUnitXML files will be stored in current binary dir.
170169#
171170# Three targets will be created:
172171# - test${component_name} - Runs the test
@@ -179,14 +178,8 @@ function(add_executable_test COMPONENT_NAME TARGET)
179178 cmake_parse_arguments(QMLTEST "${QMLTEST_OPTIONS}" "${QMLTEST_SINGLE}" "${QMLTEST_MULTI}" ${ARGN})
180179 mangle_arguments()
181180
182− if(ARTIFACTS_DIR)
183− file(RELATIVE_PATH path ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
184− file(MAKE_DIRECTORY ${ARTIFACTS_DIR}/${path})
185− set(file_logger -o ${ARTIFACTS_DIR}/${path}/test${COMPONENT_NAME}.xml,xunitxml)
186− else()
187− file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
188− set(file_logger -o ${CMAKE_CURRENT_BINARY_DIR}/test${COMPONENT_NAME}.xml,xunitxml)
189− endif()
181+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
182+ set(file_logger -o ${CMAKE_CURRENT_BINARY_DIR}/test${COMPONENT_NAME}.xml,xunitxml)
190183
191184 bake_arguments("${QMLTEST_ARG_PREFIX}" args ${iterations} ${file_logger} ${STDOUT_LOGGER})
192185
@@ -304,10 +297,14 @@ function(install_test_script TARGET_NAME)
304297 set(script "${script}export UNITY_TESTING_DATADIR=\"${CMAKE_INSTALL_PREFIX}/${SHELL_APP_DIR}\"\n")
305298 set(script "${script}export UNITY_TESTING_LIBDIR=\"${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}\"\n")
306299 set(script "${script}\n")
300+ set(script "${script}XML_ARGS=\n")
301+ set(script "${script}if [ -n \"\$ARTIFACTS_DIR\" ]; then\n")
302+ set(script "${script} XML_ARGS=\"@XML_ARGS@\"\n")
303+ set(script "${script}fi\n")
304+ set(script "${script}\n")
307305 foreach(ONE_CMD ${TEST_COMMAND})
308306 set(script "${script}'${ONE_CMD}' ")
309307 endforeach()
310− set(script "${script}$@")
311308
312309 set(filename "${CMAKE_BINARY_DIR}/tests/scripts/${TARGET_NAME}.sh")
313310
@@ -328,6 +325,11 @@ function(install_test_script TARGET_NAME)
328325 file(READ \"${filename}\" replacestr)
329326
330327 # Now some replacements...
328+ # tests like to write xml output to our builddir; we don't need that, but we do want them in ARTIFACTS_DIR
329+ string(REGEX MATCH \"( '--parameter')? '-o'( '--parameter')? '[^ ]*,xunitxml' \" xmlargs \"\${replacestr}\")
330+ string(REGEX REPLACE \"( '--parameter')? '-o'( '--parameter')? '[^ ]*,xunitxml' \" \" \\\$XML_ARGS \" replacestr \"\${replacestr}\")
331+ string(REGEX REPLACE \"${CMAKE_BINARY_DIR}\" \"\\\$ARTIFACTS_DIR\" xmlargs \"\${xmlargs}\")
332+ string(REGEX REPLACE \"@XML_ARGS@\" \"\${xmlargs}\" replacestr \"\${replacestr}\")
331333 # replace build/source roots with their install paths
332334 string(REPLACE \"${CMAKE_BINARY_DIR}/libs\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}\" replacestr \"\${replacestr}\")
333335 string(REPLACE \"${CMAKE_BINARY_DIR}/plugins\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}\" replacestr \"\${replacestr}\")
@@ -339,8 +341,6 @@ function(install_test_script TARGET_NAME)
339341 string(REPLACE \"${CMAKE_BINARY_DIR}/tests/utils/modules\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}/utils\" replacestr \"\${replacestr}\")
340342 string(REPLACE \"${CMAKE_SOURCE_DIR}/tests/plugins\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_APP_DIR}/tests/plugins\" replacestr \"\${replacestr}\")
341343 string(REPLACE \"${CMAKE_SOURCE_DIR}/tests/qmltests\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_APP_DIR}/tests/qmltests\" replacestr \"\${replacestr}\")
342− # tests like to write xml output to our builddir; we don't need that
343− string(REGEX REPLACE \"( '--parameter')? '-o'( '--parameter')? '[^ ]*,xunitxml' \" \" \" replacestr \"\${replacestr}\")
344344
345345 file(WRITE \"${filename}\" \"\${replacestr}\")
346346 ")