Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run ign-cmake's copy of check_test_ran #168

Merged
merged 2 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ install(DIRECTORY benchmark/
install(DIRECTORY codecheck/
DESTINATION ${IGN_DATA_INSTALL_DIR}/codecheck)

#--------------------------------------
# Install the tools files
install(DIRECTORY tools/
DESTINATION ${IGN_DATA_INSTALL_DIR}/tools)

#============================================================================
# Configure the package to be installed
Expand Down
2 changes: 1 addition & 1 deletion cmake/IgnUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1718,7 +1718,7 @@ macro(ign_build_tests)
if(PYTHONINTERP_FOUND)
# Check that the test produced a result and create a failure if it didn't.
# Guards against crashed and timed out tests.
add_test(check_${target_name} ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/check_test_ran.py
add_test(check_${target_name} ${PYTHON_EXECUTABLE} ${IGNITION_CMAKE_TOOLS_DIR}/check_test_ran.py
${CMAKE_BINARY_DIR}/test_results/${target_name}.xml)
endif()
endforeach()
Expand Down
1 change: 1 addition & 0 deletions config/ignition-cmake-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,6 @@ if( NOT IGNITION_CMAKE_VERSION_MAJOR
set(IGNITION_CMAKE_DOXYGEN_DIR "@PACKAGE_IGN_DATA_INSTALL_DIR@/doxygen")
set(IGNITION_CMAKE_CODECHECK_DIR "@PACKAGE_IGN_DATA_INSTALL_DIR@/codecheck")
set(IGNITION_CMAKE_BENCHMARK_DIR "@PACKAGE_IGN_DATA_INSTALL_DIR@/benchmark")
set(IGNITION_CMAKE_TOOLS_DIR "@PACKAGE_IGN_DATA_INSTALL_DIR@/tools")

endif()
6 changes: 3 additions & 3 deletions tools/check_test_ran.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,18 @@ def check_main():

print("Checking for test results in %s"%test_file)

if not os.path.exists(test_file):
if not os.path.exists(test_file) or os.path.getsize(test_file) == 0:
if not os.path.exists(os.path.dirname(test_file)):
os.makedirs(os.path.dirname(test_file))

print("Cannot find results, writing failure results to", test_file)

with open(test_file, 'w') as f:
test_name = os.path.basename(test_file)
d = {'test': test_name, 'test_file': test_file }
d = {'test': test_name, 'test_file': test_file , 'test_no_xml': test_name.replace('.xml', '')}
f.write("""<?xml version="1.0" encoding="UTF-8"?>
<testsuite tests="1" failures="1" time="1" errors="0" name="%(test)s">
<testcase name="test_ran" status="run" time="1" classname="Results">
<testcase name="test_ran" status="run" time="1" classname="%(test_no_xml)s">
<failure message="Unable to find test results for %(test)s, test did not run.\nExpected results in %(test_file)s" type=""/>
</testcase>
</testsuite>"""%d)
Expand Down
28 changes: 0 additions & 28 deletions tools/code_check.sh

This file was deleted.