Commit 9300cba0 authored by Marco Clemencic's avatar Marco Clemencic
Browse files

support proper skipping of .qmt tests (with CMake 3)

parent da5883b7
......@@ -73,6 +73,10 @@ def main():
parser.add_option('-C', '--workdir', action='store',
help='directory to change to before starting the test')
parser.add_option('--skip-return-code', type='int',
help='return code to use to flag a test as skipped '
'[default %default]')
verbosity_opts = OptionGroup(parser, 'Verbosity Level',
'set the verbosity level of messages')
verbosity_opts.add_option('--silent',
......@@ -100,7 +104,8 @@ def main():
parser.set_defaults(log_level=logging.WARNING,
report='basic',
workdir=os.curdir)
workdir=os.curdir,
skip_return_code=0)
opts, args = parser.parse_args()
......@@ -143,6 +148,8 @@ def main():
logging.debug('test failed: unexpected %s',
', '.join(results['Causes']))
return int(results.get('Exit Code', '1'))
elif results.get('Status') == 'skipped':
return opts.skip_return_code
return 0
if __name__ == '__main__':
......
......@@ -79,6 +79,7 @@ class TestOrganizer :
"passed" :"PASS",
"failed" :"FAIL",
"skipped" : "SKIPPED",
"notrun" : "SKIPPED",
"error" : "ERROR",
"untested" :"UNTESTED"
}
......@@ -584,19 +585,9 @@ def main():
"fields" : ["end_time", "start_time","stdout"], # some interface specific field
"cause" : ""
}
if Test.get("Status") == "passed" :
summary["outcome"] = "PASS"
elif Test.get("Status") == "failed" :
summary["outcome"] = "FAIL"
elif Test.get("Status") == "skipped" :
summary["outcome"] = "SKIPPED"
elif Test.get("Status") == "error" :
summary["outcome"] = "ERROR"
elif Test.get("Status") == "untested" :
summary["outcome"] = "UNTESTED"
else :
summary["outcome"] = cleanSpace(cleanWebChar(Test.get("Status")))
## TODO : Complete with all other possible ctest outcomes
status = Test.get("Status")
summary["outcome"] = TestOrganizer.status.get(status,
cleanSpace(cleanWebChar(status)))
if 'test-wrapper' in labels and summary["outcome"] == 'PASS':
# we should not report the results of test wrappers (like
......
......@@ -2278,15 +2278,29 @@ function(gaudi_add_test name)
string(REPLACE ".qmt" "" qmt_name "${qmt_name}")
string(REGEX REPLACE "^${subdir_name_lower}\\." "" qmt_name "${qmt_name}")
#message(STATUS "adding test ${qmt_file} as ${qmt_name}")
gaudi_add_test(${qmt_name}
COMMAND python -m GaudiTesting.Run
set(test_cmd python -m GaudiTesting.Run)
if(NOT CMAKE_VERSION VERSION_LESS 3.0)
set(test_cmd ${test_cmd} --skip-return-code 77)
endif()
set(test_cmd ${test_cmd}
--workdir ${qmtest_root_dir}
--common-tmpdir ${CMAKE_CURRENT_BINARY_DIR}/tests_tmp
--report ctest
${qmt_file}
${qmt_file})
gaudi_add_test(${qmt_name}
COMMAND ${test_cmd}
WORKING_DIRECTORY ${qmtest_root_dir}
LABELS QMTest ${ARG_LABELS}
ENVIRONMENT ${ARG_ENVIRONMENT})
# we need to reapply the logic to qmt_name
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(test_name ${qmt_name})
else()
set(test_name ${package}.${qmt_name})
endif()
if(NOT CMAKE_VERSION VERSION_LESS 3.0)
set_property(TEST ${test_name} PROPERTY SKIP_RETURN_CODE 77)
endif()
endforeach()
# extract dependencies
execute_process(COMMAND ${qmtest_metadata_cmd}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment