mirror of https://github.com/CGAL/cgal
Parse the XML file Test.xml from `ctest -D`
... eventually, that will help move from our testsuite scripts to CTest testsuite, plus CDash.
This commit is contained in:
parent
a4c29ed9aa
commit
a63cfa9612
|
|
@ -46,9 +46,11 @@ function(expand_list_with_globbing list_name)
|
|||
endfunction()
|
||||
|
||||
function(cgal_add_test exe_name)
|
||||
add_test(NAME "compilation_of__${exe_name}"
|
||||
COMMAND ${TIME_COMMAND} "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target "${exe_name}")
|
||||
set(cin_file "${CGAL_CURRENT_SOURCE_DIR}/${exe_name}.cin")
|
||||
if(EXISTS ${cin_file})
|
||||
add_test(NAME ${exe_name}
|
||||
add_test(NAME execution___of__${exe_name}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DCMD:STRING=$<TARGET_FILE:${exe_name}>
|
||||
-DCIN:STRING=${cin_file}
|
||||
|
|
@ -77,19 +79,17 @@ function(cgal_add_test exe_name)
|
|||
expand_list_with_globbing(ARGS)
|
||||
endif()
|
||||
# message(STATUS "add test: ${exe_name} ${ARGS}")
|
||||
add_test(NAME ${exe_name} COMMAND ${exe_name} ${ARGS})
|
||||
add_test(NAME execution___of__${exe_name} COMMAND $<TARGET_FILE:${exe_name}> ${ARGS})
|
||||
endif()
|
||||
set_property(TEST "${exe_name}"
|
||||
set_property(TEST "execution___of__${exe_name}"
|
||||
APPEND PROPERTY LABELS "${PROJECT_NAME}")
|
||||
# message(STATUS " working dir: ${CGAL_CURRENT_SOURCE_DIR}")
|
||||
set_property(TEST "${exe_name}"
|
||||
set_property(TEST "execution___of__${exe_name}"
|
||||
PROPERTY WORKING_DIRECTORY ${CGAL_CURRENT_SOURCE_DIR})
|
||||
add_test(NAME "build_target_${exe_name}"
|
||||
COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target "${exe_name}")
|
||||
set_property(TEST "build_target_${exe_name}"
|
||||
set_property(TEST "compilation_of__${exe_name}"
|
||||
APPEND PROPERTY LABELS "${PROJECT_NAME}")
|
||||
set_property(TEST "${exe_name}"
|
||||
APPEND PROPERTY DEPENDS "build_target_${exe_name}")
|
||||
set_property(TEST "execution___of__${exe_name}"
|
||||
APPEND PROPERTY DEPENDS "compilation_of__${exe_name}")
|
||||
|
||||
return()
|
||||
|
||||
|
|
@ -108,9 +108,9 @@ function(cgal_add_test exe_name)
|
|||
# see https://github.com/CGAL/cgal/pull/1295/files/c65d3abe17bb3e677b8077996cdaf8672f9c4c6f#r71705451
|
||||
endif()
|
||||
string(REPLACE ";" " " args_str "${ARGS}")
|
||||
add_test(NAME ${exe_name}
|
||||
COMMAND ${exe_name} ${ARGS}
|
||||
add_test(NAME execution___of__${exe_name}
|
||||
COMMAND $<TARGET_FILE:${exe_name}> ${ARGS}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set_property(TEST "${exe_name}"
|
||||
set_property(TEST "execution___of__${exe_name}"
|
||||
APPEND PROPERTY LABELS "${PROJECT_NAME}")
|
||||
endfunction()
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ if ( CGAL_FOUND )
|
|||
|
||||
create_single_source_cgal_program( will_fail.cpp will_fail_aux.cpp )
|
||||
if(BUILD_TESTING)
|
||||
set_property(TEST will_fail PROPERTY WILL_FAIL TRUE)
|
||||
set_property(TEST execution___of__will_fail PROPERTY WILL_FAIL TRUE)
|
||||
endif()
|
||||
|
||||
find_package( TBB QUIET )
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
from __future__ import print_function
|
||||
from collections import defaultdict
|
||||
import xml.etree.ElementTree as ET
|
||||
import os
|
||||
import errno
|
||||
|
||||
xml = open("Test.xml", 'rb').read();
|
||||
|
||||
def open_file_create_dir(filename, mode):
|
||||
if not os.path.exists(os.path.dirname(filename)):
|
||||
try:
|
||||
os.makedirs(os.path.dirname(filename))
|
||||
except OSError as exc: # Guard against race condition
|
||||
if exc.errno != errno.EEXIST:
|
||||
raise
|
||||
return open(filename, mode)
|
||||
|
||||
root=ET.fromstring(xml)
|
||||
testing = root.find('Testing')
|
||||
testlist = testing.find('TestList')
|
||||
nb = 0
|
||||
tests_ids = {}
|
||||
for t in testlist:
|
||||
tests_ids[t.text] = nb
|
||||
nb += 1
|
||||
|
||||
tests = {}
|
||||
for t in testing.findall('Test'):
|
||||
tests[tests_ids[t.find('FullName').text]] = \
|
||||
{ \
|
||||
"Name": t.find('Name').text, \
|
||||
"Status": t.attrib['Status'], \
|
||||
"Output": t.find('Results').find('Measurement').find('Value').text, \
|
||||
"Labels": [l.text for l in t.find('Labels').findall('Label')], \
|
||||
}
|
||||
|
||||
tests_per_label = defaultdict(list)
|
||||
for t_id in range(0, len(tests)):
|
||||
t = tests[t_id]
|
||||
for label in t['Labels']:
|
||||
tests_per_label[label].append(t)
|
||||
|
||||
for label, tests in tests_per_label.items():
|
||||
with open_file_create_dir("{}/error.txt".format(label), 'w') as error:
|
||||
for t in tests:
|
||||
print(" {} of {}".format("successful " if (t['Status'] == 'passed') else "ERROR: ", t['Name']), file=error)
|
||||
with open("{}/ProgramOutput.{}".format(label, t['Name']), 'w') as f:
|
||||
f.write(t['Output'] if t['Output'] != None else "")
|
||||
Loading…
Reference in New Issue