|
|
@ -31,13 +31,15 @@ from .util import (
|
|
|
|
ApplicationError,
|
|
|
|
ApplicationError,
|
|
|
|
common_environment,
|
|
|
|
common_environment,
|
|
|
|
ANSIBLE_TEST_DATA_ROOT,
|
|
|
|
ANSIBLE_TEST_DATA_ROOT,
|
|
|
|
to_bytes,
|
|
|
|
|
|
|
|
to_text,
|
|
|
|
to_text,
|
|
|
|
|
|
|
|
make_dirs,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
from .util_common import (
|
|
|
|
from .util_common import (
|
|
|
|
intercept_command,
|
|
|
|
intercept_command,
|
|
|
|
ResultType,
|
|
|
|
ResultType,
|
|
|
|
|
|
|
|
write_text_test_results,
|
|
|
|
|
|
|
|
write_json_test_results,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
from .config import (
|
|
|
|
from .config import (
|
|
|
@ -68,7 +70,12 @@ def command_coverage_combine(args):
|
|
|
|
:type args: CoverageConfig
|
|
|
|
:type args: CoverageConfig
|
|
|
|
:rtype: list[str]
|
|
|
|
:rtype: list[str]
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
return _command_coverage_combine_powershell(args) + _command_coverage_combine_python(args)
|
|
|
|
paths = _command_coverage_combine_powershell(args) + _command_coverage_combine_python(args)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for path in paths:
|
|
|
|
|
|
|
|
display.info('Generated combined output: %s' % path, verbosity=1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return paths
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _command_coverage_combine_python(args):
|
|
|
|
def _command_coverage_combine_python(args):
|
|
|
@ -342,6 +349,7 @@ def command_coverage_html(args):
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
dir_name = os.path.join(ResultType.REPORTS.path, os.path.basename(output_file))
|
|
|
|
dir_name = os.path.join(ResultType.REPORTS.path, os.path.basename(output_file))
|
|
|
|
|
|
|
|
make_dirs(dir_name)
|
|
|
|
run_coverage(args, output_file, 'html', ['-i', '-d', dir_name])
|
|
|
|
run_coverage(args, output_file, 'html', ['-i', '-d', dir_name])
|
|
|
|
|
|
|
|
|
|
|
|
display.info('HTML report generated: file:///%s' % os.path.join(dir_name, 'index.html'))
|
|
|
|
display.info('HTML report generated: file:///%s' % os.path.join(dir_name, 'index.html'))
|
|
|
@ -354,7 +362,7 @@ def command_coverage_xml(args):
|
|
|
|
output_files = command_coverage_combine(args)
|
|
|
|
output_files = command_coverage_combine(args)
|
|
|
|
|
|
|
|
|
|
|
|
for output_file in output_files:
|
|
|
|
for output_file in output_files:
|
|
|
|
xml_name = os.path.join(ResultType.REPORTS.path, '%s.xml' % os.path.basename(output_file))
|
|
|
|
xml_name = '%s.xml' % os.path.basename(output_file)
|
|
|
|
if output_file.endswith('-powershell'):
|
|
|
|
if output_file.endswith('-powershell'):
|
|
|
|
report = _generage_powershell_xml(output_file)
|
|
|
|
report = _generage_powershell_xml(output_file)
|
|
|
|
|
|
|
|
|
|
|
@ -362,10 +370,11 @@ def command_coverage_xml(args):
|
|
|
|
reparsed = minidom.parseString(rough_string)
|
|
|
|
reparsed = minidom.parseString(rough_string)
|
|
|
|
pretty = reparsed.toprettyxml(indent=' ')
|
|
|
|
pretty = reparsed.toprettyxml(indent=' ')
|
|
|
|
|
|
|
|
|
|
|
|
with open(xml_name, 'w') as xml_fd:
|
|
|
|
write_text_test_results(ResultType.REPORTS, xml_name, pretty)
|
|
|
|
xml_fd.write(pretty)
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
run_coverage(args, output_file, 'xml', ['-i', '-o', xml_name])
|
|
|
|
xml_path = os.path.join(ResultType.REPORTS.path, xml_name)
|
|
|
|
|
|
|
|
make_dirs(ResultType.REPORTS.path)
|
|
|
|
|
|
|
|
run_coverage(args, output_file, 'xml', ['-i', '-o', xml_path])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def command_coverage_erase(args):
|
|
|
|
def command_coverage_erase(args):
|
|
|
@ -504,8 +513,6 @@ def _command_coverage_combine_powershell(args):
|
|
|
|
invalid_path_count = 0
|
|
|
|
invalid_path_count = 0
|
|
|
|
invalid_path_chars = 0
|
|
|
|
invalid_path_chars = 0
|
|
|
|
|
|
|
|
|
|
|
|
coverage_file = os.path.join(ResultType.COVERAGE.path, COVERAGE_OUTPUT_FILE_NAME)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for group in sorted(groups):
|
|
|
|
for group in sorted(groups):
|
|
|
|
coverage_data = groups[group]
|
|
|
|
coverage_data = groups[group]
|
|
|
|
|
|
|
|
|
|
|
@ -528,11 +535,11 @@ def _command_coverage_combine_powershell(args):
|
|
|
|
coverage_data[source] = _default_stub_value(source_line_count)
|
|
|
|
coverage_data[source] = _default_stub_value(source_line_count)
|
|
|
|
|
|
|
|
|
|
|
|
if not args.explain:
|
|
|
|
if not args.explain:
|
|
|
|
output_file = coverage_file + group + '-powershell'
|
|
|
|
output_file = COVERAGE_OUTPUT_FILE_NAME + group + '-powershell'
|
|
|
|
with open(output_file, 'wb') as output_file_fd:
|
|
|
|
|
|
|
|
output_file_fd.write(to_bytes(json.dumps(coverage_data)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output_files.append(output_file)
|
|
|
|
write_json_test_results(ResultType.COVERAGE, output_file, coverage_data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output_files.append(os.path.join(ResultType.COVERAGE.path, output_file))
|
|
|
|
|
|
|
|
|
|
|
|
if invalid_path_count > 0:
|
|
|
|
if invalid_path_count > 0:
|
|
|
|
display.warning(
|
|
|
|
display.warning(
|
|
|
|